|
|
HP-UX Reference > Mmq_receive(2)HP-UX 11i Version 2: December 2007 Update |
|
NAMEmq_receive() — receive a message from a message queue SYNOPSIS#include <sys/mqueue.h> ssize_t mq_receive(mqd_t mqdes, char *msg_ptr, size_t msg_len, unsigned int *msg_prio ); DESCRIPTIONThe mq_receive() system call receives the oldest of the highest priority message from the message queue specified by mqdes. The selected message is removed from the queue and copied to the buffer pointed to by the msg_ptr argument. The argument, msg_len, specifies the size of the buffer in bytes. The value of msg_len should be greater than or equal to the mq_msgsize attribute of the message queue, or mq_receive() will fail. If the argument msg_prio is not NULL, the priority of the message removed from the queue is stored in the location pointed to by msg_prio. If the specified message queue is empty and the O_NONBLOCK flag is not set in the message queue blocking status associated with mqdes, mq_receive() will block in priority order, until it can receive a message from the queue, or until mq_receive() is interrupted by a signal. If the specified message queue is empty and the O_NONBLOCK flag is set in the message queue blocking status associated with mqdes, mq_receive() will not wait for a message to arrive on the queue and will return with an error. To use this function, link in the realtime library by specifying -lrt on the compiler or linker command line. RETURN VALUEmq_receive() returns the following values:
ERRORSIf mq_receive() fails, errno is set to one of the following values:
|
|