Go to the previous, next section.

msgget

SYNOPSIS

int msgget(key_t key, int msgflg);

PARAMETERS

key: [in] the message queue identifier to get.

msgflg: [in] some flags (see description).

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
creates a new queue for the key if it does not already exist.

IPC_EXCL
if there is already a existing queue associated with key, the call fails.

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.

RETURN VALUE

On success, the call returns the new queue identificator. On error -1 is returned and errno is set to one of the following values:

Go to the previous, next section.