mq

Updated: April 19, 2023

Alternate message queue manager (QNX Neutrino)

Note: You must be root or have the right abilities to start this manager.

Syntax:

mq [-d] [-m num_msgs] [-N path] [-n num] [-s size] [-U string]

Runs on:

QNX Neutrino

Options:

-d
Don't daemonize.
-m num_msgs
Set the default for the maximum number of messages, for use if the mq_attr argument to mq_open() is NULL. The default is 64 messages.
-N path
Set the pathname of the directory for message queues. The default is /dev/mq.
-n num
(QNX Neutrino 7.1 or later) Set the maximum number of queues (default 1024, max 32768).
-s size
Set the default message size, for use if the mq_attr argument to mq_open() is NULL. The default is 256 bytes.
-U user_name
-U uid[:gid[,sup_gid]*]]
(QNX Neutrino 6.6 or later) Once running, run as the specified user, so that the program doesn't need to run as root:
  • In the first form, the service sets itself to be the named user and uses that user's groups. This form depends on the /etc/passwd and /etc/group files.
  • In the second form, the service sets its user ID, and optionally its group ID and supplementary groups, to the values provided.

Description:

The mq manager is an alternate implementation of POSIX 1003.1b message queues. When you create a queue, it appears in the pathname space under /dev/mq.

Note:
  • In QNX Neutrino 7.0 or later, mq and the traditional message queue manager (mqueue) can coexist, but we recommend that you use only one of them on your system.
  • You can change this directory to union over the directory exported by the mqueue server by using the mq -N/dev/mqueue option, but we don't recommend this, because it may cause some user-namespace confusion.

This implementation uses a queue within the kernel to buffer the messages and eliminates the context-switching overheads of using an external server (i.e., mqueue) in each message-queue operation, thus greatly improving the performance of POSIX message queues.

In order to use the mq implementation, you must link your application(s) against the libmq library. In a manual build, specify the -l mq option; in automatic/recursive builds, use this setting in your common.mk file:

LIBS += mq

For more information, see the POSIX Message Queues: Two Implementations technote.