Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ msgget(3) — AIX PS/2 1.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

msgctl

msgrcv

msgsnd

msgxrcv

stdipc: ftok



MSGGET(3,L)                 AIX Technical Reference                 MSGGET(3,L)



-------------------------------------------------------------------------------
msgget



PURPOSE

Gets a message queue identifier.

LIBRARY

Standard C Library (libc.a)

SYNTAX

#include <sys/stat.h>
#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 the
specified key.  The key parameter is either the value IPC_PRIVATE or an IPC key
constructed by the ftok subroutine (or by a similar algorithm).  See "stdipc:
ftok" for details about this subroutine.

The msgflg parameter is constructed by logically ORing one or more of the
following values:

IPC_CREAT   Creates the data structure if it does not already exist.
IPC_EXCL    Causes the msgget system call to fail if IPC_CREAT is also set and
            the data structure already exists.
S_IRUSR     Permits the process that owns the data structure to read it.
S_IWUSR     Permits the process that owns the data structure to modify it.
S_IRGRP     Permits the group associated with the data structure to read it.
S_IWGRP     Permits the group associated with the data structure to modify it.
S_IROTH     Permits others to read the data structure.
S_IWOTH     Permits others to modify the data structure.

The values that begin with S_I- are defined in the sys/stat.h header file and
are a subset of the access permissions that apply to files.

A message queue identifier and associated message queue and data structure are
created for the value of the key parameter if one of the following are true:

  o key is equal to IPC_PRIVATE.




Processed November 7, 1990        MSGGET(3,L)                                 1





MSGGET(3,L)                 AIX Technical Reference                 MSGGET(3,L)



  o key does not already have a message queue identifier associated with it,
    and IPC_CREAT is set.

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

  o msg_perm.cuid, msg_perm.uid, msg_perm.cgid, and msg_perm.gid are set equal
    to the effective user ID and effective group ID, respectively, of the
    calling process.

  o The low-order nine bits of msg_perm.mode are set equal to the low-order
    nine bits of the msgflg parameter.

  o msg_qnum, msg_lspid, msg_lrpid, msg_stime, and msg_rtime are set equal to
    0.

  o msg_ctime is set equal to the current time.

  o msg_qbytes is set equal to the system limit.

Warning:  If the Transparent Computing Facility is installed, a message queue
exists only on the cluster site on which the queue was created.  There is no
provision for accessing a message queue on a remote cluster site.
Consequently, processes that use message queues cannot be migrated to other
sites.

RETURN VALUE

Upon successful completion, a message queue identifier is returned.  If the
msgget system call fails, a value of -1 is returned and errno is set to
indicate the error.

ERROR CONDITIONS

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

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

ENOENT    A message queue identifier does not exist for the key parameter and
          IPC_CREAT is not set.

ENOSPC    A message queue identifier is to be created but the system imposed
          limit on the maximum number of allowed message queue identifiers
          system wide would be exceeded.

EEXIST    A message queue identifier exists for key, and both IPC_CREAT and
          IPC_EXCL are set.

RELATED INFORMATION




Processed November 7, 1990        MSGGET(3,L)                                 2





MSGGET(3x,L)                AIX Technical Reference                MSGGET(3x,L)



In this book:  "msgctl," "msgrcv," "msgsnd,"  "msgxrcv," and "stdipc: ftok."






















































Processed November 7, 1990       MSGGET(3x,L)                                 3



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