Get a message queue's attributes
#include <mqueue.h>
int mq_getattr( mqd_t mqdes,
struct mq_attr* mqstat );
libc
The mq_getattr() function is used to determine the current attributes of the queue referenced by mqdes. These attributes are stored in the location pointed to by mqstat. The fields of the mq_attr structure are as follows:
| Member | Description |
|---|---|
| long mq_flags | The options set for this queue. This field may have been changed since queue creation with a call to mq_setattr() (see mq_setattr() for a complete description of each bit). |
| long mq_maxmsg | The maximum number of messages which can be stored on the queue. This value was set at queue creation. |
| long mq_msgsize | The maximum size of each message on the given message queue. This value was also set at queue creation. |
| long mq_curmsgs | This field represents the number of messages currently on the given queue. |
| long mq_sendwait | The number of processes currently waiting to send a message. This field was eliminated from the POSIX standard after draft 9, but has been resurrected for the QNX implementation. A nonzero value in this field implies that the queue is full. |
| long mq_recvwait | The number of processes currently waiting to receive a message. Like mq_sendwait, this field was resurrected for the QNX implementation. A nonzero value in this field implies that the queue is empty. |
POSIX 1003.1 (Realtime Extensions)
| Safety: | |
|---|---|
| Cancellation point | No |
| Interrupt handler | No |
| Signal handler | No |
| Thread | Yes |
mq_close(), mq_open(), mq_setattr()