]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man7/svipc.7
Fix redundant formatting macros
[thirdparty/man-pages.git] / man7 / svipc.7
1 .\" Copyright 1993 Giorgio Ciucci (giorgio@crcc.it)
2 .\"
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.
6 .\"
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.
11 .\"
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
18 .\" professionally.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\"
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 1993-11-01 "Linux" "Linux Programmer's Manual"
26 .SH NAME
27 svipc \- System V interprocess communication mechanisms
28 .SH SYNOPSIS
29 .nf
30 .B
31 # include <sys/types.h>
32 .B
33 # include <sys/ipc.h>
34 .B
35 # include <sys/msg.h>
36 .B
37 # include <sys/sem.h>
38 .B
39 # include <sys/shm.h>
40 .SH DESCRIPTION
41 This manual page refers to the Linux implementation of the System V
42 interprocess communication mechanisms:
43 message queues, semaphore sets, and shared memory segments.
44 In the following, the word
45 .I resource
46 means an instantiation of one among such mechanisms.
47 .SS Resource Access Permissions
48 For each resource, the system uses a common structure of type
49 .I "struct ipc_perm"
50 to store information needed in determining permissions to perform an
51 ipc operation.
52 The
53 .I ipc_perm
54 structure, defined by the
55 .I <sys/ipc.h>
56 system header file, includes the following members:
57 .in +0.5i
58 .nf
59
60 struct ipc_perm {
61 uid_t cuid; /* creator user ID */
62 gid_t cgid; /* creator group ID */
63 uid_t uid; /* owner user ID */
64 gid_t gid; /* owner group ID */
65 ushort mode; /* r/w permissions */
66 };
67 .fi
68 .in
69 .PP
70 The
71 .I mode
72 member of the
73 .I ipc_perm
74 structure defines, with its lower 9 bits, the access permissions to the
75 resource for a process executing an ipc system call.
76 The permissions are interpreted as follows:
77 .sp
78 .nf
79 0400 Read by user.
80 0200 Write by user.
81 .sp .5
82 0040 Read by group.
83 0020 Write by group.
84 .sp .5
85 0004 Read by others.
86 0002 Write by others.
87 .fi
88 .PP
89 Bits 0100, 0010, and 0001 (the execute bits) are unused by the system.
90 Furthermore,
91 "write"
92 effectively means
93 "alter"
94 for a semaphore set.
95 .PP
96 The same system header file also defines the following symbolic
97 constants:
98 .TP 14
99 .B IPC_CREAT
100 Create entry if key doesn't exist.
101 .TP
102 .B IPC_EXCL
103 Fail if key exists.
104 .TP
105 .B IPC_NOWAIT
106 Error if request must wait.
107 .TP
108 .B IPC_PRIVATE
109 Private key.
110 .TP
111 .B IPC_RMID
112 Remove resource.
113 .TP
114 .B IPC_SET
115 Set resource options.
116 .TP
117 .B IPC_STAT
118 Get resource options.
119 .PP
120 Note that
121 .B IPC_PRIVATE
122 is a
123 .I key_t
124 type, while all the other symbolic constants are flag fields and can
125 be OR'ed into an
126 .I int
127 type variable.
128 .SS Message Queues
129 A message queue is uniquely identified by a positive integer
130 .RI "(its " msqid )
131 and has an associated data structure of type
132 .IR "struct msqid_ds" ,
133 defined in
134 .IR <sys/msg.h> ,
135 containing the following members:
136 .in +0.5i
137 .nf
138
139 struct msqid_ds {
140 struct ipc_perm msg_perm;
141 msgqnum_t msg_qnum; /* no of messages on queue */
142 msglen_t msg_qbytes; /* bytes max on a queue */
143 pid_t msg_lspid; /* PID of last msgsnd(2) call */
144 pid_t msg_lrpid; /* PID of last msgrcv(2) call */
145 time_t msg_stime; /* last msgsnd(2) time */
146 time_t msg_rtime; /* last msgrcv(2) time */
147 time_t msg_ctime; /* last change time */
148 };
149 .fi
150 .in
151 .TP 11
152 .I msg_perm
153 .I ipc_perm
154 structure that specifies the access permissions on the message
155 queue.
156 .TP
157 .I msg_qnum
158 Number of messages currently on the message queue.
159 .TP
160 .I msg_qbytes
161 Maximum number of bytes of message text allowed on the message
162 queue.
163 .TP
164 .I msg_lspid
165 ID of the process that performed the last
166 .BR msgsnd (2)
167 system call.
168 .TP
169 .I msg_lrpid
170 ID of the process that performed the last
171 .BR msgrcv (2)
172 system call.
173 .TP
174 .I msg_stime
175 Time of the last
176 .BR msgsnd (2)
177 system call.
178 .TP
179 .I msg_rtime
180 Time of the last
181 .BR msgrcv (2)
182 system call.
183 .TP
184 .I msg_ctime
185 Time of the last
186 system call that changed a member of the
187 .I msqid_ds
188 structure.
189 .SS Semaphore Sets
190 A semaphore set is uniquely identified by a positive integer
191 .RI "(its " semid )
192 and has an associated data structure of type
193 .IR "struct semid_ds" ,
194 defined in
195 .IR <sys/sem.h> ,
196 containing the following members:
197 .in +0.5i
198 .nf
199
200 struct semid_ds {
201 struct ipc_perm sem_perm;
202 time_t sem_otime; /* last operation time */
203 time_t sem_ctime; /* last change time */
204 ulong sem_nsems; /* count of sems in set */
205 };
206 .fi
207 .in
208 .TP 11
209 .I sem_perm
210 .I ipc_perm
211 structure that specifies the access permissions on the semaphore
212 set.
213 .TP
214 .I sem_otime
215 Time of last
216 .BR semop (2)
217 system call.
218 .TP
219 .I sem_ctime
220 Time of last
221 .BR semctl (2)
222 system call that changed a member of the above structure or of one
223 semaphore belonging to the set.
224 .TP
225 .I sem_nsems
226 Number of semaphores in the set.
227 Each semaphore of the set is referenced by a non-negative integer
228 ranging from
229 .B 0
230 to
231 .IR sem_nsems\-1 .
232 .PP
233 A semaphore is a data structure of type
234 .I "struct sem"
235 containing the following members:
236 .in +0.5i
237 .nf
238
239 struct sem {
240 int semval; /* semaphore value */
241 int sempid; /* PID for last operation */
242 .\" ushort semncnt; /* nr awaiting semval to increase */
243 .\" ushort semzcnt; /* nr awaiting semval = 0 */
244 }
245 .fi
246 .in
247 .TP 11
248 .I semval
249 Semaphore value: a non-negative integer.
250 .TP
251 .I sempid
252 ID of the last process that performed a semaphore operation
253 on this semaphore.
254 .\".TP
255 .\".I semncnt
256 .\"Number of processes suspended awaiting for
257 .\".I semval
258 .\"to increase.
259 .\".TP
260 .\".I semznt
261 .\"Number of processes suspended awaiting for
262 .\".I semval
263 .\"to become zero.
264 .SS Shared Memory Segments
265 A shared memory segment is uniquely identified by a positive integer
266 .RI "(its " shmid )
267 and has an associated data structure of type
268 .IR "struct shmid_ds" ,
269 defined in
270 .IR <sys/shm.h> ,
271 containing the following members:
272 .in +0.5i
273 .nf
274
275 struct shmid_ds {
276 struct ipc_perm shm_perm;
277 size_t shm_segsz; /* size of segment */
278 pid_t shm_cpid; /* PID of creator */
279 pid_t shm_lpid; /* PID, last operation */
280 shmatt_t shm_nattch; /* no. of current attaches */
281 time_t shm_atime; /* time of last attach */
282 time_t shm_dtime; /* time of last detach */
283 time_t shm_ctime; /* time of last change */
284 };
285 .fi
286 .in
287 .TP 11
288 .I shm_perm
289 .I ipc_perm
290 structure that specifies the access permissions on the shared memory
291 segment.
292 .TP
293 .I shm_segsz
294 Size in bytes of the shared memory segment.
295 .TP
296 .I shm_cpid
297 ID of the process that created the shared memory segment.
298 .TP
299 .I shm_lpid
300 ID of the last process that executed a
301 .BR shmat (2)
302 or
303 .BR shmdt (2)
304 system call.
305 .TP
306 .I shm_nattch
307 Number of current alive attaches for this shared memory segment.
308 .TP
309 .I shm_atime
310 Time of the last
311 .BR shmat (2)
312 system call.
313 .TP
314 .I shm_dtime
315 Time of the last
316 .BR shmdt (2)
317 system call.
318 .TP
319 .I shm_ctime
320 Time of the last
321 .BR shmctl (2)
322 system call that changed
323 .IR shmid_ds .
324 .SH "SEE ALSO"
325 .BR ipc (2),
326 .BR msgctl (2),
327 .BR msgget (2),
328 .BR msgrcv (2),
329 .BR msgsnd (2),
330 .BR semctl (2),
331 .BR semget (2),
332 .BR semop (2),
333 .BR shmat (2),
334 .BR shmctl (2),
335 .BR shmdt (2),
336 .BR shmget (2),
337 .BR ftok (3)