OSDN Git Service

2044931b063a7ba4dd064418e4c273b3fa068011
[linuxjm/LDP_man-pages.git] / draft / man7 / svipc.7
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.
11 .\"
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.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\"
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>
27 .\"
28 .\"WORD:        semaphore set           セマフォー集合
29 .\"WORD:        shared memory segment   共有メモリ・セグメント
30 .\"WORD:        message queue           メッセージ・キュー
31 .\"
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"
35 .\"O .SH NAME
36 .SH 名前
37 .\"O svipc \- System V interprocess communication mechanisms
38 svipc \- System V プロセス間通信機構
39 .\"O .SH SYNOPSIS
40 .SH 書式
41 .nf
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>
47 .fi
48 .\"O .SH DESCRIPTION
49 .SH 説明
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
54 .\"O .I resource
55 .\"O means an instantiation of one among such mechanisms.
56 このマニュアル・ページは System V プロセス間通信
57 (interprocess communication; IPC) 機構の Linux に
58 おける実装を説明する。
59 このプロセス間通信機構には、
60 メッセージ・キュー (message queue)、セマフォー集合 (semaphore set)、
61 共有メモリ・セグメント (shared memory segment) などがある。以下で
62 .I "資源 (resource)"
63 という用語を使用した場合にはこれらの機構のどれかを意味する。
64 .\"O .SS Resource Access Permissions
65 .SS 資源へのアクセス許可
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
69 .\"O IPC operation.
70 システムのそれぞれの資源は、IPC への操作を許可するかどうかを決定する
71 ための情報を共通の構造体
72 .I "struct ipc_perm"
73 に格納して使用する。
74 .\"O The
75 .\"O .I ipc_perm
76 .\"O structure, defined by the
77 .\"O .I <sys/ipc.h>
78 .\"O system header file, includes the following members:
79 .I ipc_perm
80 構造体は、ヘッダーファイルの
81 .I <sys/ipc.h>
82 に定義されており、以下のメンバーが含まれている:
83 .in +4n
84 .nf
85
86 struct ipc_perm {
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;   /* 読み書きの許可 */
97 };
98 .fi
99 .in
100 .PP
101 .\"O The
102 .\"O .I mode
103 .\"O member of the
104 .\"O .I ipc_perm
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:
108 .I ipc_perm
109 構造体の
110 .I mode
111 メンバーは以下の 9 ビットで、プロセスの IPC システム・コール
112 による資源へのアクセス許可を定義する。
113 許可は以下のように解釈される:
114 .sp
115 .nf
116 .\"O     0400    Read by user.
117 .\"O     0200    Write by user.
118     0400    ユーザーによる読み込み。
119     0200    ユーザーによる書き込み。
120 .sp .5
121 .\"O     0040    Read by group.
122 .\"O     0020    Write by group.
123     0040    グループによる読み込み。
124     0020    グループによる書き込み。
125 .sp .5
126 .\"O     0004    Read by others.
127 .\"O     0002    Write by others.
128     0004    他人による読み込み。
129     0002    他人による書き込み。
130 .fi
131 .PP
132 .\"O Bits 0100, 0010, and 0001 (the execute bits) are unused by the system.
133 .\"O Furthermore,
134 .\"O "write"
135 .\"O effectively means
136 .\"O "alter"
137 .\"O for a semaphore set.
138 システムはビット 0100, 0010, 0001 (実行ビット) は使用しない。
139 さらに、セマフォーの場合には
140 "書き込み(write)"
141 は実際には
142 "変更(alter)"
143 を意味する。
144 .PP
145 .\"O The same system header file also defines the following symbolic
146 .\"O constants:
147 同じヘッダーファイルには以下のシンボルの定義が含まれている:
148 .TP 14
149 .B IPC_CREAT
150 .\"O Create entry if key doesn't exist.
151 キー(key)が存在しない場合には新たなエントリを作成する。
152 .TP
153 .B IPC_EXCL
154 .\"O Fail if key exists.
155 キー(key)が存在する場合には失敗する。
156 .TP
157 .B IPC_NOWAIT
158 .\"O Error if request must wait.
159 要求が待たされる場合にはエラーになる。
160 .TP
161 .B IPC_PRIVATE
162 .\"O Private key.
163 プライベート・キー。
164 .TP
165 .B IPC_RMID
166 .\"O Remove resource.
167 資源を削除する。
168 .TP
169 .B IPC_SET
170 .\"O Set resource options.
171 資源にオプションを設定する。
172 .TP
173 .B IPC_STAT
174 .\"O Get resource options.
175 資源のオプションを取得する。
176 .PP
177 .\"O Note that
178 .\"O .B IPC_PRIVATE
179 .\"O is a
180 .\"O .I key_t
181 .\"O type, while all the other symbolic constants are flag fields and can
182 .\"O be OR'ed into an
183 .\"O .I int
184 .\"O type variable.
185 .B IPC_PRIVATE
186
187 .I key_t
188 型である。その他の全てのシンボルはフラグ・フィールドとして
189 .I int
190 変数に OR 演算で格納することができる。
191 .\"O .SS Message Queues
192 .SS メッセージ・キュー
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" ,
197 .\"O defined in
198 .\"O .IR <sys/msg.h> ,
199 .\"O containing the following members:
200 メッセージ・キューは正の整数
201 .RI "(" msqid )
202 によって識別され、
203 .I <sys/msg.h>
204 に定義されている構造体
205 .IR "struct msqid_ds"
206 に結びつけられている。
207 この構造体は以下のメンバーを含んでいる:
208 .in +4n
209 .nf
210
211 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;   /* 最後に変更された時間 */
227 };
228 .fi
229 .in
230 .TP 11
231 .I msg_perm
232 .\"O .I ipc_perm
233 .\"O structure that specifies the access permissions on the message
234 .\"O queue.
235 メッセージ・キューへのアクセス許可を指定する
236 .I ipc_perm
237 構造体。
238 .TP
239 .I msg_qnum
240 .\"O Number of messages currently on the message queue.
241 現在、このメッセージ・キューにあるメッセージの数。
242 .TP
243 .I msg_qbytes
244 .\"O Maximum number of bytes of message text allowed on the message
245 .\"O queue.
246 メッセージ・キューに入れることができるメッセージの最大バイト数。
247 .TP
248 .I msg_lspid
249 .\"O ID of the process that performed the last
250 .\"O .BR msgsnd (2)
251 .\"O system call.
252 最後に
253 .BR msgsnd (2)
254 システム・コールを行なったプロセスの ID。
255 .TP
256 .I msg_lrpid
257 .\"O ID of the process that performed the last
258 .\"O .BR msgrcv (2)
259 .\"O system call.
260 最後に
261 .BR msgrcv (2)
262 システム・コールを行なったプロセスの ID。
263 .TP
264 .I msg_stime
265 .\"O Time of the last
266 .\"O .BR msgsnd (2)
267 .\"O system call.
268 最後に
269 .BR msgsnd (2)
270 システム・コールを行なった時間。
271 .I msg_rtime
272 .\"O Time of the last
273 .\"O .BR msgrcv (2)
274 .\"O system call.
275 最後に
276 .BR msgrcv (2)
277 を行なった時間。
278 .TP
279 .I msg_ctime
280 .\"O Time of the last
281 .\"O system call that changed a member of the
282 .\"O .I msqid_ds
283 .\"O structure.
284 最後に
285 .I msqid_ds
286 構造体のメンバーが変更された時間。
287 .\"O .SS Semaphore Sets
288 .SS セマフォー集合
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" ,
293 .\"O defined in
294 .\"O .IR <sys/sem.h> ,
295 .\"O containing the following members:
296 セマフォー集合は正の整数
297 .RI "(" semid )
298 によって識別され、
299 .I <sys/sem.h>
300 に定義されている構造体
301 .IR "struct semid_ds"
302 に結びつけられている。
303 この構造体は以下のメンバーを含んでいる:
304 .in +4n
305 .nf
306
307 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;   /* 集合の中にあるセマフォー数 */
315 };
316 .fi
317 .in
318 .TP 11
319 .I sem_perm
320 .\"O .I ipc_perm
321 .\"O structure that specifies the access permissions on the semaphore
322 .\"O set.
323 セマフォー集合へのアクセス許可を指定する
324 .I ipc_perm
325 構造体。
326 .TP
327 .I sem_otime
328 .\"O Time of last
329 .\"O .BR semop (2)
330 .\"O system call.
331 最後に
332 .BR semop (2)
333 システム・コールを行なった時間。
334 .TP
335 .I sem_ctime
336 .\"O Time of last
337 .\"O .BR semctl (2)
338 .\"O system call that changed a member of the above structure or of one
339 .\"O semaphore belonging to the set.
340 最後に
341 .BR semctl (2)
342 を行なって上記の構造体のメンバーを変更するか、セマフォー集合に属する
343 セマフォーを変更した時間。
344 .TP
345 .I sem_nsems
346 .\"O Number of semaphores in the set.
347 .\"O Each semaphore of the set is referenced by a nonnegative integer
348 .\"O ranging from
349 .\"O .B 0
350 .\"O to
351 .\"O .IR sem_nsems\-1 .
352 セマフォー集合の中にあるセマフォーの数。
353 集合の中にあるそれぞれのセマフォーは負でない整数によって参照され、
354 .B 0
355 から
356 .I sem_nsems\-1
357 までの番号を持つ。
358 .PP
359 .\"O A semaphore is a data structure of type
360 .\"O .I "struct sem"
361 .\"O containing the following members:
362 セマフォーは
363 .I "struct sem"
364 型のデータ構造体であり、以下のメンバーを含んでいる:
365 .in +4n
366 .nf
367
368 struct sem {
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 を待つ数 */
377 };
378 .fi
379 .in
380 .TP 11
381 .I semval
382 .\"O Semaphore value: a nonnegative integer.
383 セマフォー値: 負でない整数。
384 .TP
385 .I sempid
386 .\"O ID of the last process that performed a semaphore operation
387 .\"O on this semaphore.
388 このセマフォーを最後に操作したプロセスの ID。
389 .\".TP
390 .\".I semncnt
391 .\"O .\"Number of processes suspended awaiting for
392 .\"O .\".I semval
393 .\"O .\"to increase.
394 .\".I semval
395 .\"の値が増加するを待って停止しているプロセスの数。
396 .\".TP
397 .\".I semznt
398 .\"O .\"Number of processes suspended awaiting for
399 .\"O .\".I semval
400 .\"O .\"to become zero.
401 .\".I semval
402 .\"が 0 になるのを待って停止しているプロセスの数。
403 .\"O .SS Shared Memory Segments
404 .SS 共有メモリ・セグメント
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" ,
409 .\"O defined in
410 .\"O .IR <sys/shm.h> ,
411 .\"O containing the following members:
412 共有メモリ・セグメトは正の整数
413 .RI "(" shmid )
414 によって識別され、
415 .I <sys/shm.h>
416 に定義されている
417 .IR "struct shmid_ds"
418 構造体に結びつけられている。
419 この構造体は以下のメンバーを含んでいる:
420 .in +4n
421 .nf
422
423 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;   /* 最後に変更した時間 */
439 };
440 .fi
441 .in
442 .TP 11
443 .I shm_perm
444 .\"O .I ipc_perm
445 .\"O structure that specifies the access permissions on the shared memory
446 .\"O segment.
447 共有メモリ・セグメントへのアクセス許可を指定した
448 .I ipc_perm
449 構造体。
450 .TP
451 .I shm_segsz
452 .\"O .I shm_segsz
453 .\"O Size in bytes of the shared memory segment.
454 共有メモリ・セグメントのバイト数。
455 .TP
456 .I shm_cpid
457 .\"O ID of the process that created the shared memory segment.
458 共有メモリ・セグメントを作成したプロセスの ID。
459 .TP
460 .I shm_lpid
461 .\"O ID of the last process that executed a
462 .\"O .BR shmat (2)
463 .\"O or
464 .\"O .BR shmdt (2)
465 .\"O system call.
466 最後に
467 .BR shmat (2)
468 または
469 .BR shmdt (2)
470 システム・コールを実行したプロセスの ID。
471 .TP
472 .I shm_nattch
473 .\"O Number of current alive attaches for this shared memory segment.
474 この共有メモリ・セグメントをメモリに付加 (attach) しているプロセスの数。
475 .TP
476 .I shm_atime
477 .\"O Time of the last
478 .\"O .BR shmat (2)
479 .\"O system call.
480 最後に
481 .BR shmat (2)
482 システム・コールを行なった時間。
483 .TP
484 .I shm_dtime
485 .\"O Time of the last
486 .\"O .BR shmdt (2)
487 .\"O system call.
488 最後に
489 .BR shmdt (2)
490 システム・コールを行なった時間。
491 .TP
492 .I shm_ctime
493 .\"O Time of the last
494 .\"O .BR shmctl (2)
495 .\"O system call that changed
496 .\"O .IR shmid_ds .
497 最後に
498 .BR shmctl (2)
499 システム・コールを行なって、
500 .I shmid_ds
501 構造体を変更した時間。
502 .\"O .SH "SEE ALSO"
503 .SH 関連項目
504 .BR ipc (2),
505 .BR msgctl (2),
506 .BR msgget (2),
507 .BR msgrcv (2),
508 .BR msgsnd (2),
509 .BR semctl (2),
510 .BR semget (2),
511 .BR semop (2),
512 .BR shmat (2),
513 .BR shmctl (2),
514 .BR shmdt (2),
515 .BR shmget (2),
516 .BR ftok (3)