MSGCTL(S) XENIX System V MSGCTL(S)
Name
msgctl - Provides message control operations.
Syntax
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
int msgctl (msqid, cmd, buf)
int msqid, cmd;
struct msquid_ds *buf;
Description
msgctl provides for message control operations specified by
cmd.
The cmds available are:
IPC_STAT
Places the current value of each member of the data
structure associated with msqid into the structure
pointed to by buf. Contents of this structure are
defined in intro(S).
IPC_SETSets the value of the following members of the data
structure associated with msqid into the structure
pointed to by buf:
msg_perm.uid
msg_perm.gid
msg_perm.mod /* only low 9 bits*/
msg_qbytes
This cmd can only be executed by a process that has an
effective user ID equal to either a super-user or to
the value of msg_perm.uid in the data structure
associated with msqid. Only a super-user can raise
the value of msg_qbytes.
IPC_RMID
Removes the message queue identifier specified by
msqid from the system and destroys the message queue
and data structure associated with it. This cmd can
only be executed by a process that has an effective
user ID equal to either a super-user or to the value
of msg_perm.uid in the data structure associated with
msqid.
msgctl will fail if one or more of the following are true:
msqid is not a valid message queue identifier.
[EINVAL]
Page 1 (printed 8/7/87)
MSGCTL(S) XENIX System V MSGCTL(S)
cmd is not a valid command. [EINVAL]
cmd is equal to IPC_STAT and buf points to an address
in read-only shared data. [EINVAL]
cmd is equal to IPC_STAT and read operation permission
is denied to the calling process (see intro(S)).
[EACCES]
cmd is equal to IPC_RMID or IPC_SET. The effective
user ID of the calling process does not equal that of a
super-user nor does it equal the value of msg_perm.uid
in the data structure associated with msqid. [EPERM]
Cmd is equal to IPC_SET, an attempt is being made to
increase to the value of msg_qbytes, and the effective
user ID of the calling process is not equal to that of
super user.
buf points to an illegal address. [EFAULT]
Return Value
A value of 0 is returned upon successful completion.
Otherwise, -1 is returned and errno is set to indicate the
error.
See Also
intro(S), msgget(S), msgop(S)
Notes
Programs using this function must be compiled with the -Me
compiler option.
Page 2 (printed 8/7/87)