msgget(PCI) 6 January 1993 msgget(PCI) Name msgget - get message queue Syntax #include <pcilib.h> #include <memmdl.h> #include <ipc.h> int msgget (key, msgflg) key_t key; int msgflg; Description msgget returns the message queue identifier associated with key from the UNIX operating system host specified in the most recent dflthost call. A message queue identifier and associated message queue and data struc- ture (see Intro(PCI)) are created for key if one of the following is true: key is equal to IPCPRIVATE. key does not already have a message queue identifier associated with it, and (msgflg & IPCCREAT) is "true." Upon creation, the data structure associated with the new message queue identifier is initialized as follows: Msgperm.cuid, msgperm.uid, msgperm.cgid, and msgperm.gid are set to the effective user ID and effective group IDs, respectively, of the calling process. The low-order nine bits of msgperm.mode are set equal to the low-order nine bits of msgflg. msgqnum, msglspid, msglrpid, msgstime, and msgrtime are set to 0. msgctime is set to the current UNIX operating system time. msgqbytes is set to the UNIX operating system limit. msgget fails if one or more of the following are true: [EACCES] A message queue identifier exists for key, but operation per- mission (see Intro(PCI)) as specified by the low-order nine bits of msgflg would not be granted. [ENOENT] A message queue identifier does not exist for key, and (msgflg & IPCCREAT) is "false." [ENOSPC] A message queue identifier is to be created, but the number of message queue identifiers would exceed the system maximum allowed for that host. [EEXIST] A message queue identifier exists for key, but (msgflg & IPCCREAT) & (msgflg & IPCEXCL) is "true." Return value On successful completion, a message queue identifier is returned. Other- wise, a value of -1 returns and errno is set to indicate the error. See also dflthost(PCI), Intro(PCI), msgctl(PCI), msgrcv(PCI), msgsnd(PCI)