logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

msgget.3p (4881B)


  1. '\" et
  2. .TH MSGGET "3P" 2017 "IEEE/The Open Group" "POSIX Programmer's Manual"
  3. .\"
  4. .SH PROLOG
  5. This manual page is part of the POSIX Programmer's Manual.
  6. The Linux implementation of this interface may differ (consult
  7. the corresponding Linux manual page for details of Linux behavior),
  8. or the interface may not be implemented on Linux.
  9. .\"
  10. .SH NAME
  11. msgget
  12. \(em get the XSI message queue identifier
  13. .SH SYNOPSIS
  14. .LP
  15. .nf
  16. #include <sys/msg.h>
  17. .P
  18. int msgget(key_t \fIkey\fP, int \fImsgflg\fP);
  19. .fi
  20. .SH DESCRIPTION
  21. The
  22. \fImsgget\fR()
  23. function operates on XSI message queues (see the Base Definitions volume of POSIX.1\(hy2017,
  24. .IR "Section 3.226" ", " "Message Queue").
  25. It is unspecified whether this function interoperates with the
  26. realtime interprocess communication facilities defined in
  27. .IR "Section 2.8" ", " "Realtime".
  28. .P
  29. The
  30. \fImsgget\fR()
  31. function shall return the message queue identifier associated with the
  32. argument
  33. .IR key .
  34. .P
  35. A message queue identifier, associated message queue, and data
  36. structure (see
  37. .IR <sys/msg.h> ),
  38. shall be created for the argument
  39. .IR key
  40. if one of the following is true:
  41. .IP " *" 4
  42. The argument
  43. .IR key
  44. is equal to IPC_PRIVATE.
  45. .IP " *" 4
  46. The argument
  47. .IR key
  48. does not already have a message queue identifier associated with it,
  49. and (\fImsgflg\fP & IPC_CREAT) is non-zero.
  50. .P
  51. Upon creation, the data structure associated with the new message queue
  52. identifier shall be initialized as follows:
  53. .IP " *" 4
  54. .BR msg_perm.cuid ,
  55. .BR msg_perm.uid ,
  56. .BR msg_perm.cgid ,
  57. and
  58. .BR msg_perm.gid
  59. shall be set to the effective user ID and effective group ID,
  60. respectively, of the calling process.
  61. .IP " *" 4
  62. The low-order 9 bits of
  63. .BR msg_perm.mode
  64. shall be set to the low-order 9 bits of
  65. .IR msgflg .
  66. .IP " *" 4
  67. .BR msg_qnum ,
  68. .BR msg_lspid ,
  69. .BR msg_lrpid ,
  70. .BR msg_stime ,
  71. and
  72. .BR msg_rtime
  73. shall be set to 0.
  74. .IP " *" 4
  75. .BR msg_ctime
  76. shall be set to the current time, as described in
  77. .IR "Section 2.7.1" ", " "IPC General Description".
  78. .IP " *" 4
  79. .BR msg_qbytes
  80. shall be set to the system limit.
  81. .SH "RETURN VALUE"
  82. Upon successful completion,
  83. \fImsgget\fR()
  84. shall return a non-negative integer, namely a message queue identifier.
  85. Otherwise, it shall return \-1 and set
  86. .IR errno
  87. to indicate the error.
  88. .SH ERRORS
  89. The
  90. \fImsgget\fR()
  91. function shall fail if:
  92. .TP
  93. .BR EACCES
  94. A message queue identifier exists for the argument
  95. .IR key ,
  96. but operation permission as specified by the low-order 9 bits of
  97. .IR msgflg
  98. would not be granted; see
  99. .IR "Section 2.7" ", " "XSI Interprocess Communication".
  100. .TP
  101. .BR EEXIST
  102. A message queue identifier exists for the argument
  103. .IR key
  104. but ((\fImsgflg\fP & IPC_CREAT) && (\fImsgflg\fP & IPC_EXCL)) is
  105. non-zero.
  106. .TP
  107. .BR ENOENT
  108. A message queue identifier does not exist for the argument
  109. .IR key
  110. and (\fImsgflg\fP & IPC_CREAT) is 0.
  111. .TP
  112. .BR ENOSPC
  113. A message queue identifier is to be created but the system-imposed
  114. limit on the maximum number of allowed message queue identifiers
  115. system-wide would be exceeded.
  116. .LP
  117. .IR "The following sections are informative."
  118. .SH EXAMPLES
  119. None.
  120. .SH "APPLICATION USAGE"
  121. The POSIX Realtime Extension defines alternative interfaces for interprocess communication
  122. (IPC). Application developers who need to use IPC should design their
  123. applications so that modules using the IPC routines described in
  124. .IR "Section 2.7" ", " "XSI Interprocess Communication"
  125. can be easily modified to use the alternative interfaces.
  126. .SH RATIONALE
  127. None.
  128. .SH "FUTURE DIRECTIONS"
  129. None.
  130. .SH "SEE ALSO"
  131. .IR "Section 2.7" ", " "XSI Interprocess Communication",
  132. .IR "Section 2.8" ", " "Realtime",
  133. .IR "\fIftok\fR\^(\|)",
  134. .IR "\fImq_close\fR\^(\|)",
  135. .IR "\fImq_getattr\fR\^(\|)",
  136. .IR "\fImq_notify\fR\^(\|)",
  137. .IR "\fImq_open\fR\^(\|)",
  138. .IR "\fImq_receive\fR\^(\|)",
  139. .IR "\fImq_send\fR\^(\|)",
  140. .IR "\fImq_setattr\fR\^(\|)",
  141. .IR "\fImq_unlink\fR\^(\|)",
  142. .IR "\fImsgctl\fR\^(\|)",
  143. .IR "\fImsgrcv\fR\^(\|)",
  144. .IR "\fImsgsnd\fR\^(\|)"
  145. .P
  146. The Base Definitions volume of POSIX.1\(hy2017,
  147. .IR "Section 3.226" ", " "Message Queue",
  148. .IR "\fB<sys_msg.h>\fP"
  149. .\"
  150. .SH COPYRIGHT
  151. Portions of this text are reprinted and reproduced in electronic form
  152. from IEEE Std 1003.1-2017, Standard for Information Technology
  153. -- Portable Operating System Interface (POSIX), The Open Group Base
  154. Specifications Issue 7, 2018 Edition,
  155. Copyright (C) 2018 by the Institute of
  156. Electrical and Electronics Engineers, Inc and The Open Group.
  157. In the event of any discrepancy between this version and the original IEEE and
  158. The Open Group Standard, the original IEEE and The Open Group Standard
  159. is the referee document. The original Standard can be obtained online at
  160. http://www.opengroup.org/unix/online.html .
  161. .PP
  162. Any typographical or formatting errors that appear
  163. in this page are most likely
  164. to have been introduced during the conversion of the source files to
  165. man page format. To report such errors, see
  166. https://www.kernel.org/doc/man-pages/reporting_bugs.html .