Posix message queues and the command line?

10.1k views Asked by At

I'm writing some code to replace TCP sockets with POSIX message queues. Sometimes the program will crash (still in development) and the queues that were created are not deleted (did not execute: mq_close() + mq_unlink()). This causes issues when I run the code again.

Is there a way to delete/remove these queues using the command line? I tried using: ipcs -q. This failed to list any queues.

I tried: lsof | grep queue-name. They did show up here.

Ideally, I'd like to use: ipcrm.

1

There are 1 answers

3
jski On

POSIX IPC objects are implemented as files in virtual file systems. These files can be listed and removed with ls and rm. To do this with POSIX message queues, we must mount the message queue file system using the following commands:

$ su
Password:
# mkdir /dev/mqueue
# mount -t mqueue none /dev/mqueue
# exit