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

msgrcv(2) OSS System Calls Reference Manual
< 0 (negative) The process receives the first message of the lowest type on the queue. To qual-
ify as the lowest type, a message’s type must be less than or equal to the absolute
value of the msgtyp parameter.
The msgflg parameter specifies actions that the system should take:
If the IPC_NOWAIT flag is used and the queue does not contain a message of the
requested type, the function call returns immediately with the value -1 and errno is set to
[ENOMSG].
If the IPC_NOWAIT flag is not used and the queue does not contain a message of the
requested type, the system suspends the calling process. The process remains suspended
until one of the following occurs:
A message of the requested type appears in the queue. In this case, the system
wakes the process to receive the message.
The specified message queue identifier is removed from the system. In this case,
the system sets errno to [EIDRM] and returns the value -1 to the calling process.
The process catches a signal. In this case, the process does not receive the mes-
sage; instead, it resumes execution as directed by a sigaction() function call.
If the MSG_NOERROR flag is used and the message is longer than the value specified
by the msgsz parameter, the system truncates the message to msgsz bytes and discards
the truncated portion without notifying the calling process.
If the MSG_NOERROR flag is not used and the message is longer than the value
specified by the msgsz parameter, the system returns an errno value of [E2BIG] to the
calling process and leaves the message in the queue.
If the MSG_32BIT_MTYPE ag is logically ORed with msgflg and the caller is a 64-bit
process, the function assumes the mtype field in the struct msgbuf pointed to by msgp is
of type int instead of type long. (See the NOTES section for detailed information on
how to use the MSG_32BIT_MTYPE ag and msgbuf structure to allow 32-bit and
64-bit processes to communicate using one msgbuf structure.)
If the MSG_32BIT_MTYPE ag is not present, the function assumes the mtype field in
the struct msgbuf pointed to by msgp is of type long int. (The type long int is a different
size for 32-bit processes and 64-bit processes.)
Message Queue Use Between Environments
Guardian processes cannot use OSS functions to access OSS message queues. If called from a
Guardian process, the function call fails and errno is set to [ENOTOSS].
NOTES
The IPC_NOWAIT flag is defined in the sys/ipc.h header file.
The user-supplied msgbuf structure, used to store received messages, can be defined as follows:
struct msgbuf {
long int mtype;
char mtext[ ];
};
The mtype field is set to the message type assigned by the sender.
The mtext field is set to the message text. The message size is less than or equal to the value of
the msgsz parameter specified in the last successful call to msgrcv().
466 Hewlett-Packard Company 527186-023