c - 为什么 ls -al 不显示 mq_open 创建的消息队列

标签 c linux

我使用mq_open创建消息队列/temp.1234 ,

  1. 但是命令ls -alipcs -q在目录 /不显示有关消息队列的任何信息。
  2. 我使用 mq_send 发送消息。另外,在另一个程序中, mq_open("/temp.1234", O_WRONLY) 返回 3 (消息描述符)成功,但是当调用mq_receive时,它输出EBADF。操作系统是ubuntu。
  3. 是否只在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

最佳答案

  1. 第一个参数不是文件名,它只是一个标识符。它不会存在于文件系统上。

  2. 尝试从只写队列接收数据会发生错误。

关于c - 为什么 ls -al 不显示 mq_open 创建的消息队列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38430677/

相关文章:

c++ - 如何读取自定义 TIFF 标签(无 TIFFFieldInfo)

c++ - C/C++ 需要本地函数原型(prototype)吗?

c - Linux内核中进程的年龄

c++ - 减少内存分配 GCC 命令

linux - 创建指向所有子文件夹的大量符号链接(symbolic link)

linux - 文件中每一行的 bash 脚本 : how to move a string before . <dot>

c - 为什么编译器没有警告我空的 if 语句?

c - 如何从 C 中的字符串中删除重音符号?

c - 在 C 中, block 作用域变量存储在哪里?

c - 为什么客户端调用shutdown(sockfd, SHUT_RD)后,客户端程序中的recv()可以接收到发送给客户端的消息?