Open System Services System Calls Reference Manual (G06.25+, H06.03+)

msgget(2) OSS System Calls Reference Manual
NAME
msgget - Creates or returns the identier for 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 msgget(
key_t key,
int msgg);
PARAMETERS
key Species the key that identies the message queue. The IPC_PRIVATE key can
be used to ensure the return of a new (unused) message queue identier.
msgflg Species the following creation ag values:
IPC_CREAT If the key does not exist, the msgget() function creates a mes-
sage queue identier using the given key.
IPC_CREAT | IPC_EXCL
If the key already exists, the msgget() function fails and returns
an error notication.
DESCRIPTION
The msgget() function returns the message queue identier for the message queue identied by
the key parameter. If the key parameter already has a message queue identier associated with it
and (msgg & IPC_CREAT) is 0 (zero), that identier is returned.
A new message queue identier and its associated data structure are created when either of the
following is true:
The value of IPC_PRIVATE is used for the key parameter.
The key parameter does not already have a message queue identier associated with it,
and (msgg & IPC_CREAT) is not 0 (zero).
After creating a new message queue identier, the msgget() function initializes the msqid_ds
structure associated with the identier as follows:
The msg_perm.cuid and msg_perm.uid elds are set to the effective user ID of the cal-
ling process.
The msg_perm.cgid and msg_perm.gid elds are set to the effective group ID of the
calling process.
The low-order nine bits of the msg_perm.mode eld are set to the low-order nine bits of
msgg.
The msg_qnum, msg_lspid, msg_lrpid, msg_stime, and msg_rtime elds are all set to
0 (zero).
436 Hewlett-Packard Company 527186-003