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 .\" Japanese Version Copyright (c) 1998 HANATAKA Shinya
24 .\" all rights reserved.
25 .\" Translated Wed Feb 11 21:29:14 JST 1998
26 .\" by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
28 .\"WORD: semaphore set セマフォー集合
29 .\"WORD: shared memory segment 共有メモリ・セグメント
30 .\"WORD: message queue メッセージ・キュー
32 .\" FIXME There is now duplication of some of the information
33 .\" below in semctl.2, msgctl.2, and shmctl.2 -- MTK, Nov 04
34 .TH SVIPC 7 2009-01-26 "Linux" "Linux Programmer's Manual"
37 .\"O svipc \- System V interprocess communication mechanisms
38 svipc \- System V プロセス間通信機構
42 .B #include <sys/types.h>
43 .B #include <sys/ipc.h>
44 .B #include <sys/msg.h>
45 .B #include <sys/sem.h>
46 .B #include <sys/shm.h>
50 .\"O This manual page refers to the Linux implementation of the System V
51 .\"O interprocess communication (IPC) mechanisms:
52 .\"O message queues, semaphore sets, and shared memory segments.
53 .\"O In the following, the word
55 .\"O means an instantiation of one among such mechanisms.
56 このマニュアル・ページは System V プロセス間通信
57 (interprocess communication; IPC) 機構の Linux に
60 メッセージ・キュー (message queue)、セマフォー集合 (semaphore set)、
61 共有メモリ・セグメント (shared memory segment) などがある。以下で
63 という用語を使用した場合にはこれらの機構のどれかを意味する。
64 .\"O .SS Resource Access Permissions
66 .\"O For each resource, the system uses a common structure of type
67 .\"O .I "struct ipc_perm"
68 .\"O to store information needed in determining permissions to perform an
70 システムのそれぞれの資源は、IPC への操作を許可するかどうかを決定する
76 .\"O structure, defined by the
78 .\"O system header file, includes the following members:
82 に定義されており、以下のメンバーが含まれている:
87 .\"O uid_t cuid; /* creator user ID */
88 .\"O gid_t cgid; /* creator group ID */
89 .\"O uid_t uid; /* owner user ID */
90 .\"O gid_t gid; /* owner group ID */
91 .\"O unsigned short mode; /* r/w permissions */
92 uid_t cuid; /* 作成者のユーザーID */
93 gid_t cgid; /* 作成者のグループID */
94 uid_t uid; /* 所有者のユーザーID */
95 gid_t gid; /* 所有者のグループID */
96 unsigned short mode; /* 読み書きの許可 */
105 .\"O structure defines, with its lower 9 bits, the access permissions to the
106 .\"O resource for a process executing an IPC system call.
107 .\"O The permissions are interpreted as follows:
111 メンバーは以下の 9 ビットで、プロセスの IPC システム・コール
116 .\"O 0400 Read by user.
117 .\"O 0200 Write by user.
121 .\"O 0040 Read by group.
122 .\"O 0020 Write by group.
126 .\"O 0004 Read by others.
127 .\"O 0002 Write by others.
132 .\"O Bits 0100, 0010, and 0001 (the execute bits) are unused by the system.
135 .\"O effectively means
137 .\"O for a semaphore set.
138 システムはビット 0100, 0010, 0001 (実行ビット) は使用しない。
145 .\"O The same system header file also defines the following symbolic
147 同じヘッダーファイルには以下のシンボルの定義が含まれている:
150 .\"O Create entry if key doesn't exist.
151 キー(key)が存在しない場合には新たなエントリを作成する。
154 .\"O Fail if key exists.
155 キー(key)が存在する場合には失敗する。
158 .\"O Error if request must wait.
166 .\"O Remove resource.
170 .\"O Set resource options.
174 .\"O Get resource options.
181 .\"O type, while all the other symbolic constants are flag fields and can
182 .\"O be OR'ed into an
188 型である。その他の全てのシンボルはフラグ・フィールドとして
190 変数に OR 演算で格納することができる。
191 .\"O .SS Message Queues
193 .\"O A message queue is uniquely identified by a positive integer
194 .\"O .RI "(its " msqid )
195 .\"O and has an associated data structure of type
196 .\"O .IR "struct msqid_ds" ,
198 .\"O .IR <sys/msg.h> ,
199 .\"O containing the following members:
205 .IR "struct msqid_ds"
212 struct ipc_perm msg_perm;
213 .\"O msgqnum_t msg_qnum; /* no of messages on queue */
214 .\"O msglen_t msg_qbytes; /* bytes max on a queue */
215 .\"O pid_t msg_lspid; /* PID of last msgsnd(2) call */
216 .\"O pid_t msg_lrpid; /* PID of last msgrcv(2) call */
217 .\"O time_t msg_stime; /* last msgsnd(2) time */
218 .\"O time_t msg_rtime; /* last msgrcv(2) time */
219 .\"O time_t msg_ctime; /* last change time */
220 msgqnum_t msg_qnum; /* キューにあるメッセージの数 */
221 msglen_t msg_qbytes; /* キューの最大バイト数 */
222 pid_t msg_lspid; /* 最後に msgsnd(2) をした PID */
223 pid_t msg_lrpid; /* 最後に msgrcv(2) をした PID */
224 time_t msg_stime; /* 最後に msgsnd(2) をした時間 */
225 time_t msg_rtime; /* 最後に msgrcv(2) をした時間 */
226 time_t msg_ctime; /* 最後に変更された時間 */
233 .\"O structure that specifies the access permissions on the message
235 メッセージ・キューへのアクセス許可を指定する
240 .\"O Number of messages currently on the message queue.
241 現在、このメッセージ・キューにあるメッセージの数。
244 .\"O Maximum number of bytes of message text allowed on the message
246 メッセージ・キューに入れることができるメッセージの最大バイト数。
249 .\"O ID of the process that performed the last
254 システム・コールを行なったプロセスの ID。
257 .\"O ID of the process that performed the last
262 システム・コールを行なったプロセスの ID。
265 .\"O Time of the last
272 .\"O Time of the last
280 .\"O Time of the last
281 .\"O system call that changed a member of the
287 .\"O .SS Semaphore Sets
289 .\"O A semaphore set is uniquely identified by a positive integer
290 .\"O .RI "(its " semid )
291 .\"O and has an associated data structure of type
292 .\"O .IR "struct semid_ds" ,
294 .\"O .IR <sys/sem.h> ,
295 .\"O containing the following members:
301 .IR "struct semid_ds"
308 struct ipc_perm sem_perm;
309 .\"O time_t sem_otime; /* last operation time */
310 .\"O time_t sem_ctime; /* last change time */
311 .\"O unsigned long sem_nsems; /* count of sems in set */
312 time_t sem_otime; /* 最後に操作した時間 */
313 time_t sem_ctime; /* 最後に変更した時間 */
314 unsigned long sem_nsems; /* 集合の中にあるセマフォー数 */
321 .\"O structure that specifies the access permissions on the semaphore
338 .\"O system call that changed a member of the above structure or of one
339 .\"O semaphore belonging to the set.
342 を行なって上記の構造体のメンバーを変更するか、セマフォー集合に属する
346 .\"O Number of semaphores in the set.
347 .\"O Each semaphore of the set is referenced by a nonnegative integer
351 .\"O .IR sem_nsems\-1 .
353 集合の中にあるそれぞれのセマフォーは負でない整数によって参照され、
359 .\"O A semaphore is a data structure of type
361 .\"O containing the following members:
364 型のデータ構造体であり、以下のメンバーを含んでいる:
369 .\"O int semval; /* semaphore value */
370 .\"O int sempid; /* PID for last operation */
371 .\"O .\" unsigned short semncnt; /* nr awaiting semval to increase */
372 .\"O .\" unsigned short semzcnt; /* nr awaiting semval = 0 */
373 int semval; /* セマフォーの値 */
374 int sempid; /* 最後に操作したプロセス ID */
375 .\" unsigned short semncnt; /* semval の増加を待つ数 */
376 .\" unsigned short semzcnt; /* semval = 0 を待つ数 */
382 .\"O Semaphore value: a nonnegative integer.
386 .\"O ID of the last process that performed a semaphore operation
387 .\"O on this semaphore.
388 このセマフォーを最後に操作したプロセスの ID。
391 .\"O .\"Number of processes suspended awaiting for
395 .\"の値が増加するを待って停止しているプロセスの数。
398 .\"O .\"Number of processes suspended awaiting for
400 .\"O .\"to become zero.
402 .\"が 0 になるのを待って停止しているプロセスの数。
403 .\"O .SS Shared Memory Segments
405 .\"O A shared memory segment is uniquely identified by a positive integer
406 .\"O .RI "(its " shmid )
407 .\"O and has an associated data structure of type
408 .\"O .IR "struct shmid_ds" ,
410 .\"O .IR <sys/shm.h> ,
411 .\"O containing the following members:
417 .IR "struct shmid_ds"
424 struct ipc_perm shm_perm;
425 .\"O size_t shm_segsz; /* size of segment */
426 .\"O pid_t shm_cpid; /* PID of creator */
427 .\"O pid_t shm_lpid; /* PID, last operation */
428 .\"O shmatt_t shm_nattch; /* no. of current attaches */
429 .\"O time_t shm_atime; /* time of last attach */
430 .\"O time_t shm_dtime; /* time of last detach */
431 .\"O time_t shm_ctime; /* time of last change */
432 size_t shm_segsz; /* セグメントのサイズ */
433 pid_t shm_cpid; /* 作成者のプロセス ID */
434 pid_t shm_lpid; /* 最後に操作したプロセス ID */
435 shmatt_t shm_nattch; /* 現在、付加している数 */
436 time_t shm_atime; /* 最後に付加した時間 */
437 time_t shm_dtime; /* 最後に分離した時間 */
438 time_t shm_ctime; /* 最後に変更した時間 */
445 .\"O structure that specifies the access permissions on the shared memory
447 共有メモリ・セグメントへのアクセス許可を指定した
453 .\"O Size in bytes of the shared memory segment.
457 .\"O ID of the process that created the shared memory segment.
458 共有メモリ・セグメントを作成したプロセスの ID。
461 .\"O ID of the last process that executed a
470 システム・コールを実行したプロセスの ID。
473 .\"O Number of current alive attaches for this shared memory segment.
474 この共有メモリ・セグメントをメモリに付加 (attach) しているプロセスの数。
477 .\"O Time of the last
485 .\"O Time of the last
493 .\"O Time of the last
495 .\"O system call that changed