MSGGET(3P)
π MSGGET(3P) β POSIX Programmer's Manual π
okay so bestie, welcome to the POSIX Programmer's Manual, we're doing msgget(3P) today and it's genuinely such a vibe π
β οΈ real talk first: this manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (so pls go consult the corresponding Linux manual page for details of Linux behavior), or honestly the interface may not be implemented on Linux at all. iykyk π
β¨ NAME β¨
msgget β get the XSI message queue identifier π¦
πΈ SYNOPSIS πΈ
#include <sys/msg.h>
int msgget(key_t key, int msgflg);
π DESCRIPTION π
so the msgget() function operates on XSI message queues (see the Base Definitions volume of POSIX.1β2017, Section 3.226, Message Queue). and like, it is unspecified whether this function interoperates with the realtime interprocess communication facilities defined in Section 2.8, Realtime. not us guessing, that's literally what it says π
The msgget() function shall return the message queue identifier associated with the argument key.
A message queue identifier, associated message queue, and data structure (see <sys/msg.h>) shall be created for the argument key if one of the following is true:
- The argument
keyis equal toIPC_PRIVATE. - The argument
keydoes not already have a message queue identifier associated with it, and(msgflg & IPC_CREAT)is non-zero.
Upon creation, the data structure associated with the new message queue identifier shall be initialized as follows:
msg_perm.cuid,msg_perm.uid,msg_perm.cgid, andmsg_perm.gidshall be set to the effective user ID and effective group ID, respectively, of the calling process.- The low-order 9 bits of
msg_perm.modeshall be set to the low-order 9 bits ofmsgflg. msg_qnum,msg_lspid,msg_lrpid,msg_stime, andmsg_rtimeshall be set to0.msg_ctimeshall be set to the current time, as described in Section 2.7.1, IPC General Description.msg_qbytesshall be set to the system limit.
π RETURN VALUE π
Upon successful completion, msgget() shall return a non-negative integer, namely a message queue identifier. slay. otherwise, it shall return -1 and set errno to indicate the error π
π₯ ERRORS π₯
The msgget() function shall fail if:
EACCESβ A message queue identifier exists for the argumentkey, but operation permission as specified by the low-order 9 bits ofmsgflgwould not be granted; see Section 2.7, XSI Interprocess Communication.EEXISTβ A message queue identifier exists for the argumentkeybut((msgflg & IPC_CREAT) && (msgflg & IPC_EXCL))is non-zero.ENOENTβ A message queue identifier does not exist for the argumentkeyand(msgflg & IPC_CREAT)is0.ENOSPCβ A message queue identifier is to be created but the system-imposed limit on the maximum number of allowed message queue identifiers system-wide would be exceeded.
The following sections are informative. (translation: cute bonus content, not the rules π)
π EXAMPLES π
None. bestie there is literally nothing here, no cap π«Ά
β APPLICATION USAGE β
The POSIX Realtime Extension defines alternative interfaces for interprocess communication (IPC). Application developers who need to use IPC should design their applications so that modules using the IPC routines described in Section 2.7, XSI Interprocess Communication can be easily modified to use the alternative interfaces. like, future-proofing your code? iconic behavior, periodt π
π RATIONALE π
None.
π¦ FUTURE DIRECTIONS π¦
None.
β¨ SEE ALSO β¨
Section 2.7, XSI Interprocess Communication, Section 2.8, Realtime, ftok(), mq_close(), mq_getattr(), mq_notify(), mq_open(), mq_receive(), mq_send(), mq_setattr(), mq_unlink(), msgctl(), msgrcv(), msgsnd()
The Base Definitions volume of POSIX.1β2017, Section 3.226, Message Queue, <sys_msg.h>
π COPYRIGHT π
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .
Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .
and that's the whole page bestie!! this one came from IEEE/The Open Group, dated 2017, and it lives in the POSIX Programmer's Manual as MSGGET(3P) πβ¨ go forth and queue those messages, you absolute legend π«Ά
π¦ where this page comes from
- alpine 3.22: man-pages-posix 2017a-r0 Β· custom
- alpine 3.23: man-pages-posix 2017a-r0 Β· custom
- alpine 3.24: man-pages-posix 2017a-r0 Β· custom
- arch rolling: man-pages 6.19-1
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages-posix 2017a
- opensuse-leap 16.0: man-pages-posix 2017a-160000.4.1 Β· SUSE-IEEE
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms