1 .\" Copyright 1993 Giorgio Ciucci (giorgio@crcc.it)
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date. The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein. The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" FIXME There is now duplication of some of the information
26 .\" below in semctl.2, msgctl.2, and shmctl.2 -- MTK, Nov 04
27 .\"*******************************************************************
29 .\" This file was generated with po4a. Translate the source file.
31 .\"*******************************************************************
32 .TH SVIPC 7 2013\-02\-12 Linux "Linux Programmer's Manual"
34 svipc \- System V プロセス間通信機構
37 \fB#include <sys/msg.h>\fP
38 \fB#include <sys/sem.h>\fP
39 \fB#include <sys/shm.h>\fP
42 このマニュアルページは System V プロセス間通信 (interprocess communication; IPC) 機構の Linux に
43 おける実装を説明する。 このプロセス間通信機構には、 メッセージキュー (message queue)、セマフォー集合 (semaphore set)、
44 共有メモリセグメント (shared memory segment) などがある。以下で \fI資源 (resource)\fP
45 という用語を使用した場合にはこれらの機構のどれかを意味する。
47 システムのそれぞれの資源は、IPC への操作を許可するかどうかを決定する ための情報を共通の構造体 \fIstruct ipc_perm\fP
48 に格納して使用する。 \fIipc_perm\fP 構造体には以下のメンバーが定義されている:
53 uid_t cuid; /* 作成者のユーザーID */
54 gid_t cgid; /* 作成者のグループID */
55 uid_t uid; /* 所有者のユーザーID */
56 gid_t gid; /* 所有者のグループID */
57 unsigned short mode; /* 読み書きの許可 */
62 \fIipc_perm\fP 構造体の \fImode\fP メンバーは以下の 9 ビットで、プロセスの IPC システムコール
63 による資源へのアクセス許可を定義する。 許可は以下のように解釈される:
76 システムはビット 0100, 0010, 0001 (実行ビット) は使用しない。 さらに、セマフォーの場合には "書き込み(write)" は実際には
79 同じヘッダーファイルには以下のシンボルの定義が含まれている:
82 キー(key)が存在しない場合には新たなエントリを作成する。
102 \fBIPC_PRIVATE\fP は \fIkey_t\fP 型である。その他の全てのシンボルはフラグフィールドとして \fIint\fP 変数に OR
105 メッセージキューは正の整数 (\fImsqid\fP) によって識別され、 \fI<sys/msg.h>\fP に定義されている構造体
106 \fIstruct msqid_ds\fP に結びつけられている。 この構造体は以下のメンバーを含んでいる:
111 struct ipc_perm msg_perm;
112 msgqnum_t msg_qnum; /* キューにあるメッセージの数 */
113 msglen_t msg_qbytes; /* キューの最大バイト数 */
114 pid_t msg_lspid; /* 最後に msgsnd(2) をした PID */
115 pid_t msg_lrpid; /* 最後に msgrcv(2) をした PID */
116 time_t msg_stime; /* 最後に msgsnd(2) をした時間 */
117 time_t msg_rtime; /* 最後に msgrcv(2) をした時間 */
118 time_t msg_ctime; /* 最後に変更された時間 */
124 メッセージキューへのアクセス許可を指定する \fIipc_perm\fP 構造体。
127 現在、このメッセージキューにあるメッセージの数。
130 メッセージキューに入れることができるメッセージの最大バイト数。
133 最後に \fBmsgsnd\fP(2) システムコールを行なったプロセスの ID。
136 最後に \fBmsgrcv\fP(2) システムコールを行なったプロセスの ID。
139 最後に \fBmsgsnd\fP(2) システムコールを行なった時間。
142 最後に \fBmsgrcv\fP(2) を行なった時間。
145 最後に \fImsqid_ds\fP 構造体のメンバーが変更された時間。
147 セマフォー集合は正の整数 (\fIsemid\fP) によって識別され、 \fI<sys/sem.h>\fP に定義されている構造体
148 \fIstruct semid_ds\fP に結びつけられている。 この構造体は以下のメンバーを含んでいる:
153 struct ipc_perm sem_perm;
154 time_t sem_otime; /* 最後に操作した時間 */
155 time_t sem_ctime; /* 最後に変更した時間 */
156 unsigned long sem_nsems; /* 集合の中にあるセマフォー数 */
162 セマフォー集合へのアクセス許可を指定する \fIipc_perm\fP 構造体。
165 最後に \fBsemop\fP(2) システムコールを行なった時間。
168 最後に \fBsemctl\fP(2) を行なって上記の構造体のメンバーを変更するか、セマフォー集合に属する セマフォーを変更した時間。
171 セマフォー集合の中にあるセマフォーの数。 集合の中にあるそれぞれのセマフォーは負でない整数によって参照され、 \fB0\fP から
172 \fIsem_nsems\-1\fP までの番号を持つ。
174 セマフォーは \fIstruct sem\fP 型のデータ構造体であり、以下のメンバーを含んでいる:
178 .\" unsigned short semncnt; /* nr awaiting semval to increase */
179 .\" unsigned short semzcnt; /* nr awaiting semval = 0 */
181 int semval; /* セマフォーの値 */
182 int sempid; /* 最後に操作したプロセス ID */
193 .\"Number of processes suspended awaiting for
198 .\"Number of processes suspended awaiting for
201 このセマフォーを最後に操作したプロセスの ID。
203 共有メモリセグメントは正の整数 (\fIshmid\fP) によって識別され、 \fI<sys/shm.h>\fP に定義されている
204 \fIstruct shmid_ds\fP 構造体に結びつけられている。 この構造体は以下のメンバーを含んでいる:
209 struct ipc_perm shm_perm;
210 size_t shm_segsz; /* セグメントのサイズ */
211 pid_t shm_cpid; /* 作成者のプロセス ID */
212 pid_t shm_lpid; /* 最後に操作したプロセス ID */
213 shmatt_t shm_nattch; /* 現在、付加している数 */
214 time_t shm_atime; /* 最後に付加した時間 */
215 time_t shm_dtime; /* 最後に分離した時間 */
216 time_t shm_ctime; /* 最後に変更した時間 */
222 共有メモリセグメントへのアクセス許可を指定した \fIipc_perm\fP 構造体。
228 共有メモリセグメントを作成したプロセスの ID。
231 最後に \fBshmat\fP(2) または \fBshmdt\fP(2) システムコールを実行したプロセスの ID。
234 この共有メモリセグメントをメモリに付加 (attach) しているプロセスの数。
237 最後に \fBshmat\fP(2) システムコールを行なった時間。
240 最後に \fBshmdt\fP(2) システムコールを行なった時間。
243 最後に \fBshmctl\fP(2) システムコールを行なって、 \fIshmid_ds\fP 構造体を変更した時間。
245 \fBipcmk\fP(1), \fBipcrm\fP(1), \fBipcs\fP(1), \fBipc\fP(2), \fBmsgctl\fP(2), \fBmsgget\fP(2),
246 \fBmsgrcv\fP(2), \fBmsgsnd\fP(2), \fBsemctl\fP(2), \fBsemget\fP(2), \fBsemop\fP(2),
247 \fBshmat\fP(2), \fBshmctl\fP(2), \fBshmdt\fP(2), \fBshmget\fP(2), \fBftok\fP(3)
249 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.50 の一部
250 である。プロジェクトの説明とバグ報告に関する情報は
251 http://www.kernel.org/doc/man\-pages/ に書かれている。