![](https://csdnimg.cn/release/download_crawler_static/87957243/bg9.jpg)
4 LINUX 的消息函数各个子模块相关函数代码分析结果
4.1 有关常量及相关错误信息的含义:
4.1.1 常量含义:
static struct msqid_ds *msgque[MSGMNI]; //消息队列
static int msgbytes = 0; //消息队列中所有消息的总字节数
static int msghdrs = 0; //消息队列的队头
static unsigned short msg_seq = 0;
static int used_queues = 0; //已用的消息队列数
static int max_msqid = 0; //消息队列最大的 ID 值
static struct wait_queue *msg_lock = NULL; //消息队列锁定,不让等待进
程进入
4.1.2 相关错误信息的含义:
EINVAL 22 /* Invalid argument */
EFAULT 14 /* Bad address */
EIDRM 43 /* Identifier removed */
EACCES 13 /* Permission denied */
EAGAIN 11 /* Try again */
EINTR 4 /* Interrupted system call */
ENOMEM 12 /* Out of memory */
E2BIG 7 /* Arg list too long */
ENOMSG 42 /* No message of desired type */
ENOSPC 28 /* No space left on device */
ENOMEM 12 /* Out of memory */
EPERM 1 /* Operation not permitted */
ENOENT 2 /* No such file or directory */
EEXIST 17 /* File exists */
4.1.3 相关函数及文件首部含义:
struct msg_receiver {
struct list_head r_list; /* 等待接收者进程列表*/
struct task_struct* r_tsk; /*任务列表*/
int r_mode; /* 接收模式*/
long r_msgtype; /* 等待的消息模型*/
long r_maxsize; /* 最大大小*/