MsgQueueSend()

QNX SDP8.0C Library ReferenceAPIDeveloper

Send a message on an open queue

Note:
Don't use the MsgQueueSend() kernel call directly; instead, use mq_send().

Synopsis:

#include <sys/neutrino.h>

int MsgQueueSend( int fd,
                  char const* msg,
                  size_t msglen,
                  unsigned priority );

Arguments:

fd
A coid that identifies the open queue to send a message on.
msg
A pointer to a buffer containing the message to send.
msglen
The length of the buffer. This must not be larger than the queue's mq_msgsize.
priority
The mq priority at which to send the message.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The MsgQueueSend() kernel call enqueues a message to the message queue specified by fd. If the queue is full and O_NONBLOCK was not specified, the calling thread enters the STATE_MQ_SEND state, indicating it is blocked while waiting for space to become available on the queue. If O_NONBLOCK was specified, the call does not block and instead returns EAGAIN.

Returns:

0
Success.
-1
An error occurred (errno is set).

Errors:

EAGAIN
The queue is full and O_NONBLOCK was set.
EBADF
One of the following errors occured:
  • The fd is not associated with a message queue.
  • The fd is not open for writing.
EINTR
The operation was interrupted by a signal.
EINVAL
The priority is out of range.
EMSGSIZE
The message size is too big for the queue.
ETIMEDOUT
The queue is full and a timeout expired.

Classification:

QNX OS

Safety:
Cancellation pointNo
Signal handlerYes
ThreadYes
Page updated: