jski
jski

Reputation: 715

Posix message queues and the command line?

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.

Upvotes: 13

Views: 10606

Answers (1)

jski
jski

Reputation: 715

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

Upvotes: 23

Related Questions