OSDN Git Service

07e27cdcf7886e5318880813f9c0e76941c8ae8c
[linuxjm/LDP_man-pages.git] / draft / man3 / mq_open.3
1 '\" t
2 .\" Hey Emacs! This file is -*- nroff -*- source.
3 .\"
4 .\" Copyright (C) 2006 Michael Kerrisk <mtk.manpages@gmail.com>
5 .\"
6 .\" Permission is granted to make and distribute verbatim copies of this
7 .\" manual provided the copyright notice and this permission notice are
8 .\" preserved on all copies.
9 .\"
10 .\" Permission is granted to copy and distribute modified versions of this
11 .\" manual under the conditions for verbatim copying, provided that the
12 .\" entire resulting derived work is distributed under the terms of a
13 .\" permission notice identical to this one.
14 .\"
15 .\" Since the Linux kernel and libraries are constantly changing, this
16 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
17 .\" responsibility for errors or omissions, or for damages resulting from
18 .\" the use of the information contained herein.  The author(s) may not
19 .\" have taken the same level of care in the production of this manual,
20 .\" which is licensed free of charge, as they might when working
21 .\" professionally.
22 .\"
23 .\" Formatted or processed versions of this manual, if unaccompanied by
24 .\" the source, must acknowledge the copyright and authors of this work.
25 .\"
26 .\" Japanese Version Copyright (c) 2006 Akihiro MOTOKI all rights reserved.
27 .\" Translated 2006-04-23, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
28 .\"
29 .TH MQ_OPEN 3 2009-02-20 "Linux" "Linux Programmer's Manual"
30 .\"O .SH NAME
31 .SH 名前
32 .\"O mq_open \- open a message queue
33 mq_open \- メッセージキューをオープンする
34 .\"O .SH SYNOPSIS
35 .SH 書式
36 .nf
37 .BR "#include <fcntl.h>" "           /* For O_* constants */"
38 .BR "#include <sys/stat.h>" "        /* For mode constants */"
39 .B #include <mqueue.h>
40 .sp
41 .BI "mqd_t mq_open(const char *" name ", int " oflag );
42 .BI "mqd_t mq_open(const char *" name ", int " oflag ", mode_t " mode ,
43 .BI "              struct mq_attr *" attr );
44 .fi
45 .sp
46 .\"O Link with \fI\-lrt\fP.
47 \fI\-lrt\fP でリンクする。
48 .\"O .SH DESCRIPTION
49 .SH 説明
50 .\"O .BR mq_open ()
51 .\"O creates a new POSIX message queue or opens an existing queue.
52 .\"O The queue is identified by
53 .\"O .IR name .
54 .\"O For details of the construction of
55 .\"O .IR name ,
56 .\"O see
57 .\"O .BR mq_overview (7).
58 .BR mq_open ()
59 は、新しい POSIX メッセージキューを作成するか、既存のキューを
60 オープンする。キューは
61 .I name
62 で識別される。
63 .I name
64 の構成の詳細については
65 .B mq_overview (7)
66 を参照。
67
68 .\"O The
69 .\"O .I oflag
70 .\"O argument specifies flags that control the operation of the call.
71 .\"O (Definitions of the flags values can be obtained by including
72 .\"O .IR <fcntl.h> .)
73 .\"O Exactly one of the following must be specified in
74 .\"O .IR oflag :
75 .I oflag
76 引き数には、関数呼び出しの操作を制御するフラグを指定する
77 (oflag の値の定義は
78 .I <fcntl.h>
79 のインクルードにより得られる)。
80 .I oflag
81 には、以下のうちいずれか一つを必ず指定しなければならない。
82 .TP
83 .B O_RDONLY
84 .\"O Open the queue to receive messages only.
85 メッセージの受信専用としてキューをオープンする。
86 .TP
87 .B O_WRONLY
88 .\"O Open the queue to send messages only.
89 メッセージの送信専用としてキューをオープンする。
90 .TP
91 .B O_RDWR
92 .\"O Open the queue to both send and receive messages.
93 メッセージの送受信両用としてキューをオープンする。
94 .PP
95 .\"O Zero or more of the following flags can additionally be
96 .\"O .IR OR ed
97 .\"O in
98 .\"O .IR oflag :
99 0 個以上の下記のフラグを、ビット単位の OR (論理和) で
100 .I oflag
101 に追加で指定できる。
102 .TP
103 .B O_NONBLOCK
104 .\"O Open the queue in nonblocking mode.
105 .\"O In circumstances where
106 .\"O .BR mq_receive (3)
107 .\"O and
108 .\"O .BR mq_send (3)
109 .\"O would normally block, these functions instead fail with the error
110 .\"O .BR EAGAIN .
111 非停止 (nonblocking) モードでキューをオープンする。
112 .BR mq_receive (3)
113
114 .BR mq_send (3)
115 は、通常は停止 (block) する状況において、エラー
116 .B EAGAIN
117 で失敗するようになる。
118 .TP
119 .B O_CREAT
120 .\"O Create the message queue if it does not exist.
121 .\"O The owner (user ID) of the message queue is set to the effective
122 .\"O user ID of the calling process.
123 .\"O The group ownership (group ID) is set to the effective group ID
124 .\"O of the calling process.
125 .\"O .\" In reality the file system IDs are used on Linux.
126 存在しない場合、メッセージキューを作成する。
127 メッセージキューの所有者 (ユーザ ID) とグループ所有権 (グループ ID) は、
128 それぞれ呼び出し元プロセスの実効ユーザ ID と実効グループ ID に設定される。
129 .\" 実際は、Linux ではファイルシステム ID が使用される。
130 .TP
131 .B O_EXCL
132 .\"O If
133 .\"O .B O_CREAT
134 .\"O was specified in
135 .\"O .IR oflag ,
136 .\"O and a queue with the given
137 .\"O .I name
138 .\"O already exists, then fail with the error
139 .\"O .BR EEXIST .
140 .B O_CREAT
141
142 .I oflag
143 に指定され、かつ指定された名前
144 .I name
145 を持つキューがすでに存在する場合、エラー
146 .B EEXIST
147 で失敗する。
148 .PP
149 .\"O If
150 .\"O .B O_CREAT
151 .\"O is specified in
152 .\"O .IR oflag ,
153 .\"O then two additional arguments must be supplied.
154 .I oflag
155
156 .B O_CREAT
157 を指定する場合、追加で 2つの引き数を与える必要がある。
158 .\"O The
159 .\"O .I mode
160 .\"O argument specifies the permissions to be placed on the new queue,
161 .\"O as for
162 .\"O .BR open (2).
163 .\"O (Symbolic definitions for the permissions bits can be obtained by including
164 .\"O .IR <sys/stat.h> .)
165 .\"O The permissions settings are masked against the process umask.
166 .I mode
167 引き数は、新しいキューに適用される許可設定 (permission) を、
168 .BR open (2)
169 と同じように指定する
170 (許可ビットのシンボル定義は
171 .I <sys/stat.h>
172 のインクルードにより得られる)。
173 許可設定はプロセスの umask でマスクされる。
174 .\"O The
175 .\"O .I attr
176 .\"O argument specifies attributes for the queue.
177 .\"O See
178 .\"O .BR mq_getattr (3)
179 .\"O for details.
180 .\"O If
181 .\"O .I attr
182 .\"O is NULL, then the queue is created with implementation-defined
183 .\"O default attributes.
184 .I attr
185 引き数は、キューの属性を指定する。詳細は、
186 .BR mq_getattr (3)
187 を参照。
188 .I attr
189 が NULL の場合、キューは実装で定義されたデフォルト属性で作成される。
190 .\"O .SH RETURN VALUE
191 .SH 返り値
192 .\"O On success,
193 .\"O .BR mq_open ()
194 .\"O returns a message queue descriptor for use by other
195 .\"O message queue functions.
196 成功すると、
197 .BR mq_open ()
198 はメッセージキュー記述子 (message queue descriptor) を返す。
199 メッセージキュー記述子は他のメッセージキュー関連の関数で使用される。
200 .\"O On error,
201 .\"O .BR mq_open ()
202 .\"O returns
203 .\"O .IR "(mqd_t)\ \-1",
204 .\"O with
205 .\"O .I errno
206 .\"O set to indicate the error.
207 エラーの場合、
208 .BR mq_open ()
209
210 .I "(mqd_t)\ \-1"
211 を返し、
212 .I errno
213 にエラーを示す値を設定する。
214 .\"O .SH ERRORS
215 .SH エラー
216 .TP
217 .B EACCES
218 .\"O The queue exists, but the caller does not have permission to
219 .\"O open it in the specified mode.
220 キューは存在するが、呼び出し元が指定されたモードでそのキュー
221 をオープンする許可を持たない。
222 .TP
223 .B EACCES
224 .\"O .I name
225 .\"O contained more than one slash.
226 .I name
227 にスラッシュが 2 個以上含まれていた。
228 .\" Note that this isn't consistent with the same case for sem_open()
229 .TP
230 .B EEXIST
231 .\"O Both
232 .\"O .B O_CREAT
233 .\"O and
234 .\"O .B O_EXCL
235 .\"O were specified in
236 .\"O .IR oflag ,
237 .\"O but a queue with this
238 .\"O .I name
239 .\"O already exists.
240 .I oflag
241
242 .B O_CREAT
243
244 .B O_EXCL
245 の両方が指定されたが、指定された名前
246 .I name
247 を持つキューがすでに存在する。
248 .TP
249 .B EINVAL
250 .\"O .B O_CREAT
251 .\"O was specified in
252 .\"O .IR oflag ,
253 .\"O and
254 .\"O .I attr
255 .\"O was not NULL, but
256 .\"O .I attr\->mq_maxmsg
257 .\"O or
258 .\"O .I attr\->mq_msqsize
259 .\"O was invalid.
260 .\"O Both of these fields must be greater than zero.
261 .I oflag
262
263 .B O_CREAT
264 が指定され、かつ
265 .I attr
266 が NULL 以外だが、
267 .I attr\->mq_maxmsg
268
269 .I attr\->mq_msqsize
270 が不正であった。
271 これらのフィールドは両方とも 0 より大きくなければならない。
272 .\"O In a process that is unprivileged (does not have the
273 .\"O .B CAP_SYS_RESOURCE
274 .\"O capability),
275 .\"O .I attr\->mq_maxmsg
276 .\"O must be less than or equal to the
277 .\"O .I msg_max
278 .\"O limit, and
279 .\"O .I attr\->mq_msgsize
280 .\"O must be less than or equal to the
281 .\"O .I msgsize_max
282 .\"O limit.
283 .\"O In addition, even in a privileged process,
284 .\"O .I attr\->mq_maxmsg
285 .\"O cannot exceed the
286 .\"O .B HARD_MAX
287 .\"O limit.
288 .\"O (See
289 .\"O .BR mq_overview (7)
290 .\"O for details of these limits.)
291 プロセスが特権を持たない
292 .RB ( CAP_SYS_RESOURCE
293 ケーパビリティを持たない) 場合、
294 .I attr\->mq_maxmsg
295
296 .I attr\->mq_msgsize
297 は、それぞれ上限
298 .IR msg_max 、
299 .I msgsize_max
300 以下でなければならない。
301 また、特権プロセスの場合でも、
302 .I attr\->mq_maxmsg
303
304 .B HARD_MAX
305 上限を超えることはできない。
306 (これらの上限に関する詳細は
307 .BR mq_overview (7)
308 を参照。)
309 .TP
310 .B EMFILE
311 .\"O The process already has the maximum number of files and
312 .\"O message queues open.
313 そのプロセスがオープンしているファイルとメッセージキューの数が
314 プロセス毎の上限に達している。
315 .TP
316 .B ENAMETOOLONG
317 .\"O .I name
318 .\"O was too long.
319 .I name
320 が長すぎる。
321 .TP
322 .B ENFILE
323 .\"O The system limit on the total number of open files and message queues
324 .\"O has been reached.
325 システム全体でオープンしているファイルとメッセージキューの合計数が
326 システム上限に達している。
327 .TP
328 .B ENOENT
329 .\"O The
330 .\"O .B O_CREAT
331 .\"O flag was not specified in
332 .\"O .IR oflag ,
333 .\"O and no queue with this
334 .\"O .I name
335 .\"O exists.
336 .B O_CREAT
337 フラグが
338 .I oflag
339 に指定されなかったが、指定された名前
340 .I name
341 を持つキューが存在しない。
342 .TP
343 .B ENOENT
344 .\"O .I name
345 .\"O was just "/" followed by no other characters.
346 .I name
347 が "/" だけで、その後ろに他の文字が続いていなかった。
348 .\" Note that this isn't consistent with the same case for sem_open()
349 .TP
350 .B ENOMEM
351 .\"O Insufficient memory.
352 十分なメモリがない。
353 .TP
354 .B ENOSPC
355 .\"O Insufficient space for the creation of a new message queue.
356 .\"O This probably occurred because the
357 .\"O .I queues_max
358 .\"O limit was encountered; see
359 .\"O .BR mq_overview (7).
360 新しいメッセージキューを作成するのに十分な空間がない。
361 このエラーはおそらく
362 .I queues_max
363 上限に抵触したため起こったのだろう。
364 .BR mq_overview (7)
365 を参照。
366 .\"O .SH CONFORMING TO
367 .SH 準拠
368 POSIX.1-2001.
369 .\"O .SH BUGS
370 .SH バグ
371 .\"O In kernels before 2.6.14,
372 .\"O the process umask was not applied to the permissions specified in
373 .\"O .IR mode .
374 2.6.14 より前のカーネルには、
375 プロセスの umask が
376 .I mode
377 で指定された許可設定に適用されなかった。
378 .\"O .SH "SEE ALSO"
379 .SH 関連項目
380 .BR mq_close (3),
381 .BR mq_getattr (3),
382 .BR mq_notify (3),
383 .BR mq_receive (3),
384 .BR mq_send (3),
385 .BR mq_unlink (3),
386 .BR mq_overview (7)