]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/mq_getattr.3
ffix
[thirdparty/man-pages.git] / man3 / mq_getattr.3
CommitLineData
80a99f39
MK
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.
c13182ef 14.\"
80a99f39
MK
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
c13182ef
MK
18.\" the use of the information contained herein.
19.\"
80a99f39
MK
20.\" Formatted or processed versions of this manual, if unaccompanied by
21.\" the source, must acknowledge the copyright and authors of this work.
22.\"
d9343c5c 23.TH MQ_GETATTR 3 2006-02-25 "Linux" "Linux Programmer's Manual"
80a99f39
MK
24.SH NAME
25mq_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
1b2d3fca
MK
34.sp
35Link with \fI\-lrt\fP.
80a99f39
MK
36.SH DESCRIPTION
37.BR mq_getattr ()
38and
39.BR mq_setattr ()
c13182ef 40respectively retrieve and modify attributes of the message queue
80a99f39
MK
41referred to by the descriptor
42.IR mqdes .
43
44.BR mq_getattr ()
45returns an
46.I mq_attr
c13182ef 47structure in the buffer pointed by
28cdb68a 48.IR attr .
80a99f39
MK
49This structure is defined as:
50.in +0.25i
51.nf
52
53struct mq_attr {
54 long mq_flags; /* Flags: 0 or O_NONBLOCK */
55 long mq_maxmsg; /* Max. # of messages on queue */
56 long mq_msgsize; /* Max. message size (bytes) */
57 long mq_curmsgs; /* # of messages currently in queue */
58};
59.fi
60.in -0.25i
61.PP
62The
63.I mq_flags
64field contains flags associated with the open message queue description.
d9bfdb9c 65This field is initialized when the queue is created by
fb186734 66.BR mq_open (3).
80a99f39
MK
67The only flag that can appear in this field is
68.BR O_NONBLOCK .
69
c13182ef 70The
80a99f39
MK
71.I mq_maxmsg
72and
73.I mq_msgsize
74fields are set when the message queue is created by
fb186734 75.BR mq_open (3).
80a99f39
MK
76The
77.I mq_maxmsg
c13182ef 78field is an upper limit on the number of messages
80a99f39 79that may be placed on the queue using
fb186734 80.BR mq_send (3).
80a99f39
MK
81The
82.I mq_msgsize
83field is an upper limit on the size of messages
84that may be placed on the queue.
85Both of these fields must have a value greater than zero.
c13182ef
MK
86Two
87.I /proc
88files that place ceilings on the values for these fields are described in
80a99f39
MK
89.BR mq_open (3).
90
c13182ef 91The
80a99f39
MK
92.I mq_curmsgs
93field returns the number of messages currently held in the queue.
94
95.BR mq_setattr ()
c13182ef 96sets message queue attributes using information supplied in the
80a99f39
MK
97.I mq_attr
98structure pointed to by
99.IR newattr .
100The only attribute that can be modified is the setting of the
101.B O_NONBLOCK
102flag in
103.IR mq_flags .
104The other fields in
105.I newattr
106are ignored.
107If the
108.I oldattr
109field is not NULL,
110then the buffer that it points to is used to return an
111.I mq_attr
112structure that contains the same information that is returned by
113.BR mq_getattr ().
114.SH RETURN VALUE
115On success
116.BR mq_getattr ()
117and
118.BR mq_setattr ()
119return 0; on error, \-1 is returned, with
c13182ef 120.I errno
80a99f39
MK
121set to indicate the error.
122.SH ERRORS
123.TP
124.B EBADF
c13182ef 125The descriptor specified in
80a99f39
MK
126.I mqdes
127is invalid.
128.TP
129.B EINVAL
130.I newattr->mq_flags
131contained set bits other than
132.BR O_NONBLOCK .
133.SH CONFORMING TO
134POSIX.1-2001.
135.SH "SEE ALSO"
136.BR mq_close (3),
137.BR mq_notify (3),
138.BR mq_open (3),
139.BR mq_receive (3),
140.BR mq_send (3),
141.BR mq_unlink (3),
142.BR mq_overview (7)