Open System Services System Calls Reference Manual (G06.25+, H06.03+)
msgsnd(2) OSS System Calls Reference Manual
NAME
msgsnd - Sends a message to a message queue
LIBRARY
G-series native OSS processes: /G/system/sysnn/zossksrl
H-series OSS processes: /G/system/zdllnnn/zosskdll
SYNOPSIS
#include <sys/msg.h>
int msgsnd(
int msqid,
const void *msgp,
size_t msgsz,
int msgflg);
PARAMETERS
msqid Specifies the identifier of the message queue in which to place the message. The
identifier is typically returned by a previous call to the msgget() function.
msgp Specifies a pointer to the msgbuf structure that contains the message. (See the
NOTES section.)
msgsz Specifies the size of the data array in the msgbuf structure.
msgflg Specifies the action to be taken by the system if it runs out of internal buffer
space.
DESCRIPTION
The msgsnd() function sends a message to the queue associated with the msqid parameter.
The msgp parameter points to a user-defined msgbuf structure. The structure identifies the mes-
sage type and contains a data array with the message text.
The size of the data array is specified by the msgsz parameter. The msgsz value can be from 0
(zero) through a system-defined maximum.
The msgflg parameter specifies the action that the system should take if either or both of the fol-
lowing are true:
• The current number of bytes in the message queue is equal to msg_qbytes (in the
msqid_ds structure).
• The total number of messages in all message queues is equal to the system-defined limit.
Either of two system actions can be specified, as follows:
• If the IPC_NOWAIT flag is used in the msgflg parameter, the system does not send the
message and returns to the calling process immediately.
• If the IPC_NOWAIT flag is not used in the msgflg parameter, the system suspends the
calling process. The process remains suspended until one of the following occurs:
— The blocking condition is removed. In this case, the system sends 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.
4−42 Hewlett-Packard Company 527186-003