vuoi
o PayPal
tutte le volte che vuoi
msgget - get the message queue identifier
The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group
NAME
msgget - get the message queue identifier
SYNOPSIS
#include <sys/msg.h> int msgget(key_t intkey, msgflg);
DESCRIPTION
The msgget() function returns the message queue identifier associated with the argument key.
A message queue identifier, associated message queue and data structure, see <sys/msg.h>, are created for the argument key if one of the following is true:
- The argument key is equal to IPC_PRIVATE.
- The argument key does not already have a message queue identifier associated with it, and (msgflg & IPC_CREAT) is non-zero.
Upon creation, the data structure associated with the new message queue identifier is initialised as follows: and are set equal to msg_perm.cuid, msg_perm.uid, msg_perm.cgid msg_perm.gid the effective user ID and effective group ID, respectively, of the calling process. The low-order 9 bits of are set equal to
The low-order 9 bits of msg_perm.mode
and msgflg
are set equal to 0. msg_qnum
, msg_lspid
, msg_lrpid
, msg_stime
, and msg_rtime
are set equal to the current time. msg_ctime
is set equal to the system limit. msg_qbytes
RETURN VALUE
Upon successful completion, msgget()
returns a non-negative integer, namely a message queue identifier. Otherwise, it returns -1 and errno
is set to indicate the error.
ERRORS
The msgget()
function will fail if:
- [
EACCES
] A message queue identifier exists for the argument key, but operation permission as specified by the low-order 9 bits ofmsgflg
would not be granted, see IPC.