NAME | SYNOPSIS | FEATURES | DESCRIPTION | RETURN VALUE | ERRORS | ATTRIBUTES | SEE ALSO
#include <mqueue.h>int mq_getattr(mqd_t mqdes, struct mq_attr *mqstat);
POSIX_MQ
The mq_getattr system call is used to get status information and attributes associated with the message queue specified by mqdes.
The mqstat pointer indicates an mq_attr structure. This structure has the following form, as defined in the mqueue.h header:
long mq_flags; /* message queue flags */ long mq_maxmsg; /* maximum number of messages */ long mq_msgsize; /* maximum message size */ long mq_curmsgs; /* number of mssages currently queued */ long mq_sendwait; /* implementation extension: nb. send wait*/ long mq_curmsgs; /* implementation extension: nb. receive wait */ |
The following member represents an attribute that can be set and queried.
Specifies actions and status for the message queue operations. If the O_NONBLOCK flag is set, neither the mq_send(2POSIX) nor the mq_receive(2POSIX) operations associated with this message queue will block.
The following members represent attributes that can be queried, but which can only be set at message queue creation.
Specifies the number of messages that can be held in the message queue without causing mq_send to fail or wait due to lack of resources.
Specifies the maximum size of each message in the message queue.
The following members represent the current status of the dynamic attributes of the message queue. These can be queried, but they cannot be explicitly set.
Indicates the number of messages currently in the queue.
Indicates the total number of threads waiting for mq_send to complete.
Indicates the total number of threads waiting for mq_receive to complete.
Upon successful return of mq_getattr, the mq_flags member of the mq_attr structure referenced by the mqstat argument will have the values that were set when the message queue was created, plus any modifications made by subsequent mq_setattr calls.
Upon successful completion, mq_getattr returns 0. Otherwise, mq_getattr will return -1 and set errno to indicate one of the following error conditions.
The mq_getattr function is not supported.
The MQ feature [_POSIX_MESSAGE_PASSING] option (see sysconf(3POSIX)) is not configured.
The mqdes argument is not a valid message queue descriptor.
mqstat points outside the allocated address space of the c_actor.
See attributes(5) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
---|---|
Interface Stability | Evolving |
NAME | SYNOPSIS | FEATURES | DESCRIPTION | RETURN VALUE | ERRORS | ATTRIBUTES | SEE ALSO