Go to the previous, next section.
int msgget(key_t key, int msgflg);
key: [in] the message queue identifier to get.
msgflg: [in] some flags (see description).
Gets a message queue identifier. If key is IPC_PRIVATE
, a
new queue is created, otherwise the result depends on msgflg. The
possible values for msgflg are:
IPC_CREAT
IPC_EXCL
The 9 lower bits of msgflg specify the permission bits of the new queue. They have the same layout and meaning as those for files. However, the execute permissions are meaningless for queues.
When creating a queue the system sets the appropriate parameters in the
msqid_ds
structure associated with the new queue. When accessing
an already existing queue, the system simply check if the queue can be
accessed.
On success, the call returns the new queue identificator. On error -1 is
returned and errno
is set to one of the following values:
EACCESS
: the task has no access permission to the queue.
EEXIST
: IPC_CREAT
and IPC_EXCL
were specified
and the queue already exists.
EIDRM
: the message queue no longer exists in the system.
ENOENT
: the message queue never existed.
ENOSPC
: the maximum number of message queues for the system
has been reached.
ENOMEM
Go to the previous, next section.