msgctl(2) DG/UX 4.30 msgctl(2)
NAME
msgctl - Get or set message queue attributes or destroy a
message queue.
SYNOPSIS
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
int msgctl (msqid, cmd, buf)
int msqid;
int cmd;
struct msqid_ds * buf;
PARAMETERS
msqid A message queue identifier.
cmd The message control operation to be
performed.
buf The address of a message queue attribute
record. Used only if <cmd> is IPC_STAT or
IPC_SET.
DESCRIPTION
Msgctl is used to get and set message queue attributes or to
destroy a message queue. The subject message queue is
identified by <msqid>. The action performed by msgctl
depends on the value of <cmd> as follows:
IPC_STAT
The user-visible msqid_ds structure is returned in
<buf>.
If an error occurs, the contents of <buf> are undefined.
IPC_SET
The following message queue attributes are set to the
values found in the structure pointed to by <buf>: user
id (msg_perm.uid), group id (msg_perm.gid), permission
rights (in msg_perm.mode), and the maximum size
(msg_qbytes).
If an error occurs, the message queue remains unchanged.
Otherwise, the last change time (msg_ctime) is set to the
current time.
Licensed material--property of copyright holder(s) Page 1
msgctl(2) DG/UX 4.30 msgctl(2)
IPC_RMID
The message queue is destroyed. All resources consumed
by the message queue are freed and the message queue
identifier is invalidated. All queued messages are
lost.
If an error occurs, the message queue remains unchanged.
ACCESS CONTROL
Operation permission depends on the value of <cmd> as
follows:
IPC_STAT
The calling process is required to have read access to
the message queue.
IPC_SET
The effective user id of the calling process must be
equal to the message queue's user id, the message queue
creator's user id, or that of the superuser. If the
maximum size of the message queue is increased, the
effective user id of the calling process must be the
superuser.
IPC_RMID
The effective user id of the calling process must be
equal to the message queue's user id, the message queue
creator's user id, or that of the superuser.
RETURN VALUE
0 Completed successfully.
-1 An error occurred. Errno is set to indicate
the error.
EXCEPTIONS
Errno may be set to one of the following error codes
regardless of the value of <cmd>:
EINVAL <msqid> is not a valid message queue
identifier.
EINVAL <Cmd> is not a valid command.
If <cmd> is IPC_STAT, errno may be set to one of these
values:
Licensed material--property of copyright holder(s) Page 2
msgctl(2) DG/UX 4.30 msgctl(2)
EACCES Read permission is denied to the calling
process.
EFAULT <buf> points to an illegal address.
If <cmd> is IPC_SET, errno may be set to one of these
values:
EPERM Permission to change the message queue
attributes is denied to the calling process.
EPERM Permission to increase to the maximum size of
the message queue is denied to the calling
process.
EFAULT <buf> points to an illegal address.
If <cmd> is IPC_RMID, errno may be set to this value:
EPERM Permission to remove the message queue is
denied to the calling process.
SEE ALSO
intro(2), ipcrm(1), ipcs(1), msgget(2), msgrcv(2),
msgsnd(2).
Licensed material--property of copyright holder(s) Page 3