mq_getattr Subroutine
Purpose
Gets message queue attributes.
Library
Standard C Library (libc.a)
Syntax
#include <mqueue.h>
int mq_getattr (mqdes, mqstat)
mqd_t mqdes;
struct mq_attr *mqstat;
Description
The mq_getattr subroutine obtains status information and attributes of the message queue and the open message queue description associated with the message queue descriptor.
The results are returned in the mq_attr structure referenced by the mqstat parameter.
Upon return, the
following members have the values associated with the open message
queue description as set when the message queue was opened and as
modified by subsequent calls to the mq_setattr subroutine:
- mq_flags
The following attributes of the message queue are returned
as set at message queue creation:
- mq_maxmsg
- mq_msgsize
Upon return, the following member within the mq_attr structure
referenced by the mqstat parameter is set to the current state
of the message queue:
Item | Description |
---|---|
mq_curmsgs | The number of messages currently on the queue. |
Parameters
Item | Description |
---|---|
mqdes | Specifies a message queue descriptor. |
mqstat | Points to the mq_attr structure. |
Return Values
Upon successful completion, the mq_getattr subroutine returns zero. Otherwise, the subroutine returns -1 and sets errno to indicate the error.
Error Codes
The mq_getattr subroutine
fails if:
Item | Description |
---|---|
EBADF | The mqdes parameter is not a valid message queue descriptor. |
EFAULT | Invalid user address. |
EINVAL | The mqstat parameter value is not valid. |
ENOMEM | Insufficient memory for the required operation. |
ENOTSUP | This function is not supported with processes that have been checkpoint-restart'ed. |