Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ msgget(S) — OpenDesktop Software Development System 3.0.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

Intro(S)

msgctl(S)

msgop(S)


 msgget(S)                      6 January 1993                      msgget(S)


 Name

    msgget - get message queue

 Syntax


    cc ... -lc


    #include <sys/types.h>
    #include <sys/ipc.h>
    #include <sys/msg.h>

    int msgget (key, msgflg)
    key_t key;
    int msgflg;


 Description

    The msgget system call returns the message queue identifier associated
    with key.

    A message queue identifier and associated message queue and data struc-
    ture are created for key if one of the following is true:

       The key argument is equal to IPCPRIVATE.

       The key argument 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
       equal to the effective user ID and effective group ID, respectively,
       of the calling process.

       The low-order 9 bits of msgperm.mode are set equal to the low-order 9
       bits of msgflg.

       msgqnum, msglspid, msglrpid, msgstime, and msgrtime are set equal
       to 0.

       msgctime is set equal to the current time.

       msgqbytes is set equal to the system limit.

    The msgget system call fails if one or more of the following is true:

    [EACCES]       A message queue identifier exists for key, but operation
                   permission as specified by the low-order 9 bits of msgflg
                   would not be granted.

    [EEXIST]       A message queue identifier exists for key but [(msgflg &
                   IPCCREAT) & (msgflg & IPCEXCL)] is ``true''.

    [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
                   system-imposed limit on the maximum number of allowed mes-
                   sage queue identifiers system wide would be exceeded.

 Diagnostics

    Upon successful completion, a non-negative integer, namely a message
    queue identifier, is returned.  Otherwise, a value of -1 is returned, and
    errno is set to indicate the error.

 See also

    Intro(S), msgctl(S), msgop(S)

 Standards conformance

    msgget is conformant with:
    AT&T SVID Issue 2;
    and X/Open Portability Guide, Issue 3, 1989.


Typewritten Software • bear@typewritten.org • Edmonds, WA 98026