Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/m/mq_send.html on line 1
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/m/mq_send.html on line 1
Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/m/mq_send.html on line 8
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/m/mq_send.html on line 8
Send a message to a queue
#include <mqueue.h>
int mq_send( mqd_t mqdes,
const char * msg_ptr,
size_t msg_len,
unsigned int msg_prio );
- mqdes
- The message-queue descriptor, returned by
mq_open(),
of the message queue that you want to send a message to.
- msg_ptr
- A pointer to the message that you want to send.
- msg_len
- The size of the message.
- msg_prio
- The priority of the message, in the range from 0 to
(MQ_PRIO_MAX-1).
The mq_send() function puts a message of size
msg_len and pointed to by msg_ptr into the queue
indicated by mqdes.
The new message has a priority of msg_prio.
|
Neutrino supports two implementations of message queues:
a traditional implementation, and an alternate one that uses
asynchronous messages.
For more information, see the entry for
mq and mqueue
in the Utilities Reference. |
The queue is maintained in priority order,
and in FIFO order within the same priority.
If the number of elements on the specified queue is equal to its
mq_maxmsg,
and O_NONBLOCK wasn't set
(in the oflag argument to mq_open()),
the call to mq_send() blocks.
It becomes unblocked when there's room on the queue to send the given message.
If more than one mq_send() is blocked on a given queue,
and space becomes available in that queue to send,
then the mq_send() with the highest priority message is unblocked.
In the traditional (mqueue) implementation, calling
write()
with mqdes is analogous to
calling mq_send() with a msg_prio of 0.
-1 if an error occurred
(errno
is set).
Any other value indicates success.
- EAGAIN
- The O_NONBLOCK flag was set when opening the queue, and
the specified queue is full.
- EBADF
- The mqdes argument doesn't represent a valid message queue descriptor,
or mqdes wasn't opened for writing.
- EINTR
- The call was interrupted by a signal.
- EINVAL
- One of the following cases is true:
- msg_len was negative
- msg_prio was greater than
(MQ_PRIO_MAX-1)
- msg_prio was less than 0
- EMSGSIZE
- The msg_len argument was greater than the msgsize
associated with the specified queue.
POSIX 1003.1 MSG
Safety: | |
Cancellation point |
Yes |
Interrupt handler |
No |
Signal handler |
No |
Thread |
Yes |
mq_close(),
mq_open(),
mq_receive(),
mq_timedsend()
mq, mqueue
in the Utilities Reference
Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/m/mq_send.html on line 226
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/m/mq_send.html on line 226