Forum > Unix

msgrcv only succeeds if msgsnd sends a buffer with only zeros.

<< < (4/5) > >>

TCH:

--- Quote from: MarkMLl on May 20, 2022, 10:37:29 am ---But if you'd started off with the example program- and this is the third- sorry, FOURTH- time I've told you this- you wouldn't have been caught by that one or at least would have had a much better idea of where to look.
--- End quote ---
You can tell me that a few more times, but it will not change what happened in the past.
BTW:
--- Code: Bash  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---grep -r 'msgrcv' /usr/share/fpcsrc/3.2.2/
--- Code: ---rtl/dragonfly/sysnr.inc: syscall_nr_msgrcv                      = 227;
rtl/beos/ostypes.inc:        ru_msgrcv   : clong;            { messages received }
rtl/linux/arm/sysnr.inc:  syscall_nr_msgrcv                     = syscall_nr_base+302;
rtl/linux/sysnr-gen.inc:        syscall_nr_msgrcv                       = 188;
rtl/linux/x86_64/sysnr.inc:  syscall_nr_msgrcv                             = 70;
rtl/openbsd/sysnr.inc:(* 227 *)    syscall_nr_msgrcv = 227;
rtl/netbsd/sysnr.inc:  { syscall: "msgrcv" ret: "ssize_t" args: "int" "void  " "size_t" "long" "int"  }
rtl/netbsd/sysnr.inc:     syscall_nr_msgrcv = syscall_nr_base + 227;
rtl/netbsd/sysnr.inc:  { 227 is excluded msgrcv  }
rtl/bsd/ostypes.inc:        ru_msgrcv   : clong;            { messages received }
packages/pthreads/src/pthraix.inc:    ru_msgrcv,
packages/rtl-extra/src/linux/ipccall.inc:function msgrcv(msqid:cint; msgp: PMSGBuf; msgsz: size_t; msgtyp:clong; msgflg:cint):cint;
packages/rtl-extra/src/linux/ipccall.inc:  msgrcv:=ipccall(CALL_MSGRCV,msqid,msgsz,msgflg,@tmp,0);
packages/rtl-extra/src/linux/ipcsys.inc:function msgrcv(msqid:cint; msgp: PMSGBuf; msgsz: size_t; msgtyp:clong; msgflg:cint):cint;
packages/rtl-extra/src/linux/ipcsys.inc:msgrcv:=do_syscall(syscall_nr_MSGRCV,TSysParam(msqid),TSysParam(msgp),TSysParam(msgsz),TSysParam(msgtyp),TSysParam(msgflg));
packages/rtl-extra/src/unix/ipc.pp:Function msgrcv(msqid:cint; msgp: PMSGBuf; msgsz: size_t; msgtyp:clong; msgflg:cint): {$if defined(Darwin) or defined(aix) or defined(Solaris)}ssize_t;{$else}cint;{$endif} {$ifdef FPC_USE_LIBC} cdecl; external clib name 'msgrcv'; {$endif}
packages/rtl-extra/src/unix/ipccdecl.inc:Function cmsgrcv(msqid:cint; msgp: PMSGBuf; msgsz: size_t; msgtyp:cint; msgflg:cint):cint;  cdecl; external;
packages/rtl-extra/src/unix/ipccdecl.inc:Function msgrcv(msqid:cint; msgp: PMSGBuf; msgsz: size_t; msgtyp:cint; msgflg:cint):cint;
packages/rtl-extra/src/unix/ipccdecl.inc:  msgrcv:=cmsgrcv(msqid, msgp, msgsz, msgtyp, msgflg);
packages/rtl-extra/src/bsd/ipcbsd.inc:Function msgrcv(msqid:cint; msgp: PMSGBuf; msgsz: size_t; msgtyp:clong; msgflg:cint):cint;
packages/rtl-extra/src/bsd/ipcbsd.inc:  msgrcv:=(do_syscall(syscall_nr_msgrcv, msqid, TSysParam(msgp), msgsz, msgtyp, msgflg));
packages/rtl-extra/src/bsd/ipcbsd.inc:  msgrcv:=(do_syscall(syscall_nr_msgsys,3, msqid, TSysParam(msgp), msgsz, msgtyp, msgflg));
packages/libc/src/bresourceh.inc:       ru_msgrcv : longint;
packages/libc/src/smsgh.inc:function msgrcv(__msqid:longint; __msgp:pointer; __msgsz:size_t; __msgtyp:longint; __msgflg:longint):longint;cdecl;external clib name 'msgrcv';
packages/libc/src/smsgh.inc:function msgrcv(__msqid:longint; var __msgp; __msgsz:size_t; __msgtyp:longint; __msgflg:longint):longint;cdecl;external clib name 'msgrcv';
--- End code ---
Where are the example programs? I've installed FPC and FPC source from the Debian packages they provided.

MarkMLl:
If you can't find the examples, why didn't you say that when I first mentioned them?

Start off at

https://www.freepascal.org/docs.html

Ignore the PDF links, they're still broken. Yes, I have been complaining about it.

Select "Run-Time Library (RTL) units reference manual" hence

https://www.freepascal.org/docs-html/current/rtl/index.html

Scroll down to "ipc" hence

https://www.freepascal.org/docs-html/current/rtl/ipc/index.html

Click on "Procedures and functions" at the top. Go to "msgrcv" which among other things says "For an example, see msgctl." which has an example.

Alternatively


--- Code: ---$ cd /usr/local/src_fpc/fpcbuild-3.2.2
$ find -iname '*msgtool*'
./fpcdocs/ipcex/msgtool.pp

--- End code ---

...and so on.

Look, I'm not going to apologise for the difficulty finding some of this stuff: I've been making myself unpopular with the core team for years by complaining about it. But the fact is that the information /is/ in there, and a simple "is there a reliable example for..." or "I can't find..." would have saved you- and everybody else- a lot of grief.

MarkMLl

TCH:

--- Quote from: MarkMLl on May 20, 2022, 11:04:34 am ---Click on "Procedures and functions" at the top. Go to "msgrcv" which among other things says "For an example, see msgctl." which has an example.
--- End quote ---
Did you check this certain example of msgctl? It says:
--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---Type  PMyMsgBuf = ^TMyMsgBuf;  TMyMsgBuf = record    mtype : Longint;    mtext : string[255];  end;which is - as it just turned out - erroneous, because longint is always 32-bit and i have a 64-bit system; this should be clong. Tell me please, what difference it would made, if i would start based on this example and not converting my C code? Because for me, it seems that no difference would occur. My code was erroneous because i relied an erroneous source of C types which stated that the type of mtype is always 32-bit and not arch-register wide. Using this example would result the same. Is it still my fault?
--- Quote from: MarkMLl on May 20, 2022, 11:04:34 am ---Look, I'm not going to apologise for the difficulty finding some of this stuff: I've been making myself unpopular with the core team for years by complaining about it.
--- End quote ---
Chill out dude, i blame you for nothing.
I just pointed out that it is a bit funny that i get chastised once for using flawed random sources when the official sources are also flawed and next for not using the examples when those vaunted examples are not just missing from the default install, but they are also faulty...
--- Quote from: MarkMLl on May 20, 2022, 11:04:34 am ---But the fact is that the information /is/ in there, and a simple "is there a reliable example for..." or "I can't find..." would have saved you- and everybody else- a lot of grief.
--- End quote ---
The fact is that the information what is there is actually as erroneous as some random sources can be and thus, not reliable. The random source you had chastised me for using contained one flaw, while in the official documentation i have already found two with the very same characteristics (erroneous bitwidth) as in the random source.
As for the "lot of grief for everybody else"...aren't you overdramatizing it a bit? Aside from you, two other folks posted in this topic, one post each; one asked for some more information and the other one simply delivered the solution. I don't see the grief here... Only you are making a scene here by blaming me for not listening to you, while all the sources you have shown me contains the same bitwidth errors as Wikipedia.
I mean: C'mon man.

MarkMLl:
Look, I'm trying to do some work here.

You've uncovered a bug- a serious, showstopping bug IMO- in the documentation process. Report it.

Apropos the example programs: that in part is my mistake for which I apologise, I was assuming that they were run and checked with the formal test programs as part of the build process. Again, raise a bug report.

But my earlier points apply: you should only use Wikipaedia etc. for background information.

MarkMLl

TCH:
I've reported them:
https://gitlab.com/freepascal.org/fpc/documentation/-/issues/39311
https://gitlab.com/freepascal.org/fpc/documentation/-/issues/39312

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version