10112f8c4SRick Parrish.\"- 20112f8c4SRick Parrish.\" SPDX-License-Identifier: BSD-2-Clause 30112f8c4SRick Parrish.\" 40112f8c4SRick Parrish.\" Copyright (c) 2024 Rick Parrish <unitrunker@unitrunker.net>. 50112f8c4SRick Parrish.\" 60112f8c4SRick Parrish.\" Redistribution and use in source and binary forms, with or without 70112f8c4SRick Parrish.\" modification, are permitted provided that the following conditions 80112f8c4SRick Parrish.\" are met: 90112f8c4SRick Parrish.\" 1. Redistributions of source code must retain the above copyright 100112f8c4SRick Parrish.\" notice, this list of conditions and the following disclaimer. 110112f8c4SRick Parrish.\" 2. Redistributions in binary form must reproduce the above copyright 120112f8c4SRick Parrish.\" notice, this list of conditions and the following disclaimer in the 130112f8c4SRick Parrish.\" documentation and/or other materials provided with the distribution. 140112f8c4SRick Parrish.\" 150112f8c4SRick Parrish.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND 160112f8c4SRick Parrish.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 170112f8c4SRick Parrish.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 180112f8c4SRick Parrish.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE 190112f8c4SRick Parrish.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 200112f8c4SRick Parrish.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 210112f8c4SRick Parrish.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 220112f8c4SRick Parrish.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 230112f8c4SRick Parrish.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 240112f8c4SRick Parrish.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 250112f8c4SRick Parrish.\" SUCH DAMAGE. 260112f8c4SRick Parrish.\" 270112f8c4SRick Parrish.Dd February 19, 2024 280112f8c4SRick Parrish.Dt POSIXMQCONTROL 1 290112f8c4SRick Parrish.Os 300112f8c4SRick Parrish.Sh NAME 310112f8c4SRick Parrish.Nm posixmqcontrol 320112f8c4SRick Parrish.Nd Control POSIX mqueuefs message queues 330112f8c4SRick Parrish.Sh SYNOPSIS 340112f8c4SRick Parrish.Nm 350112f8c4SRick Parrish.Ar create 360112f8c4SRick Parrish.Fl q Ar queue 370112f8c4SRick Parrish.Fl s Ar size 380112f8c4SRick Parrish.Fl d Ar depth 390112f8c4SRick Parrish.Op Fl m Ar mode 400112f8c4SRick Parrish.Op Fl g Ar group 410112f8c4SRick Parrish.Op Fl u Ar user 420112f8c4SRick Parrish.Nm 430112f8c4SRick Parrish.Ar info 440112f8c4SRick Parrish.Fl q Ar queue 450112f8c4SRick Parrish.Nm 460112f8c4SRick Parrish.Ar recv 470112f8c4SRick Parrish.Fl q Ar queue 480112f8c4SRick Parrish.Nm 490112f8c4SRick Parrish.Ar rm 500112f8c4SRick Parrish.Fl q Ar queue 510112f8c4SRick Parrish.Nm 520112f8c4SRick Parrish.Ar send 530112f8c4SRick Parrish.Fl q Ar queue 540112f8c4SRick Parrish.Fl c Ar content 550112f8c4SRick Parrish.Op Fl p Ar priority 560112f8c4SRick Parrish.Sh DESCRIPTION 570112f8c4SRick ParrishThe 580112f8c4SRick Parrish.Nm 590112f8c4SRick Parrishcommand allows separating POSIX message queue administration from application 600112f8c4SRick Parrishstack. 610112f8c4SRick ParrishDefining and adjusting queue attributes can be done without touching 620112f8c4SRick Parrishapplication code. 630112f8c4SRick ParrishIt allows creating queues, inspecting queue metadata, altering group and user 640112f8c4SRick Parrishaccess to queues, dumping queue contents, and unlinking queues. 650112f8c4SRick Parrish.Pp 660112f8c4SRick ParrishUnlinking removes the name from the system and frees underlying memory. 670112f8c4SRick Parrish.Pp 680112f8c4SRick ParrishThe maximum message size, maximum queue size, and current queue size are 690112f8c4SRick Parrishdisplayed by the 700112f8c4SRick Parrish.Ic info 710112f8c4SRick Parrishsubcommand. This output is similar to running 720112f8c4SRick Parrish.Ic cat 730112f8c4SRick Parrishon a mqueuefs queue mounted under a mount point. 740112f8c4SRick ParrishThis utility requires the 750112f8c4SRick Parrish.Ic mqueuefs 760112f8c4SRick Parrishkernel module to be loaded but does not require 770112f8c4SRick Parrish.Ic mqueuefs 780112f8c4SRick Parrishto be mounted as a file system. 790112f8c4SRick Parrish.Pp 800112f8c4SRick ParrishThe following subcommands are provided: 810112f8c4SRick Parrish.Bl -tag -width truncate 820112f8c4SRick Parrish.It Ic create 830112f8c4SRick ParrishCreate the named queues, if they do not already exist. 840112f8c4SRick ParrishMore than one queue name may be created. The same maximum queue depth and 850112f8c4SRick Parrishmaximum message size are used to create all queues. 860112f8c4SRick ParrishIf a queue exists, then depth and size are optional. 870112f8c4SRick Parrish.Pp 880112f8c4SRick ParrishThe required 890112f8c4SRick Parrish.Ar size 900112f8c4SRick Parrishand 910112f8c4SRick Parrish.Ar depth 920112f8c4SRick Parrisharguments specify the maximum message size (bytes per message) and maximum queue 930112f8c4SRick Parrishsize (depth or number of messages in the queue). 940112f8c4SRick ParrishThe optional numerical 950112f8c4SRick Parrish.Ar mode 960112f8c4SRick Parrishargument specifies the initial access mode. 970112f8c4SRick ParrishIf the queue exists but does not match the requested size and depth, this 980112f8c4SRick Parrishutility will attempt to recreate the queue by first unlinking and then creating 990112f8c4SRick Parrishit. 1000112f8c4SRick ParrishThis will fail if the queue is not empty or is opened by other processes. 1010112f8c4SRick Parrish.It Ic rm 1020112f8c4SRick ParrishUnlink the queues specified - one attempt per queue. 1030112f8c4SRick ParrishFailure to unlink one queue does not stop this sub-command from attempting to 1040112f8c4SRick Parrishunlink the others. 1050112f8c4SRick Parrish.It Ic info 1060112f8c4SRick ParrishFor each named queue, dispay the maximum message size, maximum queue size, 1070112f8c4SRick Parrishcurrent queue depth, user owner id, group owner id, and mode permission bits. 1080112f8c4SRick Parrish.It Ic recv 1090112f8c4SRick ParrishWait for a message from a single named queue and display the message to 1100112f8c4SRick Parrishstandard output. 1110112f8c4SRick Parrish.It Ic send 1120112f8c4SRick ParrishSend messages to one or more named queues. 1130112f8c4SRick ParrishIf multiple messages and multiple queues are specified, the utility attempts to 1140112f8c4SRick Parrishsend all messages to all queues. 1150112f8c4SRick ParrishThe optional -p priority, if omitted, defaults to MQ_PRIO_MAX / 2 or medium 1160112f8c4SRick Parrishpriority. 1170112f8c4SRick Parrish.El 1180112f8c4SRick Parrish.Sh NOTES 1190112f8c4SRick ParrishA change of queue geometry (maximum message size and/or maximum number of 1200112f8c4SRick Parrishmessages) requires destroying and re-creating the queue. 1210112f8c4SRick ParrishAs a safety feature, 1220112f8c4SRick Parrishthe create subcommand refuses to destroy a non-empty queue. 1230112f8c4SRick ParrishIf you use the rm subcommand to destroy a queue, any queued messages are lost. 1240112f8c4SRick ParrishTo avoid down-time when altering queue attributes, consider creating a new 1250112f8c4SRick Parrishqueue and configure reading applications to drain both new and old queues. 1260112f8c4SRick ParrishRetire the old queue once all writers have been updated to write to the new 1270112f8c4SRick Parrishqueue. 1280112f8c4SRick Parrish.Sh EXIT STATUS 1290112f8c4SRick Parrish.Ex -std 1300112f8c4SRick Parrish.Bl -bullet 1310112f8c4SRick Parrish.It 1320112f8c4SRick ParrishEX_NOTAVAILABLE usually means the mqueuefs kernel module is not loaded. 1330112f8c4SRick Parrish.It 1340112f8c4SRick ParrishEX_USAGE reports one or more incorrect parameters. 1350112f8c4SRick Parrish.El 1360112f8c4SRick Parrish.Sh EXAMPLES 1370112f8c4SRick Parrish.Bl -bullet 1380112f8c4SRick Parrish.It 1390112f8c4SRick ParrishTo retrieve the current message from a named queue, 1400112f8c4SRick Parrish.Pa /1 , 1410112f8c4SRick Parrishuse the command 1420112f8c4SRick Parrish.Dl "posixmqcontrol recv -q /1" 1430112f8c4SRick Parrish.It 1440112f8c4SRick ParrishTo create a queue with the name 1450112f8c4SRick Parrish.Pa /2 1460112f8c4SRick Parrishwith maximum message size 100 and maximum queue depth 10, 1470112f8c4SRick Parrishuse the command 1480112f8c4SRick Parrish.Dl "posixmqcontrol create -q /2 -s 100 -d 10" 1490112f8c4SRick Parrish.It 1500112f8c4SRick ParrishTo send a message to a queue with the name 1510112f8c4SRick Parrish.Pa /3 1520112f8c4SRick Parrishuse the command 1530112f8c4SRick Parrish.Dl "posixmqcontrol send -q /3 -c 'some choice words.'" 1540112f8c4SRick Parrish.It 1550112f8c4SRick ParrishTo examine attributes of a queue named 1560112f8c4SRick Parrish.Pa /4 1570112f8c4SRick Parrishuse the command 1580112f8c4SRick Parrish.Dl "posixmqcontrol info -q /4" 1590112f8c4SRick Parrish.El 1600112f8c4SRick Parrish.Sh SEE ALSO 1610112f8c4SRick Parrish.Xr mq_getattr 2 , 162*6e1fc011SGraham Percival.Xr mq_open 2 , 1630112f8c4SRick Parrish.Xr mq_receive 2 , 1640112f8c4SRick Parrish.Xr mq_send 2 , 1650112f8c4SRick Parrish.Xr mq_setattr 2 , 1660112f8c4SRick Parrish.Xr mq_unlink 2 , 1671a720cbeSAlexander Ziaee.Xr mqueuefs 4 1680112f8c4SRick Parrish.Sh BUGS 1690112f8c4SRick Parrishmq_timedsend and mq_timedrecv are not implemented. 1700112f8c4SRick Parrishinfo reports a worst-case estimate for QSIZE. 1710112f8c4SRick Parrish.Sh HISTORY 1720112f8c4SRick ParrishThe 1730112f8c4SRick Parrish.Nm 1740112f8c4SRick Parrishcommand appeared in 1752ce32ab2STom Hukins.Fx 14.1 . 1760112f8c4SRick Parrish.Sh AUTHORS 1770112f8c4SRick ParrishThe 1780112f8c4SRick Parrish.Nm 1790112f8c4SRick Parrishcommand and this manual page were written by 1800112f8c4SRick Parrish.An Rick Parrish Aq Mt unitrunker@unitrunker.net. 181