msgctl(2)
_________________________________________________________________
msgctl System Call
Get or set message queue attributes or destroy a message queue.
_________________________________________________________________
SYNTAX
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
int msgctl (id, command, status_buffer)
int id;
int command;
struct msqid_ds * status_buffer;
PARAMETERS
id A message queue identifier.
command The message control operation to be performed.
status_buffer The address of a message queue attribute record.
Used only if <command> is IPC_STAT or IPC_GET.
DESCRIPTION
Msgctl is used to get and set message queue attributes or to
destroy a message queue. The subject message queue is identified
by <id>. The action performed by msgctl depends on the value of
<command> as follows:
IPC_STAT
The user-visible msqid_ds structure is returned in
<status_buffer>.
If an error occurs, the contents of <status_buffer> are
undefined.
IPC_SET
The following message queue attributes are set to the values
found in the structure pointed to by <status_buffer>: user
id (msg_perm.uid), group id (msg_perm.gid), permission
rights (in msg_perm.mode), and the maximum size
DG/UX 4.00 Page 1
Licensed material--property of copyright holder(s)
msgctl(2)
(msg_qbytes).
If an error occurs, the message queue remains unchanged.
Otherwise, the last change time (msg_ctime) is set to the current
time.
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 <command> 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 <command>:
DG/UX 4.00 Page 2
Licensed material--property of copyright holder(s)
msgctl(2)
EINVAL <id> is not a valid message queue identifier.
EINVAL <Command> is not a valid command.
If <command> is IPC_STAT, errno may be set to one of these
values:
EACCES Read permission is denied to the calling process.
EFAULT <Status_buffer> points to an illegal address.
If <command> 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 <Status_buffer> points to an illegal address.
If <command> 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
The related system calls: msgget, msgrcv, msgsnd.
The related manual section: intro(2).
DG/UX 4.00 Page 3
Licensed material--property of copyright holder(s)