如何查看POSIX消息队列的内容

dd8924 2017-07-18 02:46:43
系统文件内容:
root@mdm9607:/# hexdump /dev/mqueue/qtst
0000000 5351 5a49 3a45 3432 2020 2020 2020 2020
0000010 4e20 544f 4649 3a59 2030 2020 2020 4953
0000020 4e47 3a4f 2030 2020 2020 4f4e 4954 5946
0000030 505f 4449 303a 2020 2020 0a20
000003c
root@mdm9607:/# cat /dev/mqueue/qtst
QSIZE:24 NOTIFY:0 SIGNO:0 NOTIFY_PID:0

我的测试程序调用mq_receive之前QSIZE是0,返回之后QSIZE就变成24了.我没有发送任何数据,只调用了mq_receive.
ubuntu里运行没事,高通的开发板里运行是这个结果...
有什么办法可以查看这24字节是什么鬼???
...全文
291 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
dd8924 2017-07-19
  • 打赏
  • 举报
回复
引用 1 楼 lgbxyz 的回复:
应该看不到,你可以是用 ipcs 命令监测一下消息队列看看是谁发送的消息
你提醒我了,用ipcs命令...不过嘛也没看见... / # ipcs -qt ipcs -qt ------ Message Queues Send/Recv/Change Times -------- msqid owner send recv change / # cat /dev/mqueue/q* cat /dev/mqueue/q* QSIZE:24 NOTIFY:0 SIGNO:0 NOTIFY_PID:0 没有消息交互,但...就是有24个字节.见鬼了...
LubinLew 2017-07-19
  • 打赏
  • 举报
回复
应该看不到,你可以是用 ipcs 命令监测一下消息队列看看是谁发送的消息
LubinLew 2017-07-19
  • 打赏
  • 举报
回复
看一下 http://man7.org/linux/man-pages/man7/mq_overview.7.html 的BUGS那一段,确定一下是不是你的内核版本导致的问题 As originally implemented (and documented), the QSIZE field displayed the total number of (user-supplied) bytes in all messages in the message queue. Some changes in Linux 3.5 inadvertently changed the behavior, so that this field also included a count of kernel overhead bytes used to store the messages in the queue. This behavioral regression was rectified in Linux 4.2 (and earlier stable kernel series), so that the count once more included just the bytes of user data in messages in the queue.

23,121

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 应用程序开发区
社区管理员
  • 应用程序开发区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧