Manual Reference Pages  - msgqueue (1)


msgqueue - command utility to access message queue functions.


See Also


msgqueue [options...]


msgqueue is a command line utility that permits message queues to be created, removed, queried, or modified. Each queue is identified by a unique key. Messages may be written and read from these queues. An integer type associated with messages allows some control over the order in which messages are read from the queue. Queue access is restricted by a mask similar to that used in the Unix file system.

msgqueue may be obtained as part of the drm_tools package from:


  Create a message queue. Requires -key <KEYVAL> and -mask <MASK>. The queue will be owned by the person who created it.

  Remove the message queue. Requires -key <KEYVAL>.

  Show information about the message queue. Requires -key <KEYVAL>.

  Send the input from stdin as a message to the queue. Requires -key <KEYVAL> ; -lock <KEYVAL> and -type <TYPEVAL> are optional.

-t,-text <message>
  Modifies -send. Sends <message> instead of stdin.

  Modifies -send. Each line read from stdin is expected to have the format: KEYVAL TYPEVAL MSG. The message MSG is sent to the queue indicated by the decimal integer KEYVAL with integer type TYPEVAL. An EOF read from stdin causes the program to exit.

  Get the next message from the queue and send it to stdout. Requires -key <KEYVAL> ; -lock <KEYVAL> and -type <TYPEVAL> are optional.

-next Default mode for -get. Reads the next message without regard to -type <TYPEVAL>.

-match Alternate mode for -get. Reads the next message which matches -type <TYPEVAL>.

  Alternate mode for -get. Reads the next message which does not match -type <TYPEVAL>.

-modify <Qbytes>
  Modifies the specified queue so that it can hold <Qbytes> bytes of message. This mode only works for the superuser. Requires -key <KEYVAL> and -mask <MASKVAL>.

  Write information about the specified queue to stdout. Requires -key <KEYVAL>.

-y,-type <TYPEVAL>
  Specifies the integer type of a message. This value is used with the -get command to control message retrieval. Defaults to 1 if not specified explicitly.

-m,-mask <MASKVAL>
  Specifies the octal protection mask for the queue, analogous to the protection mask on a Unix file. For instance, 666 allows everybody read and write access to the message queue.

  Experimentally determines the largest message which may be written to a message queue. Requires -key <KEYVAL> which must specify an existing, empty, message queue. The result is written to stdout. This value is highly platform dependent.

-k[x],-key[x] <KEYVAL>
  Specifies the integer key which determines the queue to act upon. This flag is mandatory with most modes of this program. The [x] variants expect a hexadecimal value, the regular variants a decimal value.

  Modifies the behavior of -get and -send. Normally these execute without waiting for notification of completion. This allows msgqueue to be used in a polling mode. If this flag is employed the program will lock until the action completes. For instance, when reading from a queue, it will wait forever for the next message to appear.

-h -help --help -? --??
  Print the help message. (Default - do not print help message.)

-i Emit version, copyright, license and contact information.( Default - do not emit information.)


% msgqueue -h
  List the the command line options.

% msgqueue -c -k 1 -m 660
  Create a queue to be identified with key = 1 with an access mask 660.

% ps -ef | msgqueue -k 1 -send -type 123
  Pipe the output of the command into a message and send it without locking to the specified queue. Note that this may fail if the output is larger than the maximum message size.

% msgqueue -k 1 -get -type 123 -match -lock
  Read from the message queue the next message having type 123 and write it to stdout. Wait for that next message if one is not already present.


ipcs(8), ipcrm(8), msgrcv(2), msgsnd(2), msgctl(2)

On Solaris ipcs and ipcrm are found in section(1).


GNU General Public License 2


Copyright (C) 2002, 2006 David Mathog and Caltech.




David Mathog, Biology Division, Caltech <>

drm_tools msgqueue (1) 1.0.2 OCT 23 2006
Generated by manServer 1.07 from /usr/common/man/man1/msgqueue.1 using man macros.