PROBLEM: In the shmget() man page, the S_IRUSR, S_IWUSR etc are mentioned. This forces one has grep first to find out what #include file directive has to be added. SOLUTION: Add a line «#include "sys/stat.h"» to the synopsis.
I was curious what the standards compliant thing to do here was and it's apparently to be completely unhelpful and not say what the mode bit mean except in some other badly referenced document (having checked Solaris, Linux, and POSIX). We have some internal defines which are documented in semget.2. I wonder if we'd be better off switching to the SHM_[RW] version of that text (and adding it to msgget). That would avoid the need for more headers.
(In reply to Brooks Davis from comment #1) This confusion seems common. I saw there are various definitions. Some programs even have their own ones. Maybe it would be most helpful to also note that it are the same constants like in the common unix perms model, i.e. 0400, 0200, etc. (at least afaiu)
I've proposed a possible fix in https://reviews.freebsd.org/D14461
A commit references this bug: Author: brooks Date: Sun Mar 4 20:06:02 UTC 2018 New revision: 330409 URL: https://svnweb.freebsd.org/changeset/base/330409 Log: Refer to SysV IPC permissions as numeric constants. POSIX defines no macros for these permissions. Also remove unneeded headers from synopsis. PR: 225905 Reviewed by: wblock MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D14461 Changes: head/lib/libc/sys/msgget.2 head/lib/libc/sys/semget.2 head/lib/libc/sys/shmget.2
A commit references this bug: Author: brooks Date: Mon Mar 12 15:57:56 UTC 2018 New revision: 330800 URL: https://svnweb.freebsd.org/changeset/base/330800 Log: MFC r330409: Refer to SysV IPC permissions as numeric constants. POSIX defines no macros for these permissions. Also remove unneeded headers from synopsis. PR: 225905 Reviewed by: wblock Differential Revision: https://reviews.freebsd.org/D14461 Changes: _U stable/11/ stable/11/lib/libc/sys/msgget.2 stable/11/lib/libc/sys/semget.2 stable/11/lib/libc/sys/shmget.2
A commit references this bug: Author: brooks Date: Mon Mar 12 16:04:11 UTC 2018 New revision: 330801 URL: https://svnweb.freebsd.org/changeset/base/330801 Log: MFC r330409: Refer to SysV IPC permissions as numeric constants. POSIX defines no macros for these permissions. Also remove unneeded headers from synopsis. PR: 225905 Reviewed by: wblock Differential Revision: https://reviews.freebsd.org/D14461 Changes: _U stable/10/ stable/10/lib/libc/sys/msgget.2 stable/10/lib/libc/sys/semget.2 stable/10/lib/libc/sys/shmget.2