]>
Commit | Line | Data |
---|---|---|
80a99f39 MK |
1 | '\" t |
2 | .\" Hey Emacs! This file is -*- nroff -*- source. | |
3 | .\" | |
c11b1abf | 4 | .\" Copyright (C) 2006 Michael Kerrisk <mtk.manpages@gmail.com> |
80a99f39 MK |
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 |
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 | |
1b2d3fca MK |
34 | .sp |
35 | Link with \fI\-lrt\fP. | |
80a99f39 MK |
36 | .SH DESCRIPTION |
37 | .BR mq_getattr () | |
38 | and | |
39 | .BR mq_setattr () | |
c13182ef | 40 | respectively retrieve and modify attributes of the message queue |
80a99f39 MK |
41 | referred to by the descriptor |
42 | .IR mqdes . | |
43 | ||
44 | .BR mq_getattr () | |
45 | returns an | |
46 | .I mq_attr | |
c13182ef | 47 | structure in the buffer pointed by |
28cdb68a | 48 | .IR attr . |
80a99f39 | 49 | This structure is defined as: |
a08ea57c | 50 | .in +4n |
80a99f39 MK |
51 | .nf |
52 | ||
53 | struct 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 | |
a08ea57c | 60 | .in |
80a99f39 MK |
61 | .PP |
62 | The | |
63 | .I mq_flags | |
64 | field contains flags associated with the open message queue description. | |
d9bfdb9c | 65 | This field is initialized when the queue is created by |
fb186734 | 66 | .BR mq_open (3). |
80a99f39 MK |
67 | The only flag that can appear in this field is |
68 | .BR O_NONBLOCK . | |
69 | ||
c13182ef | 70 | The |
80a99f39 MK |
71 | .I mq_maxmsg |
72 | and | |
73 | .I mq_msgsize | |
74 | fields are set when the message queue is created by | |
fb186734 | 75 | .BR mq_open (3). |
80a99f39 MK |
76 | The |
77 | .I mq_maxmsg | |
c13182ef | 78 | field is an upper limit on the number of messages |
80a99f39 | 79 | that may be placed on the queue using |
fb186734 | 80 | .BR mq_send (3). |
80a99f39 MK |
81 | The |
82 | .I mq_msgsize | |
83 | field is an upper limit on the size of messages | |
84 | that may be placed on the queue. | |
85 | Both of these fields must have a value greater than zero. | |
c13182ef MK |
86 | Two |
87 | .I /proc | |
88 | files that place ceilings on the values for these fields are described in | |
80a99f39 MK |
89 | .BR mq_open (3). |
90 | ||
c13182ef | 91 | The |
80a99f39 MK |
92 | .I mq_curmsgs |
93 | field returns the number of messages currently held in the queue. | |
94 | ||
95 | .BR mq_setattr () | |
c13182ef | 96 | sets message queue attributes using information supplied in the |
80a99f39 MK |
97 | .I mq_attr |
98 | structure pointed to by | |
99 | .IR newattr . | |
100 | The only attribute that can be modified is the setting of the | |
101 | .B O_NONBLOCK | |
102 | flag in | |
103 | .IR mq_flags . | |
104 | The other fields in | |
105 | .I newattr | |
106 | are ignored. | |
107 | If the | |
108 | .I oldattr | |
109 | field is not NULL, | |
110 | then the buffer that it points to is used to return an | |
111 | .I mq_attr | |
112 | structure that contains the same information that is returned by | |
113 | .BR mq_getattr (). | |
114 | .SH RETURN VALUE | |
115 | On success | |
116 | .BR mq_getattr () | |
117 | and | |
118 | .BR mq_setattr () | |
119 | return 0; on error, \-1 is returned, with | |
c13182ef | 120 | .I errno |
80a99f39 MK |
121 | set to indicate the error. |
122 | .SH ERRORS | |
123 | .TP | |
124 | .B EBADF | |
c13182ef | 125 | The descriptor specified in |
80a99f39 MK |
126 | .I mqdes |
127 | is invalid. | |
128 | .TP | |
129 | .B EINVAL | |
130 | .I newattr->mq_flags | |
131 | contained set bits other than | |
132 | .BR O_NONBLOCK . | |
133 | .SH CONFORMING TO | |
134 | POSIX.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) |