I am creating a message queue using the POSIX mqueue API:
mq_open("/myqueue", O_CREAT | O_WRONLY, O_WRONLY, NULL)
I also mount the directory for the message queue objects:
su
mkdir /dev/mqueue
mount -t mqueue none /dev/mqueue
exit
When I run my program, the message queue appears in /dev/mqueue with permissions:
---------x
I cannot interact with this message queue, and it does not show up with the ipcs command.
How can I create a POSIX message queue to be used by a user-level application in Ubuntu 18.04?
Your arguments to the function are wrong. You're passing O_WRONLY
as the mode, but it's a flag, just like the other O_
*. Instead you should do:
mq_open("/myqueue", O_CREAT | O_WRONLY, 0600, NULL);
or some other file access mode that you want (0600
= rw-------
).