OSDN Git Service

d23d6f4d1bc0a2b15d38c5cb02524d8f60da1b88
[linuxjm/LDP_man-pages.git] / release / man3 / mq_getattr.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 .\" Updated 2008-11-09, Akihiro MOTOKI, LDP v3.13
29 .\"
30 .TH MQ_GETATTR 3 2010-08-29 "Linux" "Linux Programmer's Manual"
31 .SH 名前
32 mq_getattr, mq_setattr \- メッセージキューの属性を設定/取得する
33 .SH 書式
34 .nf
35 .B #include <mqueue.h>
36 .sp
37 .BI "int mq_getattr(mqd_t " mqdes ", struct mq_attr *" attr );
38
39 .BI "int mq_setattr(mqd_t " mqdes ", struct mq_attr *" newattr ","
40 .BI "                 struct mq_attr *" oldattr );
41 .fi
42 .sp
43 \fI\-lrt\fP でリンクする。
44 .SH 説明
45 .BR mq_getattr ()
46
47 .BR mq_setattr ()
48 は、記述子
49 .I mqdes
50 で参照されるメッセージキューの属性の取得と変更をそれぞれ行う。
51
52 .BR mq_getattr ()
53 は、
54 .I attr
55 が指すバッファに
56 .I mq_attr
57 構造体を格納して返す。この構造体は以下のように定義されている:
58 .in +4n
59 .nf
60
61 struct mq_attr {
62     long mq_flags;       /* フラグ: 0 か O_NONBLOCK */
63     long mq_maxmsg;      /* キューの最大メッセージ数 */
64     long mq_msgsize;     /* 最大メッセージサイズ (バイト単位) */
65     long mq_curmsgs;     /* キューに現在入っているメッセージ数 */
66 };
67 .fi
68 .in
69 .PP
70 .I mq_flags
71 フィールドには、オープンメッセージキュー記述 (open message queue
72 description) に関連付けられているフラグが格納される。
73 このフィールドは
74 .BR mq_open (3)
75 でキューが作成される際に初期化される。
76 このフィールドに現れるフラグは
77 .B O_NONBLOCK
78 だけである。
79
80 .I mq_maxmsg
81
82 .I mq_msgsize
83 フィールドは
84 .BR mq_open (3)
85 でメッセージキューが作成される際にセットされる。
86 .I mq_maxmsg
87 フィールドは、
88 .BR mq_send (3)
89 を使ってキューに入れることができるメッセージ数の上限である。
90 .I mq_msgsize
91 フィールドは、キューに入れることができるメッセージの
92 上限サイズである。
93 これらのフィールドはどちらも 0 より大きな値でなければならない。
94 これらのフィールドに設定できる値の上限は
95 .I /proc
96 ファイルにより決まる。
97 .I /proc
98 ファイルの詳細は
99 .BR mq_open (3)
100 に説明されている。
101
102 .I mq_curmsgs
103 フィールドはキューに現在格納されているメッセージ数を返す。
104
105 .BR mq_setattr ()
106 は、
107 .I newattr
108 が指す
109 .I mq_attr
110 構造体で与えられた情報を使って、メッセージキューの属性を設定する。
111 変更することができる属性は、
112 .I mq_flags
113
114 .B O_NONBLOCK
115 フラグの設定だけである。
116 .I newattr
117 の他のフィールドは無視される。
118 .I oldattr
119 フィールドが NULL 以外の場合、
120 .BR mq_getattr ()
121 が返すのと同じ情報を格納した
122 .I mq_attr
123 構造体を
124 .I oldattr
125 が指すバッファに入れて返す。
126 .SH 返り値
127 成功すると、
128 .I mq_getattr ()
129
130 .I mq_setattr ()
131 は 0 を返す。エラーの場合、\-1 を返し、
132 .I errno
133 にエラーを示す値を設定する。
134 .SH エラー
135 .TP
136 .B EBADF
137 .I mqdes
138 で指定された記述子が不正である。
139 .TP
140 .B EINVAL
141 .I newattr\->mq_flags
142
143 .B O_NONBLOCK
144 以外のビットがセットされていた。
145 .SH 準拠
146 POSIX.1-2001.
147 .SH 注意
148 Linux では、
149 .BR mq_getattr ()
150
151 .BR mq_setattr ()
152 はライブラリ関数であり、
153 .BR mq_getsetattr (2)
154 システムコールを用いて実装されている。
155 .SH 関連項目
156 .BR mq_close (3),
157 .BR mq_notify (3),
158 .BR mq_open (3),
159 .BR mq_receive (3),
160 .BR mq_send (3),
161 .BR mq_unlink (3),
162 .BR mq_overview (7)