OSDN Git Service

6d029be0f5e3a3ed4888519bbb6fc3ccb844734f
[linuxjm/LDP_man-pages.git] / draft / man2 / msgget.2
1 .\" Copyright 1993 Giorgio Ciucci <giorgio@crcc.it>
2 .\"
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provflags 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 .\" Added correction due to Nick Duffek <nsd@bbc.com>, aeb, 960426
24 .\" Modified Wed Nov  6 04:00:31 1996 by Eric S. Raymond <esr@thyrsus.com>
25 .\" Modified, 8 Jan 2003, Michael Kerrisk, <mtk.manpages@gmail.com>
26 .\"     Removed EIDRM from errors - that can't happen...
27 .\" Modified, 27 May 2004, Michael Kerrisk <mtk.manpages@gmail.com>
28 .\"     Added notes on capability requirements
29 .\" Modified, 11 Nov 2004, Michael Kerrisk <mtk.manpages@gmail.com>
30 .\"     Language and formatting clean-ups
31 .\"     Added notes on /proc files
32 .\"
33 .\" Japanese Version Copyright (c) 1997 HANATAKA Shinya
34 .\"         all rights reserved.
35 .\" Translated 1997-02-23, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
36 .\" Modified 2003-07-03, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
37 .\" Updated 2005-03-04, Akihiro MOTOKI
38 .\"
39 .\"WORD:        message                 メッセージ
40 .\"WORD:        queue                   キュー
41 .\"WORD:        identifier              識別子
42 .\"WORD:        argument                引き数
43 .\"WORD:        owner                   所有者
44 .\"WORD:        group                   グループ
45 .\"WORD:        other                   他人
46 .\"WORD:        initialize              初期化
47 .\"WORD:        effective user ID       実効ユーザーID
48 .\"WORD:        effective group ID      実効グループID
49 .\"WORD:        current time            現在時刻
50 .\"WORD:        destruction             破棄
51 .\"WORD:        policy                  方針
52 .\"
53 .TH MSGGET 2 2004-05-27 "Linux" "Linux Programmer's Manual"
54 .\"O .SH NAME
55 .\"O msgget \- get a message queue identifier
56 .SH 名前
57 msgget \- メッセージ・キュー識別子を取得する
58 .\"O .SH SYNOPSIS
59 .SH 書式
60 .nf
61 .B #include <sys/types.h>
62 .B #include <sys/ipc.h>
63 .B #include <sys/msg.h>
64
65 .BI "int msgget(key_t " key ", int " msgflg );
66 .fi
67 .\"O .SH DESCRIPTION
68 .SH 説明
69 .\"O The
70 .\"O .BR msgget ()
71 .\"O system call returns the message queue identifier associated
72 .\"O with the value of the
73 .\"O .I key
74 .\"O argument.
75 .BR msgget ()
76 システムコールは
77 .I key
78 引き数の値に対応するメッセージ・キューの識別子を返す。
79 .\"O A new message queue is created if
80 .\"O .I key
81 .\"O has the value
82 .\"O .B IPC_PRIVATE
83 .\"O or
84 .\"O .I key
85 .\"O isn't
86 .\"O .BR IPC_PRIVATE ,
87 .\"O no message queue with the given key
88 .\"O .I key
89 .\"O exists, and
90 .\"O .B IPC_CREAT
91 .\"O is specified in
92 .\"O .IR msgflg .
93 .I key
94 の値が
95 .B IPC_PRIVATE
96 の場合、または
97 .I key
98
99 .B IPC_PRIVATE
100 でなくても、
101 .I key
102 に対応するメッセージ・キューが存在せず、
103 .I msgflg
104
105 .B IPC_CREAT
106 が指定されている場合、
107 新しいメッセージ・キューが作成される。
108 .PP
109 .\"O If
110 .\"O .I msgflg
111 .\"O specifies both
112 .\"O .B IPC_CREAT
113 .\"O and
114 .\"O .B IPC_EXCL
115 .\"O and a message queue already exists for
116 .\"O .IR key ,
117 .\"O then
118 .\"O .BR msgget ()
119 .\"O fails with
120 .\"O .I errno
121 .\"O set to
122 .\"O .BR EEXIST .
123 .\"O (This is analogous to the effect of the combination
124 .\"O .B O_CREAT | O_EXCL
125 .\"O for
126 .\"O .BR open (2).)
127 .I msgflg
128
129 .B IPC_CREAT
130
131 .B IPC_EXCL
132 の両方が指定された場合、
133 .I key
134 に対応するメッセージ・キューが既に存在すると、
135 .BR msgget ()
136 は失敗し、
137 .I errno
138
139 .B EEXIST
140 が設定される。
141 (これは
142 .BR open (2)
143
144 .B O_CREAT | O_EXCL
145 を指定した場合の動作と同じである)
146 .PP
147 .\"O Upon creation, the least significant bits of the argument
148 .\"O .I msgflg
149 .\"O define the permissions of the message queue.
150 .\"O These permission bits have the same format and semantics
151 .\"O as the permissions specified for the
152 .\"O .I mode
153 .\"O argument of
154 .\"O .BR open (2).
155 .\"O (The execute permissions are not used.)
156 メッセージ・キューの作成時に、
157 .I msgflg
158 引き数の下位 9 ビットは、
159 そのメッセージ・キューのアクセス許可の定義として使用される。
160 これらの許可ビットは
161 .BR open (2)
162 の引き数
163 .I mode
164 と同じ形式で同じ意味である。
165
166 .BR creat (2)
167 システム・コールのアクセス許可パラメータと同じ形式で、同じ意味を持つ。
168 (但し、実行 (execute) 許可は使用されない。)
169 .PP
170 .\"O If a new message queue is created,
171 .\"O then its associated data structure
172 .\"O .I msqid_ds
173 .\"O (see
174 .\"O .BR msgctl (2))
175 .\"O is initialized as follows:
176 新規のメッセージ・キューを作成する際、
177 .BR msgget ()
178 システム・コールはメッセージ・キューのデータ構造体
179 .I msqid_ds
180 を以下のように初期化する
181 .RI ( msqid_ds
182 については
183 .BR msgctl (2)
184 を参照):
185 .IP
186 .\"O .I msg_perm.cuid
187 .\"O and
188 .\"O .I msg_perm.uid
189 .\"O are set to the effective user ID of the calling process.
190 .I msg_perm.cuid
191
192 .I msg_perm.uid
193 に呼び出し元プロセスの実効 (effective) ユーザーID を設定する。
194 .IP
195 .\"O .I msg_perm.cgid
196 .\"O and
197 .\"O .I msg_perm.gid
198 .\"O are set to the effective group ID of the calling process.
199 .I msg_perm.cgid
200
201 .I msg_perm.gid
202 に呼び出し元プロセスの実効 (effective) グループID を設定する。
203 .IP
204 .\"O The least significant 9 bits of
205 .\"O .I msg_perm.mode
206 .\"O are set to the least significant 9 bits of
207 .\"O .IR msgflg .
208 .I msg_perm.mode
209 の下位 9 ビットは
210 .I msgflg
211 の下位 9 ビットを設定する。
212 .IP
213 .\"O .IR msg_qnum ,
214 .\"O .IR msg_lspid ,
215 .\"O .IR msg_lrpid ,
216 .\"O .I msg_stime
217 .\"O and
218 .\"O .I msg_rtime
219 .\"O are set to 0.
220 .IR msg_qnum ,
221 .IR msg_lspid ,
222 .IR msg_lrpid ,
223 .IR msg_stime ,
224 .I msg_rtime
225 に 0 を設定される。
226 .IP
227 .\"O .I msg_ctime
228 .\"O is set to the current time.
229 .I msg_ctime
230 に現在の時刻を設定する。
231 .IP
232 .\"O .I msg_qbytes
233 .\"O is set to the system limit
234 .\"O .BR MSGMNB .
235 .I msg_qbytes
236 に、システムで決められたメッセージ・キューの最大サイズ
237 .B MSGMNB
238 を設定する。
239 .PP
240 .\"O If the message queue already exists the permissions are
241 .\"O verified, and a check is made to see if it is marked for
242 .\"O destruction.
243 メッセージ・キューがすでに存在する場合は、アクセス許可の検査と、
244 破棄 (destruction) マークがないかの確認が行われる。
245 .\"O .SH "RETURN VALUE"
246 .SH 返り値
247 .\"O If successful, the return value will be the message queue identifier (a
248 .\"O nonnegative integer), otherwise \-1
249 .\"O with
250 .\"O .I errno
251 .\"O indicating the error.
252 成功した場合、返り値はメッセージ・キュー識別子 (非負の整数) となる。
253 失敗した場合は \-1 が返され、
254 .I errno
255 にそのエラーが示される。
256 .\"O .SH ERRORS
257 .SH エラー
258 .\"O On failure,
259 .\"O .I errno
260 .\"O is set to one of the following values:
261 失敗した場合、
262 .I errno
263 に以下の値のいずれか一つが設定される:
264 .TP
265 .B EACCES
266 .\"O A message queue exists for
267 .\"O .IR key ,
268 .\"O but the calling process does not have permission to access the queue,
269 .\"O and does not have the
270 .\"O .B CAP_IPC_OWNER
271 .\"O capability.
272 .I key
273 に対応するメッセージ・キューは存在するが、
274 呼び出し元プロセスはそのキューに対するアクセス許可がなく、
275 .B CAP_IPC_OWNER
276 ケーパビリティも持っていない。
277 .TP
278 .B EEXIST
279 .\"O A message queue exists for
280 .\"O .I key
281 .\"O and
282 .\"O .I msgflg
283 .\"O specified both
284 .\"O .B IPC_CREAT
285 .\"O and
286 .\"O .BR IPC_EXCL .
287 .I key
288 に対応するメッセージ・キューが存在し、
289 .I msgflg
290
291 .B IPC_CREAT
292
293 .B IPC_EXCL
294 が指定されていた。
295 .TP
296 .B ENOENT
297 .\"O No message queue exists for
298 .\"O .I key
299 .\"O and
300 .\"O .I msgflg
301 .\"O did not specify
302 .\"O .BR IPC_CREAT .
303 .I key
304 に対応するメッセージ・キューが存在せず、
305 .I msgflg
306
307 .B IPC_CREAT
308 が指定されていなかった。
309 .TP
310 .B ENOMEM
311 .\"O A message queue has to be created but the system does not have enough
312 .\"O memory for the new data structure.
313 メッセージ・キューを作成しようとしたが、新しいデータ構造体を作成
314 するのに十分なメモリがシステムに存在しない。
315 .TP
316 .B ENOSPC
317 .\"O A message queue has to be created but the system limit for the maximum
318 .\"O number of message queues
319 .\"O .RB ( MSGMNI )
320 .\"O would be exceeded.
321 メッセージ・キューを作成しようとしたが、作成すると
322 システム全体のメッセージ・キュー数の最大値
323 .RB ( MSGMNI )
324 を超えてしまう。
325 .\"O .SH "CONFORMING TO"
326 .SH 準拠
327 SVr4, POSIX.1-2001.
328 .\"O .SH NOTES
329 .SH 注意
330 .\"O .B IPC_PRIVATE
331 .\"O isn't a flag field but a
332 .\"O .I key_t
333 .\"O type.
334 .B IPC_PRIVATE
335 はフラグではなく、
336 .I key_t
337 型である。
338 .\"O If this special value is used for
339 .\"O .IR key ,
340 .\"O the system call ignores everything but the least significant 9 bits of
341 .\"O .I msgflg
342 .\"O and creates a new message queue (on success).
343 この特別な値が
344 .I key
345 として使用された場合、
346 .BR msgget ()
347 システムコールは
348 .I msgflg
349 の下位 9 ビット以外の全てを無視して
350 (成功した場合は) 新しいメッセージ・キューを作成する。
351 .PP
352 .\"O The following is a system limit on message queue resources affecting a
353 .\"O .BR msgget ()
354 .\"O call:
355 .BR msgget ()
356 システムコールに影響を及ぼすメッセージ・キューの資源の
357 システムとしての制限を以下に示す:
358 .TP
359 .B MSGMNI
360 .\"O System wide maximum number of message queues: policy
361 .\"O dependent
362 .\"O (on Linux, this limit can be read and modified via
363 .\"O .IR /proc/sys/kernel/msgmni ).
364 システム全体のメッセージ・キュー数の最大値: 方針依存
365 (Linux では、この制限値は
366 .I /proc/sys/kernel/msgmni
367 経由で参照したり、変更したりできる)。
368 .\"O .SS "Linux Notes"
369 .SS Linux での注意
370 .\"O Until version 2.3.20 Linux would return
371 .\"O .B EIDRM
372 .\"O for a
373 .\"O .BR msgget ()
374 .\"O on a message queue scheduled for deletion.
375 Linux 2.3.20 までは、削除が予定されているメッセージ・キューに対して
376 .BR msgget ()
377 を行うと
378 .B EIDRM
379 がエラーとして返されるようになっていた。
380 .\"O .SH BUGS
381 .SH バグ
382 .\"O The name choice
383 .\"O .B IPC_PRIVATE
384 .\"O was perhaps unfortunate,
385 .\"O .B IPC_NEW
386 .\"O would more clearly show its function.
387 .B IPC_PRIVATE
388 という名前を選んだのはおそらく失敗であろう。
389 .B IPC_NEW
390 の方がより明確にその機能を表しているだろう。
391 .\"O .SH "SEE ALSO"
392 .SH 関連項目
393 .BR msgctl (2),
394 .BR msgrcv (2),
395 .BR msgsnd (2),
396 .BR ftok (3),
397 .BR capabilities (7),
398 .BR mq_overview (7),
399 .BR svipc (7)