Next: Exported generic functions, Previous: Exported macros, Up: Exported definitions [Contents][Index]
Retrieve attributes of the message queue.
Conditions:
BAD-FILE-DESCRIPTOR-INVALID
The message queue file descriptor (MQD) is invalid.
lib.lisp (file)
Close the message queue.
Conditions:
BAD-FILE-DESCRIPTOR-INVALID
The message queue file descriptor (MQD) is invalid.
lib.lisp (file)
Check if THING is a list and contains only MODEs.
types.lisp (file)
Return default sizes of a queue in a form (MAX-MESSAGES . MESSAGE-SIZE). This is done by creating a queue with a random name and by extracting its attributes. By using a 255 length name, we protect ourselves from name collision.
lib.lisp (file)
Check if THING is a list and contains only OFLAGs. Also, check that single-flags are present only once.
types.lisp (file)
Create a new POSIX message queue or open an existing queue.
NAME is a string that identifies a queue. It MUST start with a slash ("/")
and MUST NOT contain other slashes. Example: "/myqueue".
OPEN-FLAGS is a list of flags that control the operation of queue. Exactly one
of the following must be specified in OPEN-FLAGS:
:read-only
Open the queue to receive messages only.
:write-only
Open the queue to send messages only.
:read-write
Open the queue to both send and receive messages.
Zero or more of the following flags:
:close-on-exec
Set the close-on-exec flag for the message queue descriptor. See open(2)
for a discussion of why this flag is useful.
:create
Create the message queue if it does not exist. The owner (user ID) of the
message queue is set to the effective user ID of the calling process. The
group ownership (group ID) is set to the effective group ID of the calling
process.
:exclusive
If :create was specified in OPEN-FLAGS, and a queue with the given name
already exists, then fail signaling FILE-EXISTS condition.
:non-blocking
Open the queue in nonblocking mode. In circumstances where RECEIVE and SEND
operations would normally block, these operations will return :try-again
instead.
If :create is specified in OPEN-FLAGS, then three additional arguments can be
supplied. The MODE argument specifies the permissions to be placed on the new
queue. It is a list of the following possible flags:
:user-read :user-write :group-read :group-write :other-read :other-read
In addition, MAX-MESSAGES and MESSAGE-SIZE specify the maximum number of
messages and the maximum size of messages that the queue will allow. Usually,
they default to their maximum values, 10 and 8192 respectively, but these values
can be changes through /proc/sys/fs/mqueue/ interface. They must be provided in
pair, as in the mq_open(3), but DEFAULT-SIZES function is provided to get
default sizes of a queue.
This function can signal the following conditions:
ACCESS-DENIED-PERMISSION
The queue exists, but the caller does not have permission to open it in the
specified mode.
ACCESS-DENIED-SLASHES
NAME contained more than one slash.
FILE-EXISTS
Both :create and :exclusive were specified in OPEN-FLAGS, but a queue with
this NAME already exists.
INVALID-ARGUMENT-NAME
NAME doesn’t follow the format described in mq_overview(7).
INVALID-ARGUMENT-SIZES
:create was specified in OPEN-FLAGS, but MAX-MESSAGES or MESSAGE-SIZE were
invalid. Both of these fields must be greater than zero. In a process that
is unprivileged (does not have the CAP_SYS_RESOURCE capability),
MAX-MESSAGES must be less than or equal to the msg_max limit, and
MESSAGE-SIZE must be less than or equal to the msgsize_max limit. In
addition, even in a privileged process, MAX-MESSAGES cannot exceed the
HARD_MAX limit. (See mq_overview(7) for details of these limits.).
Both of these limits can be changed through the /proc/sys/fs/mqueue/
interface.
TOO-MANY-OPEN-FILES
The per-process limit on the number of open file and message queue
descriptors has been reached (see the description of RLIMIT_NOFILE in
getrlimit(2)).
NAME-TOO-LONG
NAME was too long.
FILE-TABLE-OVERFLOW
The system-wide limit on the total number of open files and message queues
has been reached.
NO-FILE-OR-DIRECTORY-JUST-SLASH
NAME was just "/" followed by no other characters.
NO-FILE-OR-DIRECTORY-NO-CREATE
The :create flag was not specified in OPEN-FLAGS, and no queue with this
NAME exists.
OUT-OF-MEMORY
Insufficient memory.
NO-SPACE-LEFT-ON-DEVICE
Insufficient space for the creation of a new message queue. This probably occurred because the queues_max limit was encountered; see mq_overview(7).
SIMPLE-ERROR
This one can be signalled if the OPEN-FLAGS or the MODE are invalid.
BAD-FILE-DESCRIPTOR
The message queue file descriptor (MQD) is invalid. This is an internal error that should not happen, it is mainly for the writer of this library.
lib.lisp (file)
Remove the oldest message with the highest priority from the message QUEUE
and return it as ’(ARRAY (UNSIGNED-BYTE 8)). Return the priority associated
with the received message as second value. Return the message LENGTH as a third
value. Message length could be less than the returned BUFFER length. In fact,
this is the same buffer used internally in queue to receive all messages. This
function is provided for better control of the message data. Most library users
would like to use RECEIVE-STRING, or RECEIVE-BUFFER, or RECEIVE-DISPLACED,
instead.
If the queue is empty, then, by default, RECEIVE blocks until a message becomes
available, or the call is interrupted by a signal handler. If the :non-blocking
OPEN-FLAG is enabled for the message queue, then the call instead returns
immediately with :try-again.
Conditions:
BAD-FILE-DESCRIPTOR-INVALID
The file descriptor specified MQD was invalid or not opened for reading.
INTERRUPTED-SYSTEM-CALL
The call was interrupted by a signal handler; see signal(7).
MESSAGE-TOO-LONG-ON-RECEIVE
Message length was less than the :message-size attribute of the message
queue. This is an intarnal error that should not happen, it is mainly for
the writer of this library.
Restarts:
RETRY-ON-INTERRUPT
If the call was interrupted by a signal handler, you can restart the call.
lib.lisp (file)
Behaves just luke RECEIVE, except that it creates a new buffer with ONLY message data.
lib.lisp (file)
Behaves just like RECEIVE, except that it tries to return a displaced array from internal buffer. You should not use it in a thread, unless protected by a lock.
lib.lisp (file)
Behaves just like RECEIVE, except that it tries to convert received message to string.
lib.lisp (file)
Adds the MESSAGE-BUFFER to the message QUEUE. MESSAGE-BUFFER length must be
less than or equal to the QUEUE’s :message-size attribute. Zero-length messages
are allowed. MESSAGE-BUFFER must be an ’(array (unsigned-byte 8)). Additional
LENGTH argument can be provided to limit the message being sent. By default, it
is equal to MESSAGE-BUFFER length.
The PRIORITY argument is a nonnegative integer that specifies the priority of
new message. Messages are placed on the QUEUE in decreasing order of priority,
with newer messages of the same priority being placed after older messages with
the same priority. See mq_overview(7) for details on the range for the message
priority.
If the message QUEUE is already full (i.e., the number of messages on the QUEUE
equals the QUEUE’s :max-messages attribute), then, by default, SEND blocks until
sufficient space becomes available to allow the message to be queued, or until
the call is interrupted by a signal handler. If the :non-blocking flag is
enabled for the message QUEUE, then the call instead returns :try-again.
Note: if you don’t want to create a new buffer for sending to save space, you
can reuse QUEUE’s buffer. Use BUFFER function on a QUEUE to get it. Remember,
that its data will be overwritten on next receive call.
Conditions:
BAD-FILE-DESCRIPTOR-ON-SEND
The file descriptor specified MQD was invalid or not opened for writing.
INTERRUPTED-SYSTEM-CALL
The call was interrupted by a signal handler; see signal(7).
MESSAGE-TOO-LONG-ON-SEND
MESSAGE length was greater than the :message-size attribute of the message
QUEUE.
Restarts:
RETRY-ON-INTERRUPT
If the call was interrupted by a signal handler, you can restart the call.
lib.lisp (file)
Behaves just like SEND, except that it sends a string, not an ’(array (unsigned-byte 8))
lib.lisp (file)
Modify NON-BLOCKING-P attribute of the message queue.
Conditions:
BAD-FILE-DESCRIPTOR-INVALID
The message queue file descriptor (MQD) is invalid.
INVALID-ARGUMENT-ATTRIBUTES
mq-flags contained flags other than :non-blocking. This is an internal error that should not happen, it is mainly for the writer of this library.
lib.lisp (file)
Behaves just like RECEIVE, except that if the queue is empty and the
:non-blocking OPEN-FLAG is not enabled for the message queue, then the TIMESTAMP
specifies how long the call will block. The TIMESTAMP is absolute, not
relative. If no message is available, and the timeout has already expired by
the time of the call, TIMED-RECEIVE returns immediately with
:connection-timed-out.
Look LOCAL-TIME package for more information on timestamps.
Additional conditions:
INVALID-ARGUMENT-ON-SEND-RECEIVE
The call would have blocked, and timeout arguments were invalid, either because :sec was less than zero, or because :nsec was less than zero or greater than 1000 million.
lib.lisp (file)
Behaves just like TIMED-RECEIVE, except that it creates a new buffer with ONLY message data.
lib.lisp (file)
Behaves just like TIMED-RECEIVE, except that it tries to return a displaced array from internal buffer. You should not use it in a thread, unless protected by a lock.
lib.lisp (file)
Behaves just like TIMED-RECEIVE, except that it tries to convert received message to string.
lib.lisp (file)
Behaves just like SEND, except that if the QUEUE is full and the :non-blocking flag is not enabled for the message queue, then TIMESTAMP specifies how long the call will block. The TIMESTAMP is absolute, not relative. If the message queue is full, and the timeout has already expired by the time of the call, TIMED-SEND returns immediately with :connection-timed-out.
Look LOCAL-TIME package for more information on timestamps.
lib.lisp (file)
Behaves just like TIMED-SEND, except that it sends a string, not an ’(array (unsigned-byte 8))
lib.lisp (file)
Remove the specified message queue NAME. The message queue NAME is removed
immediately. The queue itself is destroyed once any other processes that have
the queue open close their descriptors referring to the queue.
Conditions:
ACCESS-DENIED-ON-UNLINK
The caller does not have permission to unlink this message queue.
NAME-TOO-LONG
NAME was too long.
NO-FILE-OR-DIRECTORY-ON-UNLINK
There is no message queue with the given NAME.
lib.lisp (file)
Next: Exported generic functions, Previous: Exported macros, Up: Exported definitions [Contents][Index]