

msgget()               COHERENT System Call              msgget()




Get message queue

#include <sys/msg.h>
mmssggggeett(_k_e_y, _m_s_g_f_l_g)
kkeeyy_tt _k_e_y; iinntt _m_s_g_f_l_g;

msgget returns the  message queue identifier associated with key,
should it exist.  If key has no message queue associated with it,
msgget checks  whether (_m_s_g_f_l_g  & IIPPCC_CCRREEAATT)  is true; if  it is,
then  msgget creates  a message  queue identifier  and associated
message queue and data structure for _k_e_y.

Upon creation, the data structure associated with the new message
queue identifier is initialized as follows:

*  msg_perm.cuid,  msg_perm.uid, msg_perm.cgid,  and msg_perm.gid
   are set  to, respectively,  the effective user  identifier and
   effective group identifier of the calling process.

*  The  low-order nine bits of msg_perm.mode are  set to the low-
   order nine bits of msgflg.  These nine bits define access per-
   missions: the  top three bits specify  the owner's access per-
   missions (read, write, execute), the middle three bits specify
   the owning group's  access permissions, and the low three bits
   specify access permissions for others.

*  msg_ctime is set to the current time.

*  msg_qbytes is set equal to the system limit, as defined by the
   kernel variable NMSQB.

msgget fails  if any of  the following is true.   The term within
parentheses  gives  the  value to  which  msgget  sets errno,  as
defined in the header file errno.h:

*  A  message queue identifier exists for  key but operation per-
   mission  as specified  by the  low-order  nine bits  of msgflg
   would not be granted (EEAACCCCEESS).

*  A message queue identifier  does not exist for key and (_m_s_g_f_l_g
   & IIPPCC_CCRREEAATT) is false (EENNOOEENNTT).

*  A message queue identifier is  to be created but the number of
   message queue identifiers system-wide exceeds the system limit
   as specified in the kernel variable NMSQID (EENNOOSSPPCC).

*   A message  queue identifier  exists for  key, but  ((_m_s_g_f_l_g &
   IIPPCC_CCRREEAATT) && (_m_s_g_f_l_g & IIPPCC_EEXXCCLL)) is true (EEEEXXIISSTT).

***** Return Value *****

Upon  successful  completion,  msgget returns  the  message-queue
identifier, which  is always a  non-negative integer.  Otherwise,
it returns -1 and sets eerrrrnnoo to an appropriate value.


COHERENT Lexicon                                           Page 1




msgget()               COHERENT System Call              msgget()




***** Files *****

/usr/include/sys/ipc.h
/usr/include/sys/msg.h
/dev/msg

***** See Also *****

COHERENT system calls, msg, msgctl(), msgrcv(), msgsnd()

***** Notes *****

To  improve  portability, the  mmssgg  functions  are presently  im-
plemented  as a  device driver  rather than  as an  actual system
call.









































COHERENT Lexicon                                           Page 2


