int msgctl(int msqid,int cmd,struct msqid_ds *buf);
描述
msgctl() 对标识符为 msqid 的消息队列执行由 cmd 指定的控制操作。
msqid_ds 数据结构在 <sys/msg.h> 中定义如下:
struct msqid_ds {
struct ipc_perm msg_perm; /* Ownership and permissions
time_t msg_stime; /* Time of last msgsnd() */
time_t msg_rtime; /* Time of last msgrcv() */
time_t msg_ctime; /* Time of last change */
unsigned long __msg_cbytes; /* Current number of bytes in
queue (non-standard) */
msgqnum_t msg_qnum; /* Current number of messages
in queue */
msglen_t msg_qbytes; /* Maximum number of bytes
allowed in queue */
pid_t msg_lspid; /* PID of last msgsnd() */
pid_t msg_lrpid; /* PID of last msgrcv() */
};
struct msginfo {
int msgpool; /* Size in bytes of buffer pool used
to hold message data; unused */
int msgmap; /* Max. # of entries in message
map; unused */
int msgmax; /* Max. # of bytes that can be
written in a single message */
int msgmnb; /* Max. # of bytes that can be written to
queue; used to initialize msg_qbytes
during queue creation (msgget()) */
int msgmni; /* Max. # of message queues */
int msgssz; /* Message segment size; unused */
int msgtql; /* Max. # of messages on all queues
in system; unused */
unsigned short int msgseg;
/* Max. # of segments; unused */
};