MSGGET
Return the message queue identifier associated with the value of the ecx argument. Arguments
ecx | Key value. This key value is compared to existing key values that exist within the kernel for other message queues. If IPC_PRIVATE is specified for this argument, a new message queue will be created and the system call will ignore everything but the least significant 9 bits of edx.
edx | Operation flags:
`IPC_CREAT` | `Create the queue if it doesn't already exist in the kernel and argument in ecx is not IPC_PRIVATE.`
`IPC_EXCL` | `When used with IPC_CREAT, fail if queue already exists.`
If both IPC_CREAT and IPC_EXCL are specified and a message queue already exists for ecx, then MSGGET fails with -EEXIST. (This is analogous to the effect of the combination "O_CREAT or O_EXCL" for sys_open.) Upon creation, the least significant bits of the argument edx define the permissions of the message queue:
`S_IRUSR - owner has read permission S_IWUSR - owner has write permission S_IRGRP - group has read permission S_IWGRP - group has write permission S_IROTH - others have read permission S_IWOTH - others have write permission`
If a new message queue is created, then its associated data structure msqid_ds (see MSGCTL) is initialised as follows: msg_perm.cuid and msg_perm.uid are set to the effective user ID of the calling process. msg_perm.cgid and msg_perm.gid are set to the effective group ID of the calling process. The least significant 9 bits of msg_perm.mode are set to the least significant 9 bits of msgflg. msg_qnum, msg_lspid, msg_lrpid, msg_stime and msg_rtime are set to 0. msg_ctime is set to the current time. msg_qbytes is set to the system limit MSGMNB. If the message queue already exists the permissions are verified, and a check is made to see if it is marked for destruction.
Return values If the function succeeds the return value is a message queue identifier (a nonnegative integer). If the function fails the return value is one of the following errno values:
`-EACCES` | `A message queue exists for ecx, but the calling process does not have permission to access the queue, and does not have the CAP_IPC_OWNER capability.`
`-EEXIST` | `A message queue exists for ecx and edx specified both IPC_CREAT and IPC_EXCL.`
`-ENOENT` | `No message queue exists for ecx and edx did not specify IPC_CREAT.`
`-ENOMEM` | `message queue has to be created but the system does not have enough memory for the new data structure.`
`-ENOSPC` | `A message queue has to be created but the system limit for the maximum number of message queues (MSGMNI) would be exceeded.`
Remarks The following is a system limit on message queue resources affecting a MSGGET call: MSGMNI - System wide maximum number of message queues: policy dependent (this limit can be read and modified via /proc/sys/kernel/msgmni). See /samples/ipc/msg.asm for an example.