daxiguagg 发表于 2013-09-18 10:40

posix消息队列问题???

    mqd_t mqd;
    struct mq_attr mqa;
    mqd=mq_open("/messagetest",O_RDWR | O_CREAT,0644,NULL);
    memset(&mqa,0,sizeof(struct mq_attr));
    mqa.mq_maxmsg=10000;
    mqa.mq_msgsize=8192;
    mq_setattr(mqd,&mqa,&omqa);

想设置消息队列最大消息数,设置不成功,难道消息队列最大消息数就只有10????

井蛙夏虫 发表于 2013-09-18 12:01

回复 1# daxiguagg man mq_setattr我的系统上:The mq_maxmsg and mq_msgsize fields are set when the message queue is created by mq_open(3).

mq_setattr() sets message queue attributes using information supplied in the mq_attr structure pointed to by newattr.The only attribute that can be modified is the setting of the O_NONBLOCKflag in mq_flags.The other fields in newattr are ignored.

myworkstation 发表于 2013-09-18 14:22

回复 1# daxiguagg


    改一下系统限制,默认限止最大为10,你设置的值不能大于系统的限止
   cat/proc/sys/fs/mqueue/msg_max

daxiguagg 发表于 2013-09-19 19:47

怎么改这个限制?改哪里?
页: [1]
查看完整版本: posix消息队列问题???