我使用mq_open创建消息队列/temp.1234
,
- 但是命令
ls -al
和ipcs -q
在目录/
不显示有关消息队列的任何信息。 - 我使用 mq_send 发送消息。另外,在另一个程序中, mq_open("/temp.1234", O_WRONLY) 返回
3
(消息描述符)成功,但是当调用mq_receive时,它输出EBADF。操作系统是ubuntu。 - 是否只在solaris上有效,在ubuntu上无效?
已添加: 它来自unix网络编程卷2。
Here is the output under Solaris 2.6:
solaris % mqcreatel /temp.l234
solaris % 1s -1 /tmp/.*l234
-rw-rw-rw- 1 rstevens otherl 132632 Oct 23 17:08 /tmp/.MQDtemp.1234
-rw-rw-rw- 1 rstevens other1 0 Oct 23 17:08 /tmp/.MQLtemp.l234
-rw-r--r-- 1 rstevens other1 0 Oct 23 17:08 /tmp/.MQPtemp.l234
最佳答案
第一个参数不是文件名,它只是一个标识符。它不会存在于文件系统上。
尝试从只写队列接收数据会发生错误。
关于c - 为什么 ls -al 不显示 mq_open 创建的消息队列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38430677/