msgctl(2) msgctl(2)
NAME
msgctl - provide message control operations
SYNOPSIS
#include <sys/msg.h>
int msgctl(int msqid, int cmd, ... struct msqidds *buf );
DESCRIPTION
msgctl() provides message control operations as specified by cmd. The
following cmd control operations are available:
IPCSTAT Places the current value of each member of the data struc-
ture associated with msqid into the structure pointed to by
buf. The contents of this structure are defined in the
introduction to the function descriptions.
IPCSET Sets the value of the following members of the data struc-
ture associated with msqid to the corresponding value from
the structure pointed to by buf:
msgperm.uid
msgperm.gid
msgperm.mode /* only least significant 9 bits */
msgqbytes
This function can only be executed by a process that has an
effective user ID equal to either that of superuser, or to
the value of msgperm.cuid or msgperm.uid in the data
structure associated with msqid. Only superuser can raise
the value of msgqbytes.
IPCRMID Removes the message queue identifier specified by msqid
from the system and destroys the message queue and data
structure associated with it. This function can only be
executed by a process that has an effective user ID equal
to either that of superuser, or to the value of
msgperm.cuid or msgperm.uid in the data structure associ-
ated with msqid.
msgctl() fails if one or more of the following apply:
EACCES cmd is IPCSTAT and operation permission is denied to the
calling process.
EFAULT buf points to an illegal address.
EINVAL msqid is not a valid message queue identifier.
EINVAL cmd is not a valid control operation.
Page 1 Reliant UNIX 5.44 Printed 11/98
msgctl(2) msgctl(2)
EINVAL cmd is IPCSET and msgperm.uid or msgperm.gid is not
valid.
EOVERFLOW cmd is IPCSTAT and uid or gid is too large to be stored in
the structure pointed to by buf.
EPERM cmd is IPCRMID or IPCSET. The effective user ID of the
calling process is not that of superuser, or the value of
msgperm.cuid or msgperm.uid in the data structure associ-
ated with msqid.
EPERM cmd is IPCSET, an attempt is being made to increase to the
value of msgqbytes, and the effective user ID of the cal-
ling process is not that of superuser.
RESULT
Upon successful completion, a value of 0 is returned. Otherwise, a
value of -1 is returned and errno is set to indicate the error.
SEE ALSO
msgget(2), msgop(2).
Page 2 Reliant UNIX 5.44 Printed 11/98