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

msgsnd(2) OSS System Calls Reference Manual
If the IPC_NOWAIT flag is not used in the msgflg parameter the system runs out of
internal buffer space, 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.
The process catches a signal. In this case, the message is not sent and the process
resumes execution as directed by a sigaction() function call.
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.)
If the msgsnd() function finishes successfully, the system updates the msqid_ds structure associ-
ated with the msqid parameter. Specifically, it does the following:
Increments the value in the msg_qnum field by 1.
Increments the value in the msg_cbytes field by the message text size.
Sets the msg_lspid field to the OSS process ID of the calling process.
Sets the msg_stime eld to the current time.
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 can be defined as follows:
struct msgbuf {
long int mtype;
char mtext[ ];
};
The mtype field is a user-chosen positive integer that represents the message type. A receiving
process can use the message type to select only those messages it wants to receive from the
queue. (See the msgrcv(2) reference page.)
The mtext field contains any text of the length specified by the msgsz parameter.
However, the data type for the mtype field (long int) is a problem when 64-bit processes send
and receive messages with 32-bit processes because the length of the field varies depending on
whether the caller is a 32-bit or 64-bit process. This field is 32 bits for 32-bit processes and 64
bits for 64-bit processes.
Because the msgbuf structure is user supplied, it is the application’s responsibility to handle the
differences in data types between 32-bit and 64-bit senders and receivers. For example, suppose a
470 Hewlett-Packard Company 527186-023