mq_getattr - get message queue attributes (REALTIME)
The mq_getattr() function shall obtain status information and attributes of the message queue and the open message queue description associated with the message queue descriptor.
The mqdes argument specifies a message queue descriptor.
The results shall be returned in the mq_attr structure referenced by the mqstat argument.
Upon return, the following members shall have the values associated with the open message queue description as set when the message queue was opened and as modified by subsequent mq_setattr() calls: mq_flags.
The following attributes of the message queue shall be returned as set at message queue creation: mq_maxmsg, mq_msgsize.
Upon return, the following members within the mq_attr structure referenced by the mqstat argument shall be set to the current state of the message queue:
- The number of messages currently on the queue.
Upon successful completion, the mq_getattr() function shall return zero. Otherwise, the function shall return -1 and set errno to indicate the error.
The mq_getattr() function may fail if:
- The mqdes argument is not a valid message queue descriptor.
mq_open(), mq_send(), mq_setattr(), mq_timedsend(), msgctl(), msgget(), msgrcv(), msgsnd(), the Base Definitions volume of IEEE Std 1003.1-2001, <mqueue.h>
First released in Issue 5. Included for alignment with the POSIX Realtime Extension.
The mq_getattr() function is marked as part of the Message Passing option.
The [ENOSYS] error condition has been removed as stubs need not be provided if an implementation does not support the Message Passing option.
The mq_timedsend() function is added to the SEE ALSO section for alignment with IEEE Std 1003.1d-1999.
IEEE Std 1003.1-2001/Cor 2-2004, item XSH/TC2/D6/61 is applied, updating the ERRORS section to change the [EBADF] error from mandatory to optional.