Provides message control operations.
Standard C Library (libc.a)
#include <sys/msg.h>
int msgctl (MessageQueueID,Command,Buffer)
int MessageQueueID, Command;
struct msqid_ds * Buffer;
The msgctl subroutine provides a variety of message control operations as specified by the Command parameter and stored in the structure pointed to by the Buffer parameter. The msqid_ds structure is defined in the sys/msg.h file.
The following limits apply to the message queue:
Item | Description |
---|---|
MessageQueueID | Specifies the message queue identifier. |
Command | The following values for the Command parameter are
available:
|
Buffer | Points to a msqid_ds structure. |
Upon successful completion, the msgctl subroutine returns a value of 0. Otherwise, a value of -1 is returned and the errno global variable is set to indicate the error.
The msgctl subroutine is unsuccessful if any of the following conditions is true:
Item | Description |
---|---|
EINVAL | The Command or MessageQueueID parameter is not valid. |
EACCES | The Command parameter is equal to the IPC_STAT value, and the calling process was denied read permission. |
EPERM | The Command parameter is equal to the IPC_RMID value and the effective user ID of the calling process does not have root user authority. Or, the Command parameter is equal to the IPC_SET value, and the effective user ID of the calling process is not equal to the value of the msg_perm.uid field or the msg_perm.cuid field in the data structure associated with the MessageQueueID parameter. |
EPERM | The Command parameter is equal to the IPC_SET value, an attempt was made to increase the value of the msg_qbytes field, and the effective user ID of the calling process does not have root user authority. |
EFAULT | The Buffer parameter points outside of the process address space. |