mq_copy - Command line interface to Linux, POSIX, message queues.
Provides a command line interface, usable by scripting languages, to the Linux system of POSIX message queues.
The Linux system provides the POSIX message queues as a modified file descriptor. The default location is under the directory: /dev/mqueue .
POSIX message queues have kernel persistence. If not removed by unlink, the queue will exist until the system is shut down. The action: “unlink on close” is a mq_copy command line option.
POSIX message queues allow processes to exchange data in the form of messages.
mq_copy supports line oriented, string messages. That is, lines terminated by the new-line character.
mq_copy provides two basic functions: copy_in and copy_out.
- The copy-in function copies line oriented strings on stdin as messages to a specified queue.
- The copy-out function copies messages from the specified queue as line oriented strings to stdout.
mq_copy_ [ --in | --out ] [ options ]_ /queue_name
The minimum command arguments are the function, either --in (copy_in) or --out (copy_out) and the name of an existing queue. The GLIBC library requires that the queue name begin with the path separator character ‘/’.
[ --ci | --in | -i ] copy stdin to queue
[ --co | --out | -o ] copy queue to stdout
[ --create | --cr | -c ] Create queue if not already present on open
[ --exclusive | --ex | -x ] Create queue on open, queue must not exist.
Default Open existing queue
[ --ro | -r ] Open queue as read-only
[ --wo | -w ] Open queue as write-only
Default Open queue as read-write
[ --mode | --md | -m ] <perm> Set user and group permissions. Permissions must be either three or four octal digits (not symbols).
Default 0660
[ --attributes | --at | -a ] <at-list> One or more, comma separated, name=value pairs or feature.
Example, showing default values:
-a maxmsgs=10,msgsize=256,noblock
where:
maxmsgs: The maximum number of messages the queue will hold.
msgsize: The maximum byte length of any single message.
noblock: Disable the default blocking behavior (disabled).
[ --no-block | --nb | -n ] Open descriptor as non-blocking.
Default Blocking (Non-blocking operation is disabled.)
[ --time | -t ] <tenths second> Set maximum time to block in tenths of a second.
Copy-in will block if no space on queue for a new message.
Copy-out will block if no message on queue to be read.
Default No time limit for condition to clear.
[ --priority | --pri | -p ] <0 .. 31> Set the message priority during Copy-in.
Default 15
Lower value is a higher priority. The mqueue delivers the oldest message of the highest priority first.
[ --unlink | --ul | -u ] Unlink (delete name) queue name prior to close. Like a file descriptor, the queue remains available to any queue descriptor that has it open at the time of the unlink.