1*0112f8c4SRick Parrish.\"- 2*0112f8c4SRick Parrish.\" SPDX-License-Identifier: BSD-2-Clause 3*0112f8c4SRick Parrish.\" 4*0112f8c4SRick Parrish.\" Copyright (c) 2024 Rick Parrish <unitrunker@unitrunker.net>. 5*0112f8c4SRick Parrish.\" 6*0112f8c4SRick Parrish.\" Redistribution and use in source and binary forms, with or without 7*0112f8c4SRick Parrish.\" modification, are permitted provided that the following conditions 8*0112f8c4SRick Parrish.\" are met: 9*0112f8c4SRick Parrish.\" 1. Redistributions of source code must retain the above copyright 10*0112f8c4SRick Parrish.\" notice, this list of conditions and the following disclaimer. 11*0112f8c4SRick Parrish.\" 2. Redistributions in binary form must reproduce the above copyright 12*0112f8c4SRick Parrish.\" notice, this list of conditions and the following disclaimer in the 13*0112f8c4SRick Parrish.\" documentation and/or other materials provided with the distribution. 14*0112f8c4SRick Parrish.\" 15*0112f8c4SRick Parrish.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND 16*0112f8c4SRick Parrish.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17*0112f8c4SRick Parrish.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18*0112f8c4SRick Parrish.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE 19*0112f8c4SRick Parrish.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20*0112f8c4SRick Parrish.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21*0112f8c4SRick Parrish.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22*0112f8c4SRick Parrish.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23*0112f8c4SRick Parrish.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24*0112f8c4SRick Parrish.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25*0112f8c4SRick Parrish.\" SUCH DAMAGE. 26*0112f8c4SRick Parrish.\" 27*0112f8c4SRick Parrish.Dd February 19, 2024 28*0112f8c4SRick Parrish.Dt POSIXMQCONTROL 1 29*0112f8c4SRick Parrish.Os 30*0112f8c4SRick Parrish.Sh NAME 31*0112f8c4SRick Parrish.Nm posixmqcontrol 32*0112f8c4SRick Parrish.Nd Control POSIX mqueuefs message queues 33*0112f8c4SRick Parrish.Sh SYNOPSIS 34*0112f8c4SRick Parrish.Nm 35*0112f8c4SRick Parrish.Ar create 36*0112f8c4SRick Parrish.Fl q Ar queue 37*0112f8c4SRick Parrish.Fl s Ar size 38*0112f8c4SRick Parrish.Fl d Ar depth 39*0112f8c4SRick Parrish.Op Fl m Ar mode 40*0112f8c4SRick Parrish.Op Fl g Ar group 41*0112f8c4SRick Parrish.Op Fl u Ar user 42*0112f8c4SRick Parrish.Nm 43*0112f8c4SRick Parrish.Ar info 44*0112f8c4SRick Parrish.Fl q Ar queue 45*0112f8c4SRick Parrish.Nm 46*0112f8c4SRick Parrish.Ar recv 47*0112f8c4SRick Parrish.Fl q Ar queue 48*0112f8c4SRick Parrish.Nm 49*0112f8c4SRick Parrish.Ar rm 50*0112f8c4SRick Parrish.Fl q Ar queue 51*0112f8c4SRick Parrish.Nm 52*0112f8c4SRick Parrish.Ar send 53*0112f8c4SRick Parrish.Fl q Ar queue 54*0112f8c4SRick Parrish.Fl c Ar content 55*0112f8c4SRick Parrish.Op Fl p Ar priority 56*0112f8c4SRick Parrish.Sh DESCRIPTION 57*0112f8c4SRick ParrishThe 58*0112f8c4SRick Parrish.Nm 59*0112f8c4SRick Parrishcommand allows separating POSIX message queue administration from application 60*0112f8c4SRick Parrishstack. 61*0112f8c4SRick ParrishDefining and adjusting queue attributes can be done without touching 62*0112f8c4SRick Parrishapplication code. 63*0112f8c4SRick ParrishIt allows creating queues, inspecting queue metadata, altering group and user 64*0112f8c4SRick Parrishaccess to queues, dumping queue contents, and unlinking queues. 65*0112f8c4SRick Parrish.Pp 66*0112f8c4SRick ParrishUnlinking removes the name from the system and frees underlying memory. 67*0112f8c4SRick Parrish.Pp 68*0112f8c4SRick ParrishThe maximum message size, maximum queue size, and current queue size are 69*0112f8c4SRick Parrishdisplayed by the 70*0112f8c4SRick Parrish.Ic info 71*0112f8c4SRick Parrishsubcommand. This output is similar to running 72*0112f8c4SRick Parrish.Ic cat 73*0112f8c4SRick Parrishon a mqueuefs queue mounted under a mount point. 74*0112f8c4SRick ParrishThis utility requires the 75*0112f8c4SRick Parrish.Ic mqueuefs 76*0112f8c4SRick Parrishkernel module to be loaded but does not require 77*0112f8c4SRick Parrish.Ic mqueuefs 78*0112f8c4SRick Parrishto be mounted as a file system. 79*0112f8c4SRick Parrish.Pp 80*0112f8c4SRick ParrishThe following subcommands are provided: 81*0112f8c4SRick Parrish.Bl -tag -width truncate 82*0112f8c4SRick Parrish.It Ic create 83*0112f8c4SRick ParrishCreate the named queues, if they do not already exist. 84*0112f8c4SRick ParrishMore than one queue name may be created. The same maximum queue depth and 85*0112f8c4SRick Parrishmaximum message size are used to create all queues. 86*0112f8c4SRick ParrishIf a queue exists, then depth and size are optional. 87*0112f8c4SRick Parrish.Pp 88*0112f8c4SRick ParrishThe required 89*0112f8c4SRick Parrish.Ar size 90*0112f8c4SRick Parrishand 91*0112f8c4SRick Parrish.Ar depth 92*0112f8c4SRick Parrisharguments specify the maximum message size (bytes per message) and maximum queue 93*0112f8c4SRick Parrishsize (depth or number of messages in the queue). 94*0112f8c4SRick ParrishThe optional numerical 95*0112f8c4SRick Parrish.Ar mode 96*0112f8c4SRick Parrishargument specifies the initial access mode. 97*0112f8c4SRick ParrishIf the queue exists but does not match the requested size and depth, this 98*0112f8c4SRick Parrishutility will attempt to recreate the queue by first unlinking and then creating 99*0112f8c4SRick Parrishit. 100*0112f8c4SRick ParrishThis will fail if the queue is not empty or is opened by other processes. 101*0112f8c4SRick Parrish.It Ic rm 102*0112f8c4SRick ParrishUnlink the queues specified - one attempt per queue. 103*0112f8c4SRick ParrishFailure to unlink one queue does not stop this sub-command from attempting to 104*0112f8c4SRick Parrishunlink the others. 105*0112f8c4SRick Parrish.It Ic info 106*0112f8c4SRick ParrishFor each named queue, dispay the maximum message size, maximum queue size, 107*0112f8c4SRick Parrishcurrent queue depth, user owner id, group owner id, and mode permission bits. 108*0112f8c4SRick Parrish.It Ic recv 109*0112f8c4SRick ParrishWait for a message from a single named queue and display the message to 110*0112f8c4SRick Parrishstandard output. 111*0112f8c4SRick Parrish.It Ic send 112*0112f8c4SRick ParrishSend messages to one or more named queues. 113*0112f8c4SRick ParrishIf multiple messages and multiple queues are specified, the utility attempts to 114*0112f8c4SRick Parrishsend all messages to all queues. 115*0112f8c4SRick ParrishThe optional -p priority, if omitted, defaults to MQ_PRIO_MAX / 2 or medium 116*0112f8c4SRick Parrishpriority. 117*0112f8c4SRick Parrish.El 118*0112f8c4SRick Parrish.Sh NOTES 119*0112f8c4SRick ParrishA change of queue geometry (maximum message size and/or maximum number of 120*0112f8c4SRick Parrishmessages) requires destroying and re-creating the queue. 121*0112f8c4SRick ParrishAs a safety feature, 122*0112f8c4SRick Parrishthe create subcommand refuses to destroy a non-empty queue. 123*0112f8c4SRick ParrishIf you use the rm subcommand to destroy a queue, any queued messages are lost. 124*0112f8c4SRick ParrishTo avoid down-time when altering queue attributes, consider creating a new 125*0112f8c4SRick Parrishqueue and configure reading applications to drain both new and old queues. 126*0112f8c4SRick ParrishRetire the old queue once all writers have been updated to write to the new 127*0112f8c4SRick Parrishqueue. 128*0112f8c4SRick Parrish.Sh EXIT STATUS 129*0112f8c4SRick Parrish.Ex -std 130*0112f8c4SRick Parrish.Bl -bullet 131*0112f8c4SRick Parrish.It 132*0112f8c4SRick ParrishEX_NOTAVAILABLE usually means the mqueuefs kernel module is not loaded. 133*0112f8c4SRick Parrish.It 134*0112f8c4SRick ParrishEX_USAGE reports one or more incorrect parameters. 135*0112f8c4SRick Parrish.El 136*0112f8c4SRick Parrish.Sh EXAMPLES 137*0112f8c4SRick Parrish.Bl -bullet 138*0112f8c4SRick Parrish.It 139*0112f8c4SRick ParrishTo retrieve the current message from a named queue, 140*0112f8c4SRick Parrish.Pa /1 , 141*0112f8c4SRick Parrishuse the command 142*0112f8c4SRick Parrish.Dl "posixmqcontrol recv -q /1" 143*0112f8c4SRick Parrish.It 144*0112f8c4SRick ParrishTo create a queue with the name 145*0112f8c4SRick Parrish.Pa /2 146*0112f8c4SRick Parrishwith maximum message size 100 and maximum queue depth 10, 147*0112f8c4SRick Parrishuse the command 148*0112f8c4SRick Parrish.Dl "posixmqcontrol create -q /2 -s 100 -d 10" 149*0112f8c4SRick Parrish.It 150*0112f8c4SRick ParrishTo send a message to a queue with the name 151*0112f8c4SRick Parrish.Pa /3 152*0112f8c4SRick Parrishuse the command 153*0112f8c4SRick Parrish.Dl "posixmqcontrol send -q /3 -c 'some choice words.'" 154*0112f8c4SRick Parrish.It 155*0112f8c4SRick ParrishTo examine attributes of a queue named 156*0112f8c4SRick Parrish.Pa /4 157*0112f8c4SRick Parrishuse the command 158*0112f8c4SRick Parrish.Dl "posixmqcontrol info -q /4" 159*0112f8c4SRick Parrish.El 160*0112f8c4SRick Parrish.Sh SEE ALSO 161*0112f8c4SRick Parrish.Xr mq_open 2 , 162*0112f8c4SRick Parrish.Xr mq_getattr 2 , 163*0112f8c4SRick Parrish.Xr mq_receive 2 , 164*0112f8c4SRick Parrish.Xr mq_send 2 , 165*0112f8c4SRick Parrish.Xr mq_setattr 2 , 166*0112f8c4SRick Parrish.Xr mq_unlink 2 , 167*0112f8c4SRick Parrish.Xr mqueuefs 5 168*0112f8c4SRick Parrish.Sh BUGS 169*0112f8c4SRick Parrishmq_timedsend and mq_timedrecv are not implemented. 170*0112f8c4SRick Parrishinfo reports a worst-case estimate for QSIZE. 171*0112f8c4SRick Parrish.Sh HISTORY 172*0112f8c4SRick ParrishThe 173*0112f8c4SRick Parrish.Nm 174*0112f8c4SRick Parrishcommand appeared in 175*0112f8c4SRick Parrish.Fx 15.0 . 176*0112f8c4SRick Parrish.Sh AUTHORS 177*0112f8c4SRick ParrishThe 178*0112f8c4SRick Parrish.Nm 179*0112f8c4SRick Parrishcommand and this manual page were written by 180*0112f8c4SRick Parrish.An Rick Parrish Aq Mt unitrunker@unitrunker.net. 181