1 .\" Copyright 1993 Giorgio Ciucci (giorgio@crcc.it)
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date. The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein. The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" FIXME There is now duplication of some of the information
24 .\" below in semctl.2, msgctl.2, and shmctl.2 -- MTK, Nov 04
25 .TH SVIPC 7 2009-01-26 "Linux" "Linux Programmer's Manual"
27 svipc \- System V interprocess communication mechanisms
30 .B #include <sys/types.h>
31 .B #include <sys/ipc.h>
32 .B #include <sys/msg.h>
33 .B #include <sys/sem.h>
34 .B #include <sys/shm.h>
37 This manual page refers to the Linux implementation of the System V
38 interprocess communication (IPC) mechanisms:
39 message queues, semaphore sets, and shared memory segments.
40 In the following, the word
42 means an instantiation of one among such mechanisms.
43 .SS Resource Access Permissions
44 For each resource, the system uses a common structure of type
46 to store information needed in determining permissions to perform an
50 structure, defined by the
52 system header file, includes the following members:
57 uid_t cuid; /* creator user ID */
58 gid_t cgid; /* creator group ID */
59 uid_t uid; /* owner user ID */
60 gid_t gid; /* owner group ID */
61 unsigned short mode; /* r/w permissions */
70 structure defines, with its lower 9 bits, the access permissions to the
71 resource for a process executing an IPC system call.
72 The permissions are interpreted as follows:
85 Bits 0100, 0010, and 0001 (the execute bits) are unused by the system.
92 The same system header file also defines the following symbolic
96 Create entry if key doesn't exist.
102 Error if request must wait.
111 Set resource options.
114 Get resource options.
120 type, while all the other symbolic constants are flag fields and can
125 A message queue is uniquely identified by a positive integer
127 and has an associated data structure of type
128 .IR "struct msqid_ds" ,
131 containing the following members:
136 struct ipc_perm msg_perm;
137 msgqnum_t msg_qnum; /* no of messages on queue */
138 msglen_t msg_qbytes; /* bytes max on a queue */
139 pid_t msg_lspid; /* PID of last msgsnd(2) call */
140 pid_t msg_lrpid; /* PID of last msgrcv(2) call */
141 time_t msg_stime; /* last msgsnd(2) time */
142 time_t msg_rtime; /* last msgrcv(2) time */
143 time_t msg_ctime; /* last change time */
150 structure that specifies the access permissions on the message
154 Number of messages currently on the message queue.
157 Maximum number of bytes of message text allowed on the message
161 ID of the process that performed the last
166 ID of the process that performed the last
182 system call that changed a member of the
186 A semaphore set is uniquely identified by a positive integer
188 and has an associated data structure of type
189 .IR "struct semid_ds" ,
192 containing the following members:
197 struct ipc_perm sem_perm;
198 time_t sem_otime; /* last operation time */
199 time_t sem_ctime; /* last change time */
200 unsigned long sem_nsems; /* count of sems in set */
207 structure that specifies the access permissions on the semaphore
218 system call that changed a member of the above structure or of one
219 semaphore belonging to the set.
222 Number of semaphores in the set.
223 Each semaphore of the set is referenced by a nonnegative integer
229 A semaphore is a data structure of type
231 containing the following members:
236 int semval; /* semaphore value */
237 int sempid; /* PID for last operation */
238 .\" unsigned short semncnt; /* nr awaiting semval to increase */
239 .\" unsigned short semzcnt; /* nr awaiting semval = 0 */
245 Semaphore value: a nonnegative integer.
248 ID of the last process that performed a semaphore operation
252 .\"Number of processes suspended awaiting for
257 .\"Number of processes suspended awaiting for
260 .SS Shared Memory Segments
261 A shared memory segment is uniquely identified by a positive integer
263 and has an associated data structure of type
264 .IR "struct shmid_ds" ,
267 containing the following members:
272 struct ipc_perm shm_perm;
273 size_t shm_segsz; /* size of segment */
274 pid_t shm_cpid; /* PID of creator */
275 pid_t shm_lpid; /* PID, last operation */
276 shmatt_t shm_nattch; /* no. of current attaches */
277 time_t shm_atime; /* time of last attach */
278 time_t shm_dtime; /* time of last detach */
279 time_t shm_ctime; /* time of last change */
286 structure that specifies the access permissions on the shared memory
290 Size in bytes of the shared memory segment.
293 ID of the process that created the shared memory segment.
296 ID of the last process that executed a
303 Number of current alive attaches for this shared memory segment.
318 system call that changed