MsgQueueCtl()
QNX SDP8.0C Library ReferenceAPIDeveloper
Perform message queue operations
Synopsis:
#include <sys/neutrino.h>
int MsgQueueCtl( int fd,
int cmd,
void* data );
Arguments:
- fd
- The open message-queue descriptor, as obtained with mq_open().
- cmd
-
The operation to perform, specified by one the following constants:
- _NTO_MQCTL_NOTIFY — Register or unregister the caller for notification when the queue identified by fd transitions from an empty to non-empty state. When registering for notification, data must be a pointer to a sigevent structure. When unregistering, data must be NULL.
- _NTO_MQCTL_GETATTR — Fill in an mq_attr structure with the attributes of the descriptor and the underlying queue (see mq_getattr() for information about the contents of the mq_attr structure).
- _NTO_MQCTL_SETATTR — Change the O_NONBLOCK flag of the specified message-queue descriptor.
- _NTO_MQCTL_GETBUFSIZE — Calculate the buffer size needed to store a message queue with the specified maximum number of messages and maximum message size. The fd argument must be -1 for this command. For more information, see the data argument.
- data
- A pointer to the appropriate data structure for the current operation:
- _NTO_MQCTL_NOTIFY — a sigevent structure
- _NTO_MQCTL_GETATTR — a struct mq_attr structure
- _NTO_MQCTL_SETATTR — a struct mq_attr structure
- _NTO_MQCTL_GETBUFSIZE — a struct _mqctl_getbufsize structure
with the following settings:
- __in.__msgsize — the maximum size, in bytes, of any message in the queue
- __in.__maxmsg — the maximum number of messages in the queue
For some operations, this field can be NULL; see above for an explanation for the _NTO_MQCTL_NOTIFY case.
Library:
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
Description:
The MsgQueueCtl() function is used to perform operations on message queues. These operations include registering for notifications, querying queue attributes, and controlling whether reads or writes on the queue can block when the current descriptor is used.
Note:
This kernel call is used to implement the C library functions mq_notify(), mq_getattr(),
and mq_setattr(). It should not be used directly, except for the _NTO_MQCTL_GETBUFSIZE command.
Returns:
- 0
- Success.
- -1
- An error occurred (errno is set).
Errors:
- EBADF
- The queue descriptor does not correspond to an open queue.
- EBUSY
- _NTO_MQCTL_NOTIFY attempted to add a notification for a queue where a notification already exists.
- EINVAL
- _NTO_MQCTL_NOTIFY attempted to remove a notification that was added by a different process.
- ENOSYS
- An unsupported command was specified.
Classification:
| Safety: | |
|---|---|
| Cancellation point | No |
| Signal handler | Yes |
| Thread | Yes |
Page updated:
