]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/mq_getattr.3
Wrapped long lines, wrapped at sentence boundaries; stripped trailing
[thirdparty/man-pages.git] / man3 / mq_getattr.3
1 '\" t
2 .\" Hey Emacs! This file is -*- nroff -*- source.
3 .\"
4 .\" Copyright (C) 2006 Michael Kerrisk <mtk-manpages@gmx.net>
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.
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 .TH MQ_GETATTR 3 2006-02-25 "Linux 2.6.16" "Linux Programmer's Manual"
24 .SH NAME
25 mq_getattr, mq_setattr \- get/set message queue attributes
26 .SH SYNOPSIS
27 .nf
28 .B #include <mqueue.h>
29 .sp
30 .BI "mqd_t mq_getattr(mqd_t " mqdes ", struct mq_attr *" attr );
31 .BI "mqd_t mq_setattr(mqd_t " mqdes ", struct mq_attr *" newattr ","
32 .BI " struct mq_attr *" oldattr );
33 .fi
34 .SH DESCRIPTION
35 .BR mq_getattr ()
36 and
37 .BR mq_setattr ()
38 respectively retrieve and modify attributes of the message queue
39 referred to by the descriptor
40 .IR mqdes .
41
42 .BR mq_getattr ()
43 returns an
44 .I mq_attr
45 structure in the buffer pointed by
46 .IR attr .
47 This structure is defined as:
48 .in +0.25i
49 .nf
50
51 struct mq_attr {
52 long mq_flags; /* Flags: 0 or O_NONBLOCK */
53 long mq_maxmsg; /* Max. # of messages on queue */
54 long mq_msgsize; /* Max. message size (bytes) */
55 long mq_curmsgs; /* # of messages currently in queue */
56 };
57 .fi
58 .in -0.25i
59 .PP
60 The
61 .I mq_flags
62 field contains flags associated with the open message queue description.
63 This field is initialised when the queue is created by
64 .BR mq_open ().
65 The only flag that can appear in this field is
66 .BR O_NONBLOCK .
67
68 The
69 .I mq_maxmsg
70 and
71 .I mq_msgsize
72 fields are set when the message queue is created by
73 .BR mq_open ().
74 The
75 .I mq_maxmsg
76 field is an upper limit on the number of messages
77 that may be placed on the queue using
78 .BR mq_send ().
79 The
80 .I mq_msgsize
81 field is an upper limit on the size of messages
82 that may be placed on the queue.
83 Both of these fields must have a value greater than zero.
84 Two
85 .I /proc
86 files that place ceilings on the values for these fields are described in
87 .BR mq_open (3).
88
89 The
90 .I mq_curmsgs
91 field returns the number of messages currently held in the queue.
92
93 .BR mq_setattr ()
94 sets message queue attributes using information supplied in the
95 .I mq_attr
96 structure pointed to by
97 .IR newattr .
98 The only attribute that can be modified is the setting of the
99 .B O_NONBLOCK
100 flag in
101 .IR mq_flags .
102 The other fields in
103 .I newattr
104 are ignored.
105 If the
106 .I oldattr
107 field is not NULL,
108 then the buffer that it points to is used to return an
109 .I mq_attr
110 structure that contains the same information that is returned by
111 .BR mq_getattr ().
112 .SH RETURN VALUE
113 On success
114 .BR mq_getattr ()
115 and
116 .BR mq_setattr ()
117 return 0; on error, \-1 is returned, with
118 .I errno
119 set to indicate the error.
120 .SH ERRORS
121 .TP
122 .B EBADF
123 The descriptor specified in
124 .I mqdes
125 is invalid.
126 .TP
127 .B EINVAL
128 .I newattr->mq_flags
129 contained set bits other than
130 .BR O_NONBLOCK .
131 .SH CONFORMING TO
132 POSIX.1-2001.
133 .SH "SEE ALSO"
134 .BR mq_close (3),
135 .BR mq_notify (3),
136 .BR mq_open (3),
137 .BR mq_receive (3),
138 .BR mq_send (3),
139 .BR mq_unlink (3),
140 .BR mq_overview (7)