Module posix.sys.msg

Sys V Message Queue Operations.

Where supported by the underlying system, functions to send and receive interprocess messages. If the module loads successfully, but there is no system support, then posix.sys.msg.version will be set, but the unsupported APIs wil be nil.

Functions

msgget (key[, flags=0]) Get a message queue identifier
msgrcv (id, size, type[, flags=0]) Receive message from a message queue
msgsnd (id, type, message[, flags=0]) Send message to a message queue

Constants

posix.sys.msg Message constants.


Functions

msgget (key[, flags=0])
Get a message queue identifier

Parameters:

  • key int message queue id, or IPC_PRIVATE for a new queue
  • flags int bitwise OR of zero or more from IPC_CREAT and IPC_EXCL, and access permissions S_IRUSR, S_IWUSR, S_IRGRP, S_IWGRP, S_IROTH and S_IWOTH (from posix.sys.stat) (default 0)

Returns:

    int message queue identifier, if successful

Or

  1. nil
  2. string error message
  3. int errnum

See also:

msgrcv (id, size, type[, flags=0])
Receive message from a message queue

Parameters:

  • id int message queue identifier returned by msgget
  • size int maximum message size
  • type int message type (optional, default - 0)
  • flags int bitwise OR of zero or more of IPC_NOWAIT, MSG_EXCEPT and MSG_NOERROR (default 0)

Returns:

  1. int message type from msgsnd
  2. string message text, if successful

Or

  1. nil
  2. string error message
  3. int errnum

See also:

msgsnd (id, type, message[, flags=0])
Send message to a message queue

Parameters:

  • id int message queue identifier returned by msgget
  • type int arbitrary message type
  • message string content
  • flags int optionally IPC_NOWAIT (default 0)

Returns:

    int 0, if successful

Or

  1. nil
  2. string error message
  3. int errnum

See also:

Constants

posix.sys.msg
Message constants. Any constants not available in the underlying system will be nil valued.

Fields:

  • IPC_CREAT int create entry if key does not exist
  • IPC_EXCL int fail if key exists
  • IPC_PRIVATE int private key
  • IPC_NOWAIT int error if request must wait
  • MSG_EXCEPT int read messages with differing type
  • MSG_NOERROR int truncate received message rather than erroring

Usage:

      -- Print msg constants supported on this host.
      for name, value in pairs (require "posix.sys.msg") do
        if type (value) == "number" then
          print (name, value)
         end
      end
generated by LDoc 1.4.3 Last updated 2015-03-01 09:06:02