Side note: I'm creating a utility called 'posixmqcontrol' - in the spirit of
posixshmcontrol() so I'm hashing out some of the finer points of POSIX MQs.
POSIXMQCONTROL(1) FreeBSD General Commands Manual POSIXMQCONTROL(1)
NAME
posixmqcontrol – Control POSIX mqueuefs message queues
SYNOPSIS
posixmqcontrol create [-q queue] [-s size] [-d depth] [-m mode]
posixmqcontrol info [-q queue]
posixmqcontrol recv [-q queue]
posixmqcontrol rm [-q queue]
posixmqcontrol send [-q queue] [-p payload]
DESCRIPTION
The
posixmqcontrol command manipulates the named POSIX message queue. It
allows creating queues, inspecting their metadata, dumping contents, and
unlinking them.
Unlinking removes the name from the system and frees underlying memory.
The maximum message size, maximum queue size, and current queue depth are
displayed by the
info subcommand. This output is similar to running
cat
on a
mqueuefs queue mounted under a mount point. This utility requires
mqueuefs kernal module to be loaded but does not require
mqueuefs to be
mounted as a file system.
The following subcommands are provided:
create Create the named queues, if they do not already exist. More
than one queue name may be created. The same depth and size are
used to create all queues.
The required
size and
depth arguments specify the maxmimum
message size and maxmimum message depth. The optional
numerical
mode argument specifies the initial access mode.
rm Unlink the queues specified - one attempt per queue. Failure to
unlink one queue does not stop this sub-command from attempting
the others.
info For each named queue, dispay the maximum message size, maximum
queue size, and current queue depth.
recv Wait for a message from a single named queue and display the
message to standard output.
SUMMARY
posixmqcontrol allows you to move POSIX message queue administration out
of your applications. Adjusting queue attributes can be done without
touching application code.
EXIT STATUS
The posixmqcontrol utility exits 0 on success, and >0 if an error occurs.
EXAMPLES
• To retrieve the current message from a named queue, "/1", use the
command
posixmqcontrol recv -q /1
• To create a queue with the name "/2" with message size 100 and maximum
queue depth 10, use the command
posixmqcontrol create -q /2 -s 100 -d 10
• To send a message to a queue with the name "/3" use the command
posixmqcontrol send -q /3 -p 'some choice words.'
• To examine attributes of a queue named "/4" use the command
posixmqcontrol info -q /4
SEE ALSO
mq_open(2), mq_getattr(2), mq_send(2), mq_receive(2), mq_unlink(2),
mqueuefs(5)
FreeBSD 14.0-RELEASE-p3 February 5, 2024 FreeBSD 14.0-RELEASE-p3