is an integer greater than 0 that can be used for selecting messages, is an array of bytes, with a size up to that of the system limit (MSGMAX).
The value of has one of the following meanings: is greater than 0. The first message of type will be received. is equal to 0. The first message on the queue will be received. is less than 0. The first message of the lowest message type that is less than or equal to the absolute value of will be received.
specifies the maximum length of the requested message. If the received message has a length greater than it will be silently truncated if the MSG_NOERROR flag is set in otherwise an error will be returned.
If no matching message is present on the message queue specified by the behaviour of depends on whether the IPC_NOWAIT flag is set in or not. If IPC_NOWAIT is set, will immediately return a value of -1, and set to EAGAIN. If IPC_NOWAIT is not set, the calling process will be blocked until: A message of the requested type becomes available on the message queue. The message queue is removed, in which case -1 will be returned, and set to EINVAL. A signal is received and caught. -1 is returned, and set to EINTR.
If a message is successfully received, the data structure associated with is updated as follows: is decremented by the size of the message. is set to the pid of the caller. is set to the current time. is decremented by 1.
The message queue was removed while was waiting for a message of the requested type to become available on it.
is less than 0. A matching message was received, but its size was greater than and the MSG_NOERROR flag was not set in The calling process does not have read access to the message queue. points to an invalid address. The system call was interrupted by the delivery of a signal. There is no message of the requested type available on the message queue, and IPC_NOWAIT is set in