Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)

System Functions (k - m) msgrcv(2)
NAME
msgrcv - Receives a message from a message queue
LIBRARY
G-series native OSS processes: /G/system/sysnn/zossksrl
32-bit H-series and J-series OSS processes: /G/system/zdllnnn/zosskdll
64-bit H-series and J-series OSS processes: /G/system/zdllnnn/yosskdll
SYNOPSIS
#include <sys/msg.h>
int msgrcv(
int msqid,
void *msgp,
size_t msgsz,
long int msgtyp,
int msgflg);
PARAMETERS
msqid Specifies the identifier of the message queue from which to read a message.
msgp Specifies a pointer to the msgbuf structure that is to receive the message. (See
the NOTES section.)
msgsz Specifies the maximum number of bytes allowed for the received message.
msgtyp Specifies the message type to read from the queue.
msgflg Specifies the following actions:
The action to be taken by the system if there are no msgtyp messages in
the queue.
Whether to truncate the message if its length exceeds the value specified
by msgsz.
Whether the msgp parameter is formatted for 32-bit and 64-bit interoper-
ability. (See the NOTES section for detailed information on how to use
the MSG_32BIT_MTYPE flag and msgbuf structure to allow 32-bit
and 64-bit processes to communicate using one msgbuf structure.)
DESCRIPTION
The msgrcv() function reads a message from the queue associated with the msqid parameter. It
returns the number of bytes in the received message.
The msgp parameter points to a user-defined msgbuf structure. The structure receives the mes-
sage read from the queue.
The msgsz parameter specifies the maximum size allowed for the received message. If the mes-
sage is longer than the value specified by the msgsz parameter, the system takes action based on
the use of the MSG_NOERROR flag in the msgflg parameter.
The msgtyp parameter specifies the message type that the process wants to receive. Possible
values and their results are as follows:
0 (zero) The process receives the message at the head of the queue.
> 0 (positive) The process receives the first message of the requested message type.
527186-023 Hewlett-Packard Company 465