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

shmctl.3p (5099B)


  1. '\" et
  2. .TH SHMCTL "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. shmctl
  12. \(em XSI shared memory control operations
  13. .SH SYNOPSIS
  14. .LP
  15. .nf
  16. #include <sys/shm.h>
  17. .P
  18. int shmctl(int \fIshmid\fP, int \fIcmd\fP, struct shmid_ds *\fIbuf\fP);
  19. .fi
  20. .SH DESCRIPTION
  21. The
  22. \fIshmctl\fR()
  23. function operates on XSI shared memory (see the Base Definitions volume of POSIX.1\(hy2017,
  24. .IR "Section 3.346" ", " "Shared Memory Object").
  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. \fIshmctl\fR()
  31. function provides a variety of shared memory control operations as
  32. specified by
  33. .IR cmd .
  34. The following values for
  35. .IR cmd
  36. are available:
  37. .IP IPC_STAT 12
  38. Place the current value of each member of the
  39. .BR shmid_ds
  40. data structure associated with
  41. .IR shmid
  42. into the structure pointed to by
  43. .IR buf .
  44. The contents of the structure are defined in
  45. .IR <sys/shm.h> .
  46. .IP IPC_SET 12
  47. Set the value of the following members of the
  48. .BR shmid_ds
  49. data structure associated with
  50. .IR shmid
  51. to the corresponding value found in the structure pointed to by
  52. .IR buf :
  53. .RS 12
  54. .sp
  55. .RS 4
  56. .nf
  57. shm_perm.uid
  58. shm_perm.gid
  59. shm_perm.mode \fRLow-order nine bits.\fP
  60. .fi
  61. .P
  62. .RE
  63. .P
  64. Also, the
  65. .IR shm_ctime
  66. timestamp shall be set to the current time, as described in
  67. .IR "Section 2.7.1" ", " "IPC General Description".
  68. .P
  69. IPC_SET can only be executed by a process that has an effective user ID
  70. equal to either that of a process with appropriate privileges or to the
  71. value of
  72. .IR shm_perm.cuid
  73. or
  74. .IR shm_perm.uid
  75. in the
  76. .BR shmid_ds
  77. data structure associated with
  78. .IR shmid .
  79. .RE
  80. .IP IPC_RMID 12
  81. Remove the shared memory identifier specified by
  82. .IR shmid
  83. from the system and destroy the shared memory segment and
  84. .BR shmid_ds
  85. data structure associated with it. IPC_RMID can only be executed by a
  86. process that has an effective user ID equal to either that of a process
  87. with appropriate privileges or to the value of
  88. .IR shm_perm.cuid
  89. or
  90. .IR shm_perm.uid
  91. in the
  92. .BR shmid_ds
  93. data structure associated with
  94. .IR shmid .
  95. .SH "RETURN VALUE"
  96. Upon successful completion,
  97. \fIshmctl\fR()
  98. shall return 0; otherwise, it shall return \-1 and set
  99. .IR errno
  100. to indicate the error.
  101. .SH ERRORS
  102. The
  103. \fIshmctl\fR()
  104. function shall fail if:
  105. .TP
  106. .BR EACCES
  107. The argument
  108. .IR cmd
  109. is equal to IPC_STAT and the calling process does not have read
  110. permission; see
  111. .IR "Section 2.7" ", " "XSI Interprocess Communication".
  112. .TP
  113. .BR EINVAL
  114. The value of
  115. .IR shmid
  116. is not a valid shared memory identifier, or the value of
  117. .IR cmd
  118. is not a valid command.
  119. .TP
  120. .BR EPERM
  121. The argument
  122. .IR cmd
  123. is equal to IPC_RMID or IPC_SET and the effective user ID of the
  124. calling process is not equal to that of a process with appropriate
  125. privileges and it is not equal to the value of
  126. .IR shm_perm.cuid
  127. or
  128. .IR shm_perm.uid
  129. in the data structure associated with
  130. .IR shmid .
  131. .br
  132. .P
  133. The
  134. \fIshmctl\fR()
  135. function may fail if:
  136. .TP
  137. .BR EOVERFLOW
  138. The
  139. .IR cmd
  140. argument is IPC_STAT and the
  141. .IR gid
  142. or
  143. .IR uid
  144. value is too large to be stored in the structure pointed to by the
  145. .IR buf
  146. argument.
  147. .LP
  148. .IR "The following sections are informative."
  149. .SH EXAMPLES
  150. None.
  151. .SH "APPLICATION USAGE"
  152. The POSIX Realtime Extension defines alternative interfaces for interprocess
  153. communication. Application developers who need to use IPC should
  154. design their applications so that modules using the IPC routines
  155. described in
  156. .IR "Section 2.7" ", " "XSI Interprocess Communication"
  157. can be easily modified to use the alternative interfaces.
  158. .SH RATIONALE
  159. None.
  160. .SH "FUTURE DIRECTIONS"
  161. None.
  162. .SH "SEE ALSO"
  163. .IR "Section 2.7" ", " "XSI Interprocess Communication",
  164. .IR "Section 2.8" ", " "Realtime",
  165. .IR "\fIshmat\fR\^(\|)",
  166. .IR "\fIshmdt\fR\^(\|)",
  167. .IR "\fIshmget\fR\^(\|)",
  168. .IR "\fIshm_open\fR\^(\|)",
  169. .IR "\fIshm_unlink\fR\^(\|)"
  170. .P
  171. The Base Definitions volume of POSIX.1\(hy2017,
  172. .IR "Section 3.346" ", " "Shared Memory Object",
  173. .IR "\fB<sys_shm.h>\fP"
  174. .\"
  175. .SH COPYRIGHT
  176. Portions of this text are reprinted and reproduced in electronic form
  177. from IEEE Std 1003.1-2017, Standard for Information Technology
  178. -- Portable Operating System Interface (POSIX), The Open Group Base
  179. Specifications Issue 7, 2018 Edition,
  180. Copyright (C) 2018 by the Institute of
  181. Electrical and Electronics Engineers, Inc and The Open Group.
  182. In the event of any discrepancy between this version and the original IEEE and
  183. The Open Group Standard, the original IEEE and The Open Group Standard
  184. is the referee document. The original Standard can be obtained online at
  185. http://www.opengroup.org/unix/online.html .
  186. .PP
  187. Any typographical or formatting errors that appear
  188. in this page are most likely
  189. to have been introduced during the conversion of the source files to
  190. man page format. To report such errors, see
  191. https://www.kernel.org/doc/man-pages/reporting_bugs.html .