OSDN Git Service

(split) LDP: Restore and add Copyrights for draft pages
[linuxjm/LDP_man-pages.git] / draft / 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 .\" FIXME Ultimately, there should probably be
29 .\" svmq_overview(7), svshm_overview(7), and sem_overview(7)
30 .\" that provide an overview of each System V IPC mechanism.
31 .\" In that case:
32 .\"   * Those files should add a discussion of the /proc/sysvipc
33 .\"     interfaces.
34 .\"   * Documentation of the various /proc interfaces should move into
35 .\"     those files (from proc(5)), and references in the various *.2
36 .\"     pages that refer to the /proc files should be adjusted.
37 .\"   * The only part that uniquely belongs in svipc(7) is perphaps
38 .\"     the discussion of ipc_perm.
39 .\"
40 .\"*******************************************************************
41 .\"
42 .\" This file was generated with po4a. Translate the source file.
43 .\"
44 .\"*******************************************************************
45 .\"
46 .\" Japanese Version Copyright (c) 1998 HANATAKA Shinya
47 .\"         all rights reserved.
48 .\" Translated Wed Feb 11 21:29:14 JST 1998
49 .\"         by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
50 .\"
51 .TH SVIPC 7 2013\-02\-12 Linux "Linux Programmer's Manual"
52 .SH 名前
53 svipc \- System V プロセス間通信機構
54 .SH 書式
55 .nf
56 \fB#include <sys/msg.h>\fP
57 \fB#include <sys/sem.h>\fP
58 \fB#include <sys/shm.h>\fP
59 .fi
60 .SH 説明
61 このマニュアルページは System V プロセス間通信 (interprocess communication; IPC) 機構の Linux に
62 おける実装を説明する。 このプロセス間通信機構には、 メッセージキュー (message queue)、セマフォー集合 (semaphore set)、
63 共有メモリセグメント (shared memory segment) などがある。以下で \fI資源 (resource)\fP
64 という用語を使用した場合にはこれらの機構のどれかを意味する。
65 .SS 資源へのアクセス許可
66 システムのそれぞれの資源は、IPC への操作を許可するかどうかを決定する ための情報を共通の構造体 \fIstruct ipc_perm\fP
67 に格納して使用する。 \fIipc_perm\fP 構造体には以下のメンバーが定義されている:
68 .in +4n
69 .nf
70
71 struct ipc_perm {
72     uid_t          cuid;   /* 作成者のユーザーID */
73     gid_t          cgid;   /* 作成者のグループID */
74     uid_t          uid;    /* 所有者のユーザーID */
75     gid_t          gid;    /* 所有者のグループID */
76     unsigned short mode;   /* 読み書きの許可 */
77 };
78 .fi
79 .in
80 .PP
81 \fIipc_perm\fP 構造体の \fImode\fP メンバーは以下の 9 ビットで、プロセスの IPC システムコール
82 による資源へのアクセス許可を定義する。 許可は以下のように解釈される:
83 .sp
84 .nf
85     0400    ユーザーによる読み込み。
86     0200    ユーザーによる書き込み。
87 .sp .5
88     0040    グループによる読み込み。
89     0020    グループによる書き込み。
90 .sp .5
91     0004    他人による読み込み。
92     0002    他人による書き込み。
93 .fi
94 .PP
95 システムはビット 0100, 0010, 0001 (実行ビット) は使用しない。 さらに、セマフォーの場合には "書き込み(write)" は実際には
96 "変更(alter)" を意味する。
97 .PP
98 同じヘッダーファイルには以下のシンボルの定義が含まれている:
99 .TP  14
100 \fBIPC_CREAT\fP
101 キー(key)が存在しない場合には新たなエントリを作成する。
102 .TP 
103 \fBIPC_EXCL\fP
104 キー(key)が存在する場合には失敗する。
105 .TP 
106 \fBIPC_NOWAIT\fP
107 要求が待たされる場合にはエラーになる。
108 .TP 
109 \fBIPC_PRIVATE\fP
110 プライベートキー。
111 .TP 
112 \fBIPC_RMID\fP
113 資源を削除する。
114 .TP 
115 \fBIPC_SET\fP
116 資源にオプションを設定する。
117 .TP 
118 \fBIPC_STAT\fP
119 資源のオプションを取得する。
120 .PP
121 \fBIPC_PRIVATE\fP は \fIkey_t\fP 型である。その他の全てのシンボルはフラグフィールドとして \fIint\fP 変数に OR
122 演算で格納することができる。
123 .SS メッセージキュー
124 メッセージキューは正の整数 (\fImsqid\fP)  によって識別され、 \fI<sys/msg.h>\fP に定義されている構造体
125 \fIstruct msqid_ds\fP に結びつけられている。 この構造体は以下のメンバーを含んでいる:
126 .in +4n
127 .nf
128
129 struct msqid_ds {
130     struct ipc_perm msg_perm;
131     msgqnum_t       msg_qnum;    /* キューにあるメッセージの数 */
132     msglen_t        msg_qbytes;  /* キューの最大バイト数 */
133     pid_t           msg_lspid;   /* 最後に msgsnd(2) をした PID */
134     pid_t           msg_lrpid;   /* 最後に msgrcv(2) をした PID */
135     time_t          msg_stime;   /* 最後に msgsnd(2) をした時間 */
136     time_t          msg_rtime;   /* 最後に msgrcv(2) をした時間 */
137     time_t          msg_ctime;   /* 最後に変更された時間 */
138 };
139 .fi
140 .in
141 .TP  11
142 \fImsg_perm\fP
143 メッセージキューへのアクセス許可を指定する \fIipc_perm\fP 構造体。
144 .TP 
145 \fImsg_qnum\fP
146 現在、このメッセージキューにあるメッセージの数。
147 .TP 
148 \fImsg_qbytes\fP
149 メッセージキューに入れることができるメッセージの最大バイト数。
150 .TP 
151 \fImsg_lspid\fP
152 最後に \fBmsgsnd\fP(2)  システムコールを行なったプロセスの ID。
153 .TP 
154 \fImsg_lrpid\fP
155 最後に \fBmsgrcv\fP(2)  システムコールを行なったプロセスの ID。
156 .TP 
157 \fImsg_stime\fP
158 最後に \fBmsgsnd\fP(2)  システムコールを行なった時間。
159 .TP 
160 \fImsg_rtime\fP
161 最後に \fBmsgrcv\fP(2)  を行なった時間。
162 .TP 
163 \fImsg_ctime\fP
164 最後に \fImsqid_ds\fP 構造体のメンバーが変更された時間。
165 .SS セマフォー集合
166 セマフォー集合は正の整数 (\fIsemid\fP)  によって識別され、 \fI<sys/sem.h>\fP に定義されている構造体
167 \fIstruct semid_ds\fP に結びつけられている。 この構造体は以下のメンバーを含んでいる:
168 .in +4n
169 .nf
170
171 struct semid_ds {
172     struct ipc_perm sem_perm;
173     time_t          sem_otime;   /* 最後に操作した時間 */
174     time_t          sem_ctime;   /* 最後に変更した時間 */
175     unsigned long   sem_nsems;   /* 集合の中にあるセマフォー数 */
176 };
177 .fi
178 .in
179 .TP  11
180 \fIsem_perm\fP
181 セマフォー集合へのアクセス許可を指定する \fIipc_perm\fP 構造体。
182 .TP 
183 \fIsem_otime\fP
184 最後に \fBsemop\fP(2)  システムコールを行なった時間。
185 .TP 
186 \fIsem_ctime\fP
187 最後に \fBsemctl\fP(2)  を行なって上記の構造体のメンバーを変更するか、セマフォー集合に属する セマフォーを変更した時間。
188 .TP 
189 \fIsem_nsems\fP
190 セマフォー集合の中にあるセマフォーの数。 集合の中にあるそれぞれのセマフォーは負でない整数によって参照され、 \fB0\fP から
191 \fIsem_nsems\-1\fP までの番号を持つ。
192 .PP
193 セマフォーは \fIstruct sem\fP 型のデータ構造体であり、以下のメンバーを含んでいる:
194 .in +4n
195 .nf
196
197 .\"    unsigned short semncnt; /* nr awaiting semval to increase */
198 .\"    unsigned short semzcnt; /* nr awaiting semval = 0 */
199 struct sem {
200     int semval;  /* セマフォーの値 */
201     int sempid;  /* 最後に操作したプロセス ID */
202 };
203 .fi
204 .in
205 .TP  11
206 \fIsemval\fP
207 セマフォー値: 負でない整数。
208 .TP 
209 \fIsempid\fP
210 .\".TP
211 .\".I semncnt
212 .\"Number of processes suspended awaiting for
213 .\".I semval
214 .\"to increase.
215 .\".TP
216 .\".I semznt
217 .\"Number of processes suspended awaiting for
218 .\".I semval
219 .\"to become zero.
220 このセマフォーを最後に操作したプロセスの ID。
221 .SS 共有メモリセグメント
222 共有メモリセグメントは正の整数 (\fIshmid\fP)  によって識別され、 \fI<sys/shm.h>\fP に定義されている
223 \fIstruct shmid_ds\fP 構造体に結びつけられている。 この構造体は以下のメンバーを含んでいる:
224 .in +4n
225 .nf
226
227 struct shmid_ds {
228     struct ipc_perm shm_perm;
229     size_t          shm_segsz;   /* セグメントのサイズ */
230     pid_t           shm_cpid;    /* 作成者のプロセス ID */
231     pid_t           shm_lpid;    /* 最後に操作したプロセス ID */
232     shmatt_t        shm_nattch;  /* 現在、付加している数 */
233     time_t          shm_atime;   /* 最後に付加した時間 */
234     time_t          shm_dtime;   /* 最後に分離した時間 */
235     time_t          shm_ctime;   /* 最後に変更した時間 */
236 };
237 .fi
238 .in
239 .TP  11
240 \fIshm_perm\fP
241 共有メモリセグメントへのアクセス許可を指定した \fIipc_perm\fP 構造体。
242 .TP 
243 \fIshm_segsz\fP
244 共有メモリセグメントのバイト数。
245 .TP 
246 \fIshm_cpid\fP
247 共有メモリセグメントを作成したプロセスの ID。
248 .TP 
249 \fIshm_lpid\fP
250 最後に \fBshmat\fP(2)  または \fBshmdt\fP(2)  システムコールを実行したプロセスの ID。
251 .TP 
252 \fIshm_nattch\fP
253 この共有メモリセグメントをメモリに付加 (attach) しているプロセスの数。
254 .TP 
255 \fIshm_atime\fP
256 最後に \fBshmat\fP(2)  システムコールを行なった時間。
257 .TP 
258 \fIshm_dtime\fP
259 最後に \fBshmdt\fP(2)  システムコールを行なった時間。
260 .TP 
261 \fIshm_ctime\fP
262 最後に \fBshmctl\fP(2)  システムコールを行なって、 \fIshmid_ds\fP 構造体を変更した時間。
263 .SH 関連項目
264 \fBipcmk\fP(1), \fBipcrm\fP(1), \fBipcs\fP(1), \fBipc\fP(2), \fBmsgctl\fP(2), \fBmsgget\fP(2),
265 \fBmsgrcv\fP(2), \fBmsgsnd\fP(2), \fBsemctl\fP(2), \fBsemget\fP(2), \fBsemop\fP(2),
266 \fBshmat\fP(2), \fBshmctl\fP(2), \fBshmdt\fP(2), \fBshmget\fP(2), \fBftok\fP(3)
267 .SH この文書について
268 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.53 の一部
269 である。プロジェクトの説明とバグ報告に関する情報は
270 http://www.kernel.org/doc/man\-pages/ に書かれている。