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       mqd_t mq_getattr(mqd_t mqdes, struct mq_attr *attr);
12       mqd_t mq_setattr(mqd_t mqdes, struct mq_attr *newattr,
13                        struct mq_attr *oldattr);
14

DESCRIPTION

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

RETURN VALUE

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

ERRORS

58       EBADF  The descriptor specified in mqdes is invalid.
59
60       EINVAL newattr->mq_flags contained set bits other than O_NONBLOCK.
61

CONFORMING TO

63       POSIX.1-2001.
64

SEE ALSO

66       mq_close(3),  mq_notify(3),  mq_open(3),   mq_receive(3),   mq_send(3),
67       mq_unlink(3), mq_overview(7)
68
69
70
71Linux 2.6.16                      2006-02-25                     MQ_GETATTR(3)
Impressum