OSDN Git Service

(split) LDP: Update draft and release pages (based on the previous commit)
[linuxjm/LDP_man-pages.git] / release / man7 / svipc.7
1 .\" Copyright 1993 Giorgio Ciucci (giorgio@crcc.it)
2 .\"
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.
7 .\"
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.
12 .\"
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
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
24 .\"
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 .\"*******************************************************************
28 .\"
29 .\" This file was generated with po4a. Translate the source file.
30 .\"
31 .\"*******************************************************************
32 .TH SVIPC 7 2013\-02\-12 Linux "Linux Programmer's Manual"
33 .SH 名前
34 svipc \- System V プロセス間通信機構
35 .SH 書式
36 .nf
37 \fB#include <sys/msg.h>\fP
38 \fB#include <sys/sem.h>\fP
39 \fB#include <sys/shm.h>\fP
40 .fi
41 .SH 説明
42 このマニュアルページは System V プロセス間通信 (interprocess communication; IPC) 機構の Linux に
43 おける実装を説明する。 このプロセス間通信機構には、 メッセージキュー (message queue)、セマフォー集合 (semaphore set)、
44 共有メモリセグメント (shared memory segment) などがある。以下で \fI資源 (resource)\fP
45 という用語を使用した場合にはこれらの機構のどれかを意味する。
46 .SS 資源へのアクセス許可
47 システムのそれぞれの資源は、IPC への操作を許可するかどうかを決定する ための情報を共通の構造体 \fIstruct ipc_perm\fP
48 に格納して使用する。 \fIipc_perm\fP 構造体には以下のメンバーが定義されている:
49 .in +4n
50 .nf
51
52 struct ipc_perm {
53     uid_t          cuid;   /* 作成者のユーザーID */
54     gid_t          cgid;   /* 作成者のグループID */
55     uid_t          uid;    /* 所有者のユーザーID */
56     gid_t          gid;    /* 所有者のグループID */
57     unsigned short mode;   /* 読み書きの許可 */
58 };
59 .fi
60 .in
61 .PP
62 \fIipc_perm\fP 構造体の \fImode\fP メンバーは以下の 9 ビットで、プロセスの IPC システムコール
63 による資源へのアクセス許可を定義する。 許可は以下のように解釈される:
64 .sp
65 .nf
66     0400    ユーザーによる読み込み。
67     0200    ユーザーによる書き込み。
68 .sp .5
69     0040    グループによる読み込み。
70     0020    グループによる書き込み。
71 .sp .5
72     0004    他人による読み込み。
73     0002    他人による書き込み。
74 .fi
75 .PP
76 システムはビット 0100, 0010, 0001 (実行ビット) は使用しない。 さらに、セマフォーの場合には "書き込み(write)" は実際には
77 "変更(alter)" を意味する。
78 .PP
79 同じヘッダーファイルには以下のシンボルの定義が含まれている:
80 .TP  14
81 \fBIPC_CREAT\fP
82 キー(key)が存在しない場合には新たなエントリを作成する。
83 .TP 
84 \fBIPC_EXCL\fP
85 キー(key)が存在する場合には失敗する。
86 .TP 
87 \fBIPC_NOWAIT\fP
88 要求が待たされる場合にはエラーになる。
89 .TP 
90 \fBIPC_PRIVATE\fP
91 プライベートキー。
92 .TP 
93 \fBIPC_RMID\fP
94 資源を削除する。
95 .TP 
96 \fBIPC_SET\fP
97 資源にオプションを設定する。
98 .TP 
99 \fBIPC_STAT\fP
100 資源のオプションを取得する。
101 .PP
102 \fBIPC_PRIVATE\fP は \fIkey_t\fP 型である。その他の全てのシンボルはフラグフィールドとして \fIint\fP 変数に OR
103 演算で格納することができる。
104 .SS メッセージキュー
105 メッセージキューは正の整数 (\fImsqid\fP)  によって識別され、 \fI<sys/msg.h>\fP に定義されている構造体
106 \fIstruct msqid_ds\fP に結びつけられている。 この構造体は以下のメンバーを含んでいる:
107 .in +4n
108 .nf
109
110 struct msqid_ds {
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;   /* 最後に変更された時間 */
119 };
120 .fi
121 .in
122 .TP  11
123 \fImsg_perm\fP
124 メッセージキューへのアクセス許可を指定する \fIipc_perm\fP 構造体。
125 .TP 
126 \fImsg_qnum\fP
127 現在、このメッセージキューにあるメッセージの数。
128 .TP 
129 \fImsg_qbytes\fP
130 メッセージキューに入れることができるメッセージの最大バイト数。
131 .TP 
132 \fImsg_lspid\fP
133 最後に \fBmsgsnd\fP(2)  システムコールを行なったプロセスの ID。
134 .TP 
135 \fImsg_lrpid\fP
136 最後に \fBmsgrcv\fP(2)  システムコールを行なったプロセスの ID。
137 .TP 
138 \fImsg_stime\fP
139 最後に \fBmsgsnd\fP(2)  システムコールを行なった時間。
140 .TP 
141 \fImsg_rtime\fP
142 最後に \fBmsgrcv\fP(2)  を行なった時間。
143 .TP 
144 \fImsg_ctime\fP
145 最後に \fImsqid_ds\fP 構造体のメンバーが変更された時間。
146 .SS セマフォー集合
147 セマフォー集合は正の整数 (\fIsemid\fP)  によって識別され、 \fI<sys/sem.h>\fP に定義されている構造体
148 \fIstruct semid_ds\fP に結びつけられている。 この構造体は以下のメンバーを含んでいる:
149 .in +4n
150 .nf
151
152 struct semid_ds {
153     struct ipc_perm sem_perm;
154     time_t          sem_otime;   /* 最後に操作した時間 */
155     time_t          sem_ctime;   /* 最後に変更した時間 */
156     unsigned long   sem_nsems;   /* 集合の中にあるセマフォー数 */
157 };
158 .fi
159 .in
160 .TP  11
161 \fIsem_perm\fP
162 セマフォー集合へのアクセス許可を指定する \fIipc_perm\fP 構造体。
163 .TP 
164 \fIsem_otime\fP
165 最後に \fBsemop\fP(2)  システムコールを行なった時間。
166 .TP 
167 \fIsem_ctime\fP
168 最後に \fBsemctl\fP(2)  を行なって上記の構造体のメンバーを変更するか、セマフォー集合に属する セマフォーを変更した時間。
169 .TP 
170 \fIsem_nsems\fP
171 セマフォー集合の中にあるセマフォーの数。 集合の中にあるそれぞれのセマフォーは負でない整数によって参照され、 \fB0\fP から
172 \fIsem_nsems\-1\fP までの番号を持つ。
173 .PP
174 セマフォーは \fIstruct sem\fP 型のデータ構造体であり、以下のメンバーを含んでいる:
175 .in +4n
176 .nf
177
178 .\"    unsigned short semncnt; /* nr awaiting semval to increase */
179 .\"    unsigned short semzcnt; /* nr awaiting semval = 0 */
180 struct sem {
181     int semval;  /* セマフォーの値 */
182     int sempid;  /* 最後に操作したプロセス ID */
183 };
184 .fi
185 .in
186 .TP  11
187 \fIsemval\fP
188 セマフォー値: 負でない整数。
189 .TP 
190 \fIsempid\fP
191 .\".TP
192 .\".I semncnt
193 .\"Number of processes suspended awaiting for
194 .\".I semval
195 .\"to increase.
196 .\".TP
197 .\".I semznt
198 .\"Number of processes suspended awaiting for
199 .\".I semval
200 .\"to become zero.
201 このセマフォーを最後に操作したプロセスの ID。
202 .SS 共有メモリセグメント
203 共有メモリセグメントは正の整数 (\fIshmid\fP)  によって識別され、 \fI<sys/shm.h>\fP に定義されている
204 \fIstruct shmid_ds\fP 構造体に結びつけられている。 この構造体は以下のメンバーを含んでいる:
205 .in +4n
206 .nf
207
208 struct shmid_ds {
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;   /* 最後に変更した時間 */
217 };
218 .fi
219 .in
220 .TP  11
221 \fIshm_perm\fP
222 共有メモリセグメントへのアクセス許可を指定した \fIipc_perm\fP 構造体。
223 .TP 
224 \fIshm_segsz\fP
225 共有メモリセグメントのバイト数。
226 .TP 
227 \fIshm_cpid\fP
228 共有メモリセグメントを作成したプロセスの ID。
229 .TP 
230 \fIshm_lpid\fP
231 最後に \fBshmat\fP(2)  または \fBshmdt\fP(2)  システムコールを実行したプロセスの ID。
232 .TP 
233 \fIshm_nattch\fP
234 この共有メモリセグメントをメモリに付加 (attach) しているプロセスの数。
235 .TP 
236 \fIshm_atime\fP
237 最後に \fBshmat\fP(2)  システムコールを行なった時間。
238 .TP 
239 \fIshm_dtime\fP
240 最後に \fBshmdt\fP(2)  システムコールを行なった時間。
241 .TP 
242 \fIshm_ctime\fP
243 最後に \fBshmctl\fP(2)  システムコールを行なって、 \fIshmid_ds\fP 構造体を変更した時間。
244 .SH 関連項目
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)
248 .SH この文書について
249 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.50 の一部
250 である。プロジェクトの説明とバグ報告に関する情報は
251 http://www.kernel.org/doc/man\-pages/ に書かれている。