msgget()

get message queue 

Function


SYNOPSIS

#include <sys/msg.h>

int msgget(key_t key, int msgflg);


DESCRIPTION

The msgget() function returns the message queue identifier associated with key. A message queue identifier and an associated message queue and data structure are created if key is equal to IPC_PRIVATE, or key does not already have a message queue identifier associated with it and (msgflg & IPC_CREAT) is non-zero.

When created, the data structure associated with the new message queue identifier is initialized in the following way:


PARAMETERS

key 

Specifies the message queue key for which to retrieve the msqid.

msgflg 

Is a flag that indicates specific message queue conditions and options to implement.


RETURN VALUES

If successful, msgget() returns a message queue identifier. On failure, msgget() returns a value of -1 and sets errno to indicate the error:

EACCES 

A message queue identifier exists for key, but operation permission as specified by permission bits of msgflg would not be granted.

EEXIST 

A message queue identifier exists for key, but both (msgflg & IPC_CREAT) and (msgflg & IPC_EXCL) are both non-zero.

ENOENT 

A message queue identifier does not exist for key and (msgflg & IPC_CREAT) is zero.

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.


CONFORMANCE

Unix 98.


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

None.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
ftok(), msgctl(), msgrcv(), msgsnd()


PTC MKS Toolkit 10.4 Documentation Build 39.