mq_setattr()
Set the attributes for a message-queue descriptor
Synopsis:
#include <mqueue.h>
int mq_setattr( mqd_t mqdes,
const struct mq_attr* mqstat,
struct mq_attr* omqstat );
Arguments:
- mqdes
- The message-queue descriptor, returned by mq_open(), that you want to set the attributes of.
- mqstat
- A pointer to an mq_attr structure that contains new attributes to use for the message-queue descriptor specified by mqdes. For information about this structure, see mq_getattr(); for information about which input fields in this structure get processed by mq_setattr(), see below.
- omqstat
- NULL, or a pointer to an mq_attr structure where the function can store the old attributes of the descriptor.
Library:
Description:
The mq_setattr() function updates some of the attributes of the given message-queue descriptor (mqdes). Specifically, this function sets the mq_flags field in the descriptor to the value of the mq_flags field in the attribute structure pointed to by mqstat. The new flags setting isn't applied to the queue itself, just to the queue descriptor. If omqstat isn't NULL, then the old attribute structure is stored in the location that this argument points to.
This function ignores the other input fields in the mqstat structure. The mq_flags field is the bitwise OR of zero or more of the following constants:
- O_NONBLOCK
- No mq_receive() or mq_send() call will ever block on this queue when this descriptor is used. If the queue is in such a condition that the given receive or send operation can't be performed without blocking, then an error is returned, and errno is set to EAGAIN.
Returns:
-1 if the function couldn't change the attributes (errno is set). Any other value indicates success.
Errors:
- EBADF
- The message-queue descriptor does not correspond to an open queue.
Classification:
| Safety: | |
|---|---|
| Cancellation point | No |
| Interrupt handler | No |
| Signal handler | No |
| Thread | Yes |
