Recent

Author Topic: msgrcv only succeeds if msgsnd sends a buffer with only zeros.  (Read 1133 times)

TCH

  • Full Member
  • ***
  • Posts: 184
Re: msgrcv only succeeds if msgsnd sends a buffer with only zeros.
« Reply #15 on: May 20, 2022, 10:48:15 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.
You can tell me that a few more times, but it will not change what happened in the past.
BTW:
Code: Bash  [Select][+][-]
  1. grep -r 'msgrcv' /usr/share/fpcsrc/3.2.2/
Code: [Select]
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';
Where are the example programs? I've installed FPC and FPC source from the Debian packages they provided.
« Last Edit: May 20, 2022, 10:57:24 am by TCH »

MarkMLl

  • Hero Member
  • *****
  • Posts: 4738
Re: msgrcv only succeeds if msgsnd sends a buffer with only zeros.
« Reply #16 on: May 20, 2022, 11:04:34 am »
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: [Select]
$ cd /usr/local/src_fpc/fpcbuild-3.2.2
$ find -iname '*msgtool*'
./fpcdocs/ipcex/msgtool.pp

...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
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

TCH

  • Full Member
  • ***
  • Posts: 184
Re: msgrcv only succeeds if msgsnd sends a buffer with only zeros.
« Reply #17 on: May 20, 2022, 12:26:01 pm »
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.
Did you check this certain example of msgctl? It says:
Code: Pascal  [Select][+][-]
  1. Type
  2.   PMyMsgBuf = ^TMyMsgBuf;
  3.   TMyMsgBuf = record
  4.     mtype : Longint;
  5.     mtext : string[255];
  6.   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?
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.
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...
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.
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

  • Hero Member
  • *****
  • Posts: 4738
Re: msgrcv only succeeds if msgsnd sends a buffer with only zeros.
« Reply #18 on: May 20, 2022, 01:15:36 pm »
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
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories


MarkMLl

  • Hero Member
  • *****
  • Posts: 4738
Re: msgrcv only succeeds if msgsnd sends a buffer with only zeros.
« Reply #20 on: May 20, 2022, 03:48:26 pm »
Well done :-)

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

 

TinyPortal © 2005-2018