MSGGET(S) XENIX System V MSGGET(S)
Name
msgget - Gets message queue.
Syntax
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
int msgget (key, msgflg)
key_t key;
int msgflg;
Description
msgget returns the message queue identifier associated with
key.
A message queue identifier, an associated message queue, and
data structure (see intro(S)) are created for key if one of
the following is true:
key is equal to IPC_PRIVATE .
key does not already have a message queue identifier
associated with it, and (msgflg & IPC_CREAT ) is
``true''.
Values for the data structure associated with the new
message queue identifier are initialized as follows:
msg_perm.cuid and msg_perm.uid are set equal to the
effective user ID of the calling process.
msg_perm.cgid and msg_perm.gid are set equal to the
effective group ID of the calling process.
The low-order 9 bits of msg_perm.mode are set equal to
the low-order 9 bits of msgflg.
msg_qnum,msg_lspid,msg_lrpid, and msg_rtime are set
equal to 0.
msg_ctime is set equal to the current time.
msg_qbytes is set equal to the system limit.
msgget fails if one or more of the following is true:
A message queue identifier exists for key; however,
operation permission as specified by the low-order 9
bits of msgflg would not be granted (see intro(S)).
[EACCES]
A message queue identifier does not exist for key and
Page 1 (printed 8/7/87)
MSGGET(S) XENIX System V MSGGET(S)
(msgflg & IPC_CREAT ) is ``false''. [ENOENT]
A message queue identifier would be created but the
system-imposed limit on the maximum number of allowed
message queue identifiers for the system would be
exceeded. [ENOSPC]
A message queue identifier exists for the key but (
(msgflg & IPC_CREAT ) & (msgflg && IPC_EXCL ) ) is
``true''. [EEXIST]
Return Value
Upon successful completion, the message queue identifier is
returned. This is a non-negative integer. Otherwise, a
value of -1 is returned and errno is set to indicate the
error.
See Also
intro(S), msgctl(S), msgop(S).
Notes
Programs using this function must be compiled with the -Me
compiler option.
Page 2 (printed 8/7/87)