简体   繁体   English

消息队列ENOMEM

[英]message queue ENOMEM

I am having an issue with mq_open in C where it tries to create a queue but i'm getting the following error ENOMEM. 我在C中尝试创建队列的mq_open遇到问题,但出现以下错误ENOMEM。 I feel that i may have tried to create to many queues without unlinking them and now i have exceeded the number of allowed. 我觉得我可能已尝试创建多个队列而不断开链接,但现在我已超出允许的数量。 Is there way display and remove theses queues? 有没有办法显示和删除这些队列? This seems to persist even after the application has been closed with all subsequent attempts at create also failing. 即使在关闭应用程序后所有后续尝试创建也都失败的情况下,这种情况似乎仍然存在。

sprintf(idTmp->name, "/%08x%d", (uint32_t) idTmp, rand());
if ((idTmp->mq = mq_open(idTmp->name, O_CREAT, 0x666, NULL)) == -1)

You ask: 你问:

Is there way display and remove theses queues? 有没有办法显示和删除这些队列?

That's not easy. 那不容易。 The usual suspects ( ipcs , ipcrm ) are designed for System V IPC ( msgget(...) ), not POSIX IPC ( mq_open(...) ). 常见的可疑对象( ipcsipcrm )是为系统V IPC( msgget(...) )设计的,而不是为POSIX IPC( mq_open(...) )设计的。

Check your mq_overview(7) manpage — your version of Linux might create message queues on a virtual filesystem, which could be inspected with typical administrative tools. 检查您的mq_overview(7)联机帮助页-您的Linux版本可能会在虚拟文件系统上创建消息队列,可以使用典型的管理工具对其进行检查。 That filesystem, per the manpage, is exposed like so: 根据联机帮助页,该文件系统如下所示:

[root]# mkdir /dev/mqueue
[root]# mount -t mqueue none /dev/mqueue
... now ls and rm your way around ...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM