OSDN Git Service

(split) LDP: draft snapshot generated from latest ja.po files.
[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 .\"*******************************************************************
27 .\"
28 .\" This file was generated with po4a. Translate the source file.
29 .\"
30 .\"*******************************************************************
31 .TH MQ_OPEN 3 2009\-02\-20 Linux "Linux Programmer's Manual"
32 .SH 名前
33 mq_open \- メッセージキューをオープンする
34 .SH 書式
35 .nf
36 \fB#include <fcntl.h>\fP           /* For O_* constants */
37 \fB#include <sys/stat.h>\fP        /* For mode constants */
38 \fB#include <mqueue.h>\fP
39 .sp
40 \fBmqd_t mq_open(const char *\fP\fIname\fP\fB, int \fP\fIoflag\fP\fB);\fP
41 \fBmqd_t mq_open(const char *\fP\fIname\fP\fB, int \fP\fIoflag\fP\fB, mode_t \fP\fImode\fP\fB,\fP
42 \fB              struct mq_attr *\fP\fIattr\fP\fB);\fP
43 .fi
44 .sp
45 \fI\-lrt\fP でリンクする。
46 .SH 説明
47 \fBmq_open\fP()  は、新しい POSIX メッセージキューを作成するか、既存のキューを オープンする。キューは \fIname\fP で識別される。
48 \fIname\fP の構成の詳細については \fBmq_overview (7)\fP を参照。
49
50 \fIoflag\fP 引き数には、関数呼び出しの操作を制御するフラグを指定する (oflag の値の定義は \fI<fcntl.h>\fP
51 のインクルードにより得られる)。 \fIoflag\fP には、以下のうちいずれか一つを必ず指定しなければならない。
52 .TP 
53 \fBO_RDONLY\fP
54 メッセージの受信専用としてキューをオープンする。
55 .TP 
56 \fBO_WRONLY\fP
57 メッセージの送信専用としてキューをオープンする。
58 .TP 
59 \fBO_RDWR\fP
60 メッセージの送受信両用としてキューをオープンする。
61 .PP
62 0 個以上の下記のフラグを、ビット単位の OR (論理和) で \fIoflag\fP に追加で指定できる。
63 .TP 
64 \fBO_NONBLOCK\fP
65 非停止 (nonblocking) モードでキューをオープンする。 \fBmq_receive\fP(3)  と \fBmq_send\fP(3)  は、通常は停止
66 (block) する状況において、エラー \fBEAGAIN\fP で失敗するようになる。
67 .TP 
68 \fBO_CREAT\fP
69 .\" In reality the file system IDs are used on Linux.
70 存在しない場合、メッセージキューを作成する。 メッセージキューの所有者 (ユーザ ID) とグループ所有権 (グループ ID) は、
71 それぞれ呼び出し元プロセスの実効ユーザ ID と実効グループ ID に設定される。
72 .TP 
73 \fBO_EXCL\fP
74 \fBO_CREAT\fP が \fIoflag\fP に指定され、かつ指定された名前 \fIname\fP を持つキューがすでに存在する場合、エラー \fBEEXIST\fP
75 で失敗する。
76 .PP
77 \fIoflag\fP に \fBO_CREAT\fP を指定する場合、追加で 2つの引き数を与える必要がある。 \fImode\fP
78 引き数は、新しいキューに適用される許可設定 (permission) を、 \fBopen\fP(2)  と同じように指定する (許可ビットのシンボル定義は
79 \fI<sys/stat.h>\fP のインクルードにより得られる)。 許可設定はプロセスの umask でマスクされる。 \fIattr\fP
80 引き数は、キューの属性を指定する。詳細は、 \fBmq_getattr\fP(3)  を参照。 \fIattr\fP が NULL
81 の場合、キューは実装で定義されたデフォルト属性で作成される。
82 .SH 返り値
83 成功すると、 \fBmq_open\fP()  はメッセージキュー記述子 (message queue descriptor) を返す。
84 メッセージキュー記述子は他のメッセージキュー関連の関数で使用される。 エラーの場合、 \fBmq_open\fP()  は \fI(mqd_t)\ \-1\fP
85 を返し、 \fIerrno\fP にエラーを示す値を設定する。
86 .SH エラー
87 .TP 
88 \fBEACCES\fP
89 キューは存在するが、呼び出し元が指定されたモードでそのキュー をオープンする許可を持たない。
90 .TP 
91 \fBEACCES\fP
92 .\" Note that this isn't consistent with the same case for sem_open()
93 \fIname\fP にスラッシュが 2 個以上含まれていた。
94 .TP 
95 \fBEEXIST\fP
96 \fIoflag\fP に \fBO_CREAT\fP と \fBO_EXCL\fP の両方が指定されたが、指定された名前 \fIname\fP を持つキューがすでに存在する。
97 .TP 
98 \fBEINVAL\fP
99 \fIoflag\fP に \fBO_CREAT\fP が指定され、かつ \fIattr\fP が NULL 以外だが、 \fIattr\->mq_maxmsg\fP か
100 \fIattr\->mq_msqsize\fP が不正であった。 これらのフィールドは両方とも 0 より大きくなければならない。
101 プロセスが特権を持たない (\fBCAP_SYS_RESOURCE\fP ケーパビリティを持たない) 場合、 \fIattr\->mq_maxmsg\fP と
102 \fIattr\->mq_msgsize\fP は、それぞれ上限 \fImsg_max\fP、 \fImsgsize_max\fP 以下でなければならない。
103 また、特権プロセスの場合でも、 \fIattr\->mq_maxmsg\fP は \fBHARD_MAX\fP 上限を超えることはできない。
104 (これらの上限に関する詳細は \fBmq_overview\fP(7)  を参照。)
105 .TP 
106 \fBEMFILE\fP
107 そのプロセスがオープンしているファイルとメッセージキューの数が プロセス毎の上限に達している。
108 .TP 
109 \fBENAMETOOLONG\fP
110 \fIname\fP が長過ぎる。
111 .TP 
112 \fBENFILE\fP
113 システム全体でオープンしているファイルとメッセージキューの合計数が システム上限に達している。
114 .TP 
115 \fBENOENT\fP
116 \fBO_CREAT\fP フラグが \fIoflag\fP に指定されなかったが、指定された名前 \fIname\fP を持つキューが存在しない。
117 .TP 
118 \fBENOENT\fP
119 .\" Note that this isn't consistent with the same case for sem_open()
120 \fIname\fP が "/" だけで、その後ろに他の文字が続いていなかった。
121 .TP 
122 \fBENOMEM\fP
123 十分なメモリがない。
124 .TP 
125 \fBENOSPC\fP
126 新しいメッセージキューを作成するのに十分な空間がない。 このエラーはおそらく \fIqueues_max\fP 上限に抵触したため起こったのだろう。
127 \fBmq_overview\fP(7)  を参照。
128 .SH 準拠
129 POSIX.1\-2001.
130 .SH バグ
131 2.6.14 より前のカーネルには、 プロセスの umask が \fImode\fP で指定された許可設定に適用されなかった。
132 .SH 関連項目
133 \fBmq_close\fP(3), \fBmq_getattr\fP(3), \fBmq_notify\fP(3), \fBmq_receive\fP(3),
134 \fBmq_send\fP(3), \fBmq_unlink\fP(3), \fBmq_overview\fP(7)