1MQ_GETATTR(3)              Linux Programmer's Manual             MQ_GETATTR(3)
2
3
4

NAME

6       mq_getattr, mq_setattr - get/set message queue attributes
7

SYNOPSIS

9       #include <mqueue.h>
10
11       int mq_getattr(mqd_t mqdes, struct mq_attr *attr);
12
13       int mq_setattr(mqd_t mqdes, struct mq_attr *newattr,
14                        struct mq_attr *oldattr);
15
16       Link with -lrt.
17

DESCRIPTION

19       mq_getattr()   and   mq_setattr()   respectively  retrieve  and  modify
20       attributes of the message queue referred to by the descriptor mqdes.
21
22       mq_getattr() returns an mq_attr structure  in  the  buffer  pointed  by
23       attr.  This structure is defined as:
24
25           struct mq_attr {
26               long mq_flags;       /* Flags: 0 or O_NONBLOCK */
27               long mq_maxmsg;      /* Max. # of messages on queue */
28               long mq_msgsize;     /* Max. message size (bytes) */
29               long mq_curmsgs;     /* # of messages currently in queue */
30           };
31
32       The  mq_flags  field  contains  flags  associated with the open message
33       queue description.  This field is initialized when the queue is created
34       by  mq_open(3).   The only flag that can appear in this field is O_NON‐
35       BLOCK.
36
37       The mq_maxmsg and mq_msgsize fields are set when the message  queue  is
38       created  by  mq_open(3).   The mq_maxmsg field is an upper limit on the
39       number of messages that may be placed on the  queue  using  mq_send(3).
40       The mq_msgsize field is an upper limit on the size of messages that may
41       be placed on the queue.  Both of these fields must have a value greater
42       than zero.  Two /proc files that place ceilings on the values for these
43       fields are described in mq_open(3).
44
45       The mq_curmsgs field returns the number of messages currently  held  in
46       the queue.
47
48       mq_setattr()  sets  message queue attributes using information supplied
49       in the mq_attr structure pointed to by  newattr.   The  only  attribute
50       that can be modified is the setting of the O_NONBLOCK flag in mq_flags.
51       The other fields in newattr are ignored.  If the oldattr field  is  not
52       NULL,  then  the  buffer that it points to is used to return an mq_attr
53       structure that contains  the  same  information  that  is  returned  by
54       mq_getattr().
55

RETURN VALUE

57       On  success  mq_getattr()  and  mq_setattr()  return 0; on error, -1 is
58       returned, with errno set to indicate the error.
59

ERRORS

61       EBADF  The descriptor specified in mqdes is invalid.
62
63       EINVAL newattr->mq_flags contained set bits other than O_NONBLOCK.
64

CONFORMING TO

66       POSIX.1-2001.
67

NOTES

69       On Linux, mq_getattr() and mq_setattr() are library  functions  layered
70       on top of the mq_getsetattr(2) system call.
71

SEE ALSO

73       mq_close(3),   mq_notify(3),   mq_open(3),  mq_receive(3),  mq_send(3),
74       mq_unlink(3), mq_overview(7)
75

COLOPHON

77       This page is part of release 3.53 of the Linux  man-pages  project.   A
78       description  of  the project, and information about reporting bugs, can
79       be found at http://www.kernel.org/doc/man-pages/.
80
81
82
83Linux                             2010-08-29                     MQ_GETATTR(3)
Impressum