GNU Info

Info Node: (ipc.info)msgget

(ipc.info)msgget


Next: msgsnd Prev: Messages Up: Messages
Enter node , (file) or (file)node

msgget
------

A message queue is allocated by a msgget system call :

     msqid = msgget (key_t key, int msgflg);

   * `key': an integer usually got from `ftok()' or IPC_PRIVATE.

   * `msgflg':
          IPC_CREAT : used to create a new resource if it does not
          already exist.

          IPC_EXCL | IPC_CREAT : used to ensure failure of the call if
          the resource already exists.

          rwxrwxrwx : access permissions.

   * returns: msqid (an integer used for all further access) on success.
     -1 on failure.

   A message queue is allocated if there is no resource corresponding
to the given key. The access permissions specified are then copied into
the `msg_perm' struct and the fields in `msqid_ds' initialized. The
user must use the IPC_CREAT flag or key = IPC_PRIVATE, if a new
instance is to be allocated. If a resource corresponding to KEY already
exists, the access permissions are verified.

Errors:
EACCES : (procure) Do not have permission for requested access.
EEXIST : (allocate) IPC_CREAT | IPC_EXCL specified and resource exists.
EIDRM  : (procure) The resource was removed.
ENOSPC : All id's are taken (max of MSGMNI id's system-wide).
ENOENT : Resource does not exist and IPC_CREAT not specified.
ENOMEM : A new `msqid_ds' was to be created but ... nomem.


automatically generated by info2www version 1.2.2.9