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