msgctl() COHERENT System Call msgctl() Message control operations #include <sys/msg.h> int msgctl(msqid, cmd, buf) int msqid; int cmd; struct msqid_ds *buf; msgctl performs the message-control operations specified by cmd. The following cmds are available: IPC_STAT Place the current value of each member of the data structure associated with msqid into the structure pointed to by buf. IPC_SET Set the value of the following members of the data structure associated with msqid to the corresponding value found in the structure pointed to by buf: msg_perm.uid msg_perm.gid msg_perm.mode /* only low 9 bits */ msg_qbytes This cmd can only be executed by a process that has an effective-user identifier equal to either that of su- peruser or to the value of msg_perm.uid in the data structure associated with msqid. Only superuser can raise the value of msg_qbytes. IPC_RMID Remove the system identifier specified by msqid from the system and destroy the message queue and data structure associated with it. This cmd can only be ex- ecuted by a process that has an effective-user iden- tifier equal to either that of superuser or to the value of msg_perm.uid in the data structure associated with msqid. msgctl fails if any of the following are true: * msqid is not a valid message queue identifier. msgctl sets the global variable errno to EINVAL. * cmd is not a valid command (EINVAL). * cmd is equal to IPC_STAT and operation permission is denied to the calling process (EACCES). * cmd is equal to IPC_RMID or IPC_SET, and the effective-user identifier of the calling process is not equal to that of su- peruser and it is not equal to 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 identifier of the calling process is not equal to that of super user COHERENT Lexicon Page 1
msgctl() COHERENT System Call msgctl() (EPERM). * buf points to an illegal address (EFAULT). ***** Return Value ***** Upon successful completion, msgctl returns zero. If a problem occurs, it returns -1 and sets errno to an appropriate value. ***** Files ***** /usr/include/sys/ipc.h /usr/include/sys/msg.h /dev/msg ***** See Also ***** COHERENT system calls, msg, msgget(), msgrcv(), msgsnd() ***** Notes ***** To improve portability, COHERENT implements the msg functions as a device driver rather than as an actual system call. COHERENT Lexicon Page 2