mq_send(3c) mq_send(3c)
mq_send - send a message to a queue
#include <mqueue.h>
int mq_send (mqd_t mqd<b>, const char *msgptr<b>, size_t msglen<b>, unsigned int
msg_prio<b>);
mq_send sends the message at address msgptr, of size msglen bytes, to the
message queue named by mqd.
The message is queued in priority order, as specified by msgprio. The
larger the numerical value of the priority, the more important the
message. Messages with same priorities are queued in FIFO order. The
value of msgprio must be less than {MQ_PRIO_MAX}.
A message queue is full when the number of the messages queued equals the
value the of mq_maxmsg attribute of the queue. If the O_NONBLOCK flag is
set for the message queue descriptor mqd, mq_send will not block when the
queue is full [see mq_setattr(3c)]. Otherwise, mq_send will block until
either space becomes available to queue the message, or mq_send is
interrupted by a signal.
If multiple processes are waiting to send a message to the queue, the
highest priority process will be unblocked to queue its message when
space becomes available. Processes with equal priorities, blocked waiting
to queue a message, are unblocked in FIFO order when queue space becomes
available.
mq_send will fail if one or more of the following conditions are true:
[EAGAIN] The O_NONBLOCK flag is set for the queue descriptor and
the queue is full.
[EBADF] The message queue descriptor, mqd, is not valid or the
queue was not opened for writing.
[EINTR] The mq_send system call was interrupted by a signal.
[EINVAL] The value of msgprio is not less than {MQ_PRIO_MAX}.
[EMSGSIZE] The size of the message, msglen, is greater than the value
of the mq_maxsize attribute of the queue.
mq_open(3c), intro(3c), mq_unlink(3c), mq_receive(3c), mq_getattr(3c),
mq_notify(3c),
Page 1
mq_send(3c) mq_send(3c)
Upon successful completion, a value of 0 is returned and the message is
added to the queue. Otherwise, the message is not added to the queue, a
value of -1 is returned and errno is set to indicate the error.
PPPPaaaaggggeeee 2222 [ Back ]
|