msg.h 文件
用途
描述用于执行消息排队操作的子例程所使用的结构。
语法
#include <sys/msg.h>
描述
msg.h 文件定义以下符号常量,类型和结构:
类型:
unsigned int msgqnum_t;
unsigned int msglen_t;
符号常量:
项 | 描述 |
---|---|
MSG_NOERROR | 如果大消息 */ |
MSG_R | 读许可权 */ |
MSG_W | 写许可权 */ |
MSG_RWAIT | 读程序正在等待消息 */ |
MSG_WWAIT | 写程序正在等待发送 */ |
MSG_STAT | 要为 IPC_STAT 命令复制的字节数 |
MSGXBUFSIZE | 除了 mtext [1] 和 padding |
MSG_SYSSPACE | 对于 rmsgsnd () 标志 |
XMSG | 对于 rmsgrcv () 标志 |
对于系统中的每个 q ,有一个消息队列标识数据结构。 msqid_ds 结构中包含以下成员:
struct ipc_perm msg_perm; operation permission
struct
void *__msg_first; ptr to first message on q
void *__msg_last; ptr to last message on q
unsigned int __msg_cbytes; current # bytes on q
msgqnum_t msg_qnum; # of messages on q
msglen_t msg_qbytes; max # of bytes on q
pid_t msg_lspid; pid of last msgsnd
pid_t msg_lrpid; pid of last msgrcv
time_t msg_stime; last msgsnd time
time_t msg_rtime; last msgrcv time
time_t msg_ctime; last change time
int __msg_rwait; wait list for message
receive
int __msg_wwait; wait list for message send
unsigned short __msg_reqevents; select/poll requested
events
姆斯格赫德尔 结构中包含以下成员:
time_t mtime; time message was sent
uid_t muid; author's effective uid
gid_t mgid; author's effective gid
pid_t mpid; author's process id
mtyp_t mtype; message type
对于系统中可能存在的每条消息,都有一个消息结构。 该消息结构包含以下成员:
struct msg *msg_next; ptr to next message on q
struct msg_hdr msg_attr; message attributes
unsigned int msg_ts; message text size
char *msg_spot; pointer to message text
结构 姆格布夫 是用于 消息 和 姆斯格尔茨夫 系统调用的用户消息缓冲区模板,并且包含以下成员:
mtyp_t mtype; message type
char mtext[1]; message text
msgxbuf 结构是用于 msgxrcv 系统调用的用户消息缓冲区模板,并且包含以下成员:
time_t mtime; time message was sent
uid_t muid; author's effective uid
gid_t mgid; author's effective gid
pid_t mpid; author's process id
mtyp_t mtype; Message type
char mtext[1]; Message text
消息信息 结构中包含以下成员:
int msgmax, max message size
int msgmnb, max # bytes on queue
int msgmni, # of message queue identifiers
int msgmnm; max # messages per queue identifier
时间 (t), 大小, off_t, mtyp_t, 皮德特和 吉代特 类型如 <sys/types.h>中所定义。
以下内容声明为函数:
int msgget(key_t, int);
int msgrcv(int, void *, size_t, long, int);
int msgsnd(int, const void *, size_t, int);
int msgctl(int, int, struct msqid_ds *);
int msgxrcv(int, struct msgxbuf*, int, long, int);
此外,将在包含此头时定义 <sys/ipc.h> 中的所有符号。