2 .\" Hey Emacs! This file is -*- nroff -*- source.
4 .\" Copyright (C) 2006 Michael Kerrisk <mtk.manpages@gmail.com>
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.
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.
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
23 .\" Formatted or processed versions of this manual, if unaccompanied by
24 .\" the source, must acknowledge the copyright and authors of this work.
26 .\" Japanese Version Copyright (c) 2006 Akihiro MOTOKI all rights reserved.
27 .\" Translated 2006-04-23, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
29 .TH MQ_OPEN 3 2009-02-20 "Linux" "Linux Programmer's Manual"
32 .\"O mq_open \- open a message queue
33 mq_open \- メッセージキューをオープンする
37 .BR "#include <fcntl.h>" " /* For O_* constants */"
38 .BR "#include <sys/stat.h>" " /* For mode constants */"
39 .B #include <mqueue.h>
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 );
46 .\"O Link with \fI\-lrt\fP.
51 .\"O creates a new POSIX message queue or opens an existing queue.
52 .\"O The queue is identified by
54 .\"O For details of the construction of
57 .\"O .BR mq_overview (7).
59 は、新しい POSIX メッセージキューを作成するか、既存のキューを
70 .\"O argument specifies flags that control the operation of the call.
71 .\"O (Definitions of the flags values can be obtained by including
73 .\"O Exactly one of the following must be specified in
76 引き数には、関数呼び出しの操作を制御するフラグを指定する
81 には、以下のうちいずれか一つを必ず指定しなければならない。
84 .\"O Open the queue to receive messages only.
85 メッセージの受信専用としてキューをオープンする。
88 .\"O Open the queue to send messages only.
89 メッセージの送信専用としてキューをオープンする。
92 .\"O Open the queue to both send and receive messages.
93 メッセージの送受信両用としてキューをオープンする。
95 .\"O Zero or more of the following flags can additionally be
99 0 個以上の下記のフラグを、ビット単位の OR (論理和) で
104 .\"O Open the queue in nonblocking mode.
105 .\"O In circumstances where
106 .\"O .BR mq_receive (3)
109 .\"O would normally block, these functions instead fail with the error
111 非停止 (nonblocking) モードでキューをオープンする。
115 は、通常は停止 (block) する状況において、エラー
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 が使用される。
134 .\"O was specified in
136 .\"O and a queue with the given
138 .\"O already exists, then fail with the error
153 .\"O then two additional arguments must be supplied.
157 を指定する場合、追加で 2つの引き数を与える必要がある。
160 .\"O argument specifies the permissions to be placed on the new queue,
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.
167 引き数は、新しいキューに適用される許可設定 (permission) を、
173 許可設定はプロセスの umask でマスクされる。
176 .\"O argument specifies attributes for the queue.
178 .\"O .BR mq_getattr (3)
182 .\"O is NULL, then the queue is created with implementation-defined
183 .\"O default attributes.
185 引き数は、キューの属性を指定する。詳細は、
189 が NULL の場合、キューは実装で定義されたデフォルト属性で作成される。
190 .\"O .SH RETURN VALUE
194 .\"O returns a message queue descriptor for use by other
195 .\"O message queue functions.
198 はメッセージキュー記述子 (message queue descriptor) を返す。
199 メッセージキュー記述子は他のメッセージキュー関連の関数で使用される。
203 .\"O .IR "(mqd_t)\ \-1",
206 .\"O set to indicate the error.
218 .\"O The queue exists, but the caller does not have permission to
219 .\"O open it in the specified mode.
220 キューは存在するが、呼び出し元が指定されたモードでそのキュー
225 .\"O contained more than one slash.
228 .\" Note that this isn't consistent with the same case for sem_open()
235 .\"O were specified in
237 .\"O but a queue with this
251 .\"O was specified in
255 .\"O was not NULL, but
256 .\"O .I attr\->mq_maxmsg
258 .\"O .I attr\->mq_msqsize
260 .\"O Both of these fields must be greater than zero.
271 これらのフィールドは両方とも 0 より大きくなければならない。
272 .\"O In a process that is unprivileged (does not have the
273 .\"O .B CAP_SYS_RESOURCE
275 .\"O .I attr\->mq_maxmsg
276 .\"O must be less than or equal to the
279 .\"O .I attr\->mq_msgsize
280 .\"O must be less than or equal to the
283 .\"O In addition, even in a privileged process,
284 .\"O .I attr\->mq_maxmsg
285 .\"O cannot exceed the
289 .\"O .BR mq_overview (7)
290 .\"O for details of these limits.)
292 .RB ( CAP_SYS_RESOURCE
311 .\"O The process already has the maximum number of files and
312 .\"O message queues open.
313 そのプロセスがオープンしているファイルとメッセージキューの数が
323 .\"O The system limit on the total number of open files and message queues
324 .\"O has been reached.
325 システム全体でオープンしているファイルとメッセージキューの合計数が
331 .\"O flag was not specified in
333 .\"O and no queue with this
345 .\"O was just "/" followed by no other characters.
347 が "/" だけで、その後ろに他の文字が続いていなかった。
348 .\" Note that this isn't consistent with the same case for sem_open()
351 .\"O Insufficient memory.
355 .\"O Insufficient space for the creation of a new message queue.
356 .\"O This probably occurred because the
358 .\"O limit was encountered; see
359 .\"O .BR mq_overview (7).
360 新しいメッセージキューを作成するのに十分な空間がない。
366 .\"O .SH CONFORMING TO
371 .\"O In kernels before 2.6.14,
372 .\"O the process umask was not applied to the permissions specified in