2 .\" Copyright (C) 2006 Michael Kerrisk <mtk.manpages@gmail.com>
4 .\" %%%LICENSE_START(VERBATIM)
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date. The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein. The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
26 .TH MQ_GETATTR 3 2014-05-28 "Linux" "Linux Programmer's Manual"
28 mq_getattr, mq_setattr \- get/set message queue attributes
31 .B #include <mqueue.h>
33 .BI "int mq_getattr(mqd_t " mqdes ", struct mq_attr *" attr );
35 .BI "int mq_setattr(mqd_t " mqdes ", const struct mq_attr *" newattr ","
36 .BI " struct mq_attr *" oldattr );
39 Link with \fI\-lrt\fP.
44 respectively retrieve and modify attributes of the message queue
45 referred to by the descriptor
51 structure in the buffer pointed by
53 This structure is defined as:
58 long mq_flags; /* Flags: 0 or O_NONBLOCK */
59 long mq_maxmsg; /* Max. # of messages on queue */
60 long mq_msgsize; /* Max. message size (bytes) */
61 long mq_curmsgs; /* # of messages currently in queue */
68 field contains flags associated with the open message queue description.
69 This field is initialized when the queue is created by
71 The only flag that can appear in this field is
78 fields are set when the message queue is created by
82 field is an upper limit on the number of messages
83 that may be placed on the queue using
87 field is an upper limit on the size of messages
88 that may be placed on the queue.
89 Both of these fields must have a value greater than zero.
92 files that place ceilings on the values for these fields are described in
97 field returns the number of messages currently held in the queue.
100 sets message queue attributes using information supplied in the
102 structure pointed to by
104 The only attribute that can be modified is the setting of the
114 then the buffer that it points to is used to return an
116 structure that contains the same information that is returned by
123 return 0; on error, \-1 is returned, with
125 set to indicate the error.
129 The descriptor specified in
134 .I newattr\->mq_flags
135 contained set bits other than
138 .SS Multithreading (see pthreads(7))
143 functions are thread-safe.
151 are library functions layered on top of the
152 .BR mq_getsetattr (2)