Chinaunix首页 | 论坛 | 博客
  • 博客访问: 399725
  • 博文数量: 78
  • 博客积分: 3642
  • 博客等级: 中校
  • 技术积分: 695
  • 用 户 组: 普通用户
  • 注册时间: 2006-10-23 15:33
文章分类

全部博文(78)

文章存档

2007年(53)

2006年(25)

分类: C/C++

2007-10-12 13:15:52

程序在执行msgsnd时出错:
invalid argument

man msgsnd
对EINVAL错误的解释是:

 EINVAL The value of msqid is not a valid message queue identifier,  or
          the  value  of  mtype  is less than 1; or the value of msgsz is
          less than 0 or greater than the system-imposed limit.

忘了检查msgget的返回值了,果然错误在msgget这里:
msgsnd invalid argument

man msgget
对ENOSPC错误的解释是:
 ENOSPC A message queue identifier is to be  created  but     the  system-
          imposed  limit  on  the maximum number of allowed message queue
          identifiers system-wide would be exceeded.

msgmni的缺省值为16,也就是系统内部缺省最多可以存在16个消息队列.重新配置内核参数:
echo 64 > /proc/sys/kernel/msgmni
在/etc/sysctl.conf添加一行:
kernel.msgmni = 64

再运行刚才的程序就OK了.
阅读(3106) | 评论(0) | 转发(0) |
0

上一篇:输出缓冲区

下一篇:没有了

给主人留下些什么吧!~~