File: svipc.7

package info (click to toggle)
manpages-ja 0.5.0.0.20120606-1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 25,964 kB
  • sloc: perl: 161; makefile: 116
file content (252 lines) | stat: -rw-r--r-- 10,197 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
.\" Copyright 1993 Giorgio Ciucci (giorgio@crcc.it)
.\"
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date.  The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from
.\" the use of the information contained herein.  The author(s) may not
.\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
.\" FIXME There is now duplication of some of the information
.\" below in semctl.2, msgctl.2, and shmctl.2 -- MTK, Nov 04
.\"*******************************************************************
.\"
.\" This file was generated with po4a. Translate the source file.
.\"
.\"*******************************************************************
.TH SVIPC 7 2009\-01\-26 Linux "Linux Programmer's Manual"
.SH 名前
svipc \- System V プロセス間通信機構
.SH 書式
.nf
\fB#include <sys/types.h>\fP
\fB#include <sys/ipc.h>\fP
\fB#include <sys/msg.h>\fP
\fB#include <sys/sem.h>\fP
\fB#include <sys/shm.h>\fP
.fi
.SH 説明
このマニュアルページは System V プロセス間通信 (interprocess communication; IPC) 機構の Linux に
おける実装を説明する。 このプロセス間通信機構には、 メッセージキュー (message queue)、セマフォー集合 (semaphore set)、
共有メモリセグメント (shared memory segment) などがある。以下で \fI資源 (resource)\fP
という用語を使用した場合にはこれらの機構のどれかを意味する。
.SS 資源へのアクセス許可
システムのそれぞれの資源は、IPC への操作を許可するかどうかを決定する ための情報を共通の構造体 \fIstruct ipc_perm\fP
に格納して使用する。 \fIipc_perm\fP 構造体は、ヘッダーファイルの \fI<sys/ipc.h>\fP
に定義されており、以下のメンバーが含まれている:
.in +4n
.nf

struct ipc_perm {
    uid_t          cuid;   /* 作成者のユーザーID */
    gid_t          cgid;   /* 作成者のグループID */
    uid_t          uid;    /* 所有者のユーザーID */
    gid_t          gid;    /* 所有者のグループID */
    unsigned short mode;   /* 読み書きの許可 */
};
.fi
.in
.PP
\fIipc_perm\fP 構造体の \fImode\fP メンバーは以下の 9 ビットで、プロセスの IPC システムコール
による資源へのアクセス許可を定義する。 許可は以下のように解釈される:
.sp
.nf
    0400    ユーザーによる読み込み。
    0200    ユーザーによる書き込み。
.sp .5
    0040    グループによる読み込み。
    0020    グループによる書き込み。
.sp .5
    0004    他人による読み込み。
    0002    他人による書き込み。
.fi
.PP
システムはビット 0100, 0010, 0001 (実行ビット) は使用しない。 さらに、セマフォーの場合には "書き込み(write)" は実際には
"変更(alter)" を意味する。
.PP
同じヘッダーファイルには以下のシンボルの定義が含まれている:
.TP  14
\fBIPC_CREAT\fP
キー(key)が存在しない場合には新たなエントリを作成する。
.TP 
\fBIPC_EXCL\fP
キー(key)が存在する場合には失敗する。
.TP 
\fBIPC_NOWAIT\fP
要求が待たされる場合にはエラーになる。
.TP 
\fBIPC_PRIVATE\fP
プライベートキー。
.TP 
\fBIPC_RMID\fP
資源を削除する。
.TP 
\fBIPC_SET\fP
資源にオプションを設定する。
.TP 
\fBIPC_STAT\fP
資源のオプションを取得する。
.PP
\fBIPC_PRIVATE\fP は \fIkey_t\fP 型である。その他の全てのシンボルはフラグフィールドとして \fIint\fP 変数に OR
演算で格納することができる。
.SS メッセージキュー
メッセージキューは正の整数 (\fImsqid\fP)  によって識別され、 \fI<sys/msg.h>\fP に定義されている構造体
\fIstruct msqid_ds\fP に結びつけられている。 この構造体は以下のメンバーを含んでいる:
.in +4n
.nf

struct msqid_ds {
    struct ipc_perm msg_perm;
    msgqnum_t       msg_qnum;    /* キューにあるメッセージの数 */
    msglen_t        msg_qbytes;  /* キューの最大バイト数 */
    pid_t           msg_lspid;   /* 最後に msgsnd(2) をした PID */
    pid_t           msg_lrpid;   /* 最後に msgrcv(2) をした PID */
    time_t          msg_stime;   /* 最後に msgsnd(2) をした時間 */
    time_t          msg_rtime;   /* 最後に msgrcv(2) をした時間 */
    time_t          msg_ctime;   /* 最後に変更された時間 */
};
.fi
.in
.TP  11
\fImsg_perm\fP
メッセージキューへのアクセス許可を指定する \fIipc_perm\fP 構造体。
.TP 
\fImsg_qnum\fP
現在、このメッセージキューにあるメッセージの数。
.TP 
\fImsg_qbytes\fP
メッセージキューに入れることができるメッセージの最大バイト数。
.TP 
\fImsg_lspid\fP
最後に \fBmsgsnd\fP(2)  システムコールを行なったプロセスの ID。
.TP 
\fImsg_lrpid\fP
最後に \fBmsgrcv\fP(2)  システムコールを行なったプロセスの ID。
.TP 
\fImsg_stime\fP
最後に \fBmsgsnd\fP(2)  システムコールを行なった時間。
.TP 
\fImsg_rtime\fP
最後に \fBmsgrcv\fP(2)  を行なった時間。
.TP 
\fImsg_ctime\fP
最後に \fImsqid_ds\fP 構造体のメンバーが変更された時間。
.SS セマフォー集合
セマフォー集合は正の整数 (\fIsemid\fP)  によって識別され、 \fI<sys/sem.h>\fP に定義されている構造体
\fIstruct semid_ds\fP に結びつけられている。 この構造体は以下のメンバーを含んでいる:
.in +4n
.nf

struct semid_ds {
    struct ipc_perm sem_perm;
    time_t          sem_otime;   /* 最後に操作した時間 */
    time_t          sem_ctime;   /* 最後に変更した時間 */
    unsigned long   sem_nsems;   /* 集合の中にあるセマフォー数 */
};
.fi
.in
.TP  11
\fIsem_perm\fP
セマフォー集合へのアクセス許可を指定する \fIipc_perm\fP 構造体。
.TP 
\fIsem_otime\fP
最後に \fBsemop\fP(2)  システムコールを行なった時間。
.TP 
\fIsem_ctime\fP
最後に \fBsemctl\fP(2)  を行なって上記の構造体のメンバーを変更するか、セマフォー集合に属する セマフォーを変更した時間。
.TP 
\fIsem_nsems\fP
セマフォー集合の中にあるセマフォーの数。 集合の中にあるそれぞれのセマフォーは負でない整数によって参照され、 \fB0\fP から
\fIsem_nsems\-1\fP までの番号を持つ。
.PP
セマフォーは \fIstruct sem\fP 型のデータ構造体であり、以下のメンバーを含んでいる:
.in +4n
.nf

.\"    unsigned short semncnt; /* nr awaiting semval to increase */
.\"    unsigned short semzcnt; /* nr awaiting semval = 0 */
struct sem {
    int semval;  /* セマフォーの値 */
    int sempid;  /* 最後に操作したプロセス ID */
};
.fi
.in
.TP  11
\fIsemval\fP
セマフォー値: 負でない整数。
.TP 
\fIsempid\fP
.\".TP
.\".I semncnt
.\"Number of processes suspended awaiting for
.\".I semval
.\"to increase.
.\".TP
.\".I semznt
.\"Number of processes suspended awaiting for
.\".I semval
.\"to become zero.
このセマフォーを最後に操作したプロセスの ID。
.SS 共有メモリセグメント
共有メモリセグメントは正の整数 (\fIshmid\fP)  によって識別され、 \fI<sys/shm.h>\fP に定義されている
\fIstruct shmid_ds\fP 構造体に結びつけられている。 この構造体は以下のメンバーを含んでいる:
.in +4n
.nf

struct shmid_ds {
    struct ipc_perm shm_perm;
    size_t          shm_segsz;   /* セグメントのサイズ */
    pid_t           shm_cpid;    /* 作成者のプロセス ID */
    pid_t           shm_lpid;    /* 最後に操作したプロセス ID */
    shmatt_t        shm_nattch;  /* 現在、付加している数 */
    time_t          shm_atime;   /* 最後に付加した時間 */
    time_t          shm_dtime;   /* 最後に分離した時間 */
    time_t          shm_ctime;   /* 最後に変更した時間 */
};
.fi
.in
.TP  11
\fIshm_perm\fP
共有メモリセグメントへのアクセス許可を指定した \fIipc_perm\fP 構造体。
.TP 
\fIshm_segsz\fP
共有メモリセグメントのバイト数。
.TP 
\fIshm_cpid\fP
共有メモリセグメントを作成したプロセスの ID。
.TP 
\fIshm_lpid\fP
最後に \fBshmat\fP(2)  または \fBshmdt\fP(2)  システムコールを実行したプロセスの ID。
.TP 
\fIshm_nattch\fP
この共有メモリセグメントをメモリに付加 (attach) しているプロセスの数。
.TP 
\fIshm_atime\fP
最後に \fBshmat\fP(2)  システムコールを行なった時間。
.TP 
\fIshm_dtime\fP
最後に \fBshmdt\fP(2)  システムコールを行なった時間。
.TP 
\fIshm_ctime\fP
最後に \fBshmctl\fP(2)  システムコールを行なって、 \fIshmid_ds\fP 構造体を変更した時間。
.SH 関連項目
\fBipc\fP(2), \fBmsgctl\fP(2), \fBmsgget\fP(2), \fBmsgrcv\fP(2), \fBmsgsnd\fP(2),
\fBsemctl\fP(2), \fBsemget\fP(2), \fBsemop\fP(2), \fBshmat\fP(2), \fBshmctl\fP(2),
\fBshmdt\fP(2), \fBshmget\fP(2), \fBftok\fP(3)
.SH この文書について
この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.41 の一部
である。プロジェクトの説明とバグ報告に関する情報は
http://www.kernel.org/doc/man\-pages/ に書かれている。