Message queueing is a method by which real-time tasks can exchange or pass data through a Xenomai-managed queue of messages. Messages can vary in length and be assigned different types or usages. A message queue can be created by one task and used by multiple tasks that send and/or receive messages to the queue.
This implementation is based on a zero-copy scheme for message buffers. Message buffer pools are built over the nucleus's heap objects, which in turn provide the needed support for exchanging messages between kernel and user-space using direct memory mapping.
Files | |
file | queue.c |
This file is part of the Xenomai project. | |
Functions | |
int | rt_queue_create (RT_QUEUE *q, const char *name, size_t poolsize, size_t qlimit, int mode) |
Create a message queue. | |
int | rt_queue_delete (RT_QUEUE *q) |
Delete a message queue. | |
void * | rt_queue_alloc (RT_QUEUE *q, size_t size) |
Allocate a message queue buffer. | |
int | rt_queue_free (RT_QUEUE *q, void *buf) |
Free a message queue buffer. | |
int | rt_queue_send (RT_QUEUE *q, void *mbuf, size_t size, int mode) |
Send a message to a queue. | |
int | rt_queue_write (RT_QUEUE *q, const void *buf, size_t size, int mode) |
Write a message to a queue. | |
ssize_t | rt_queue_receive (RT_QUEUE *q, void **bufp, RTIME timeout) |
Receive a message from a queue. | |
ssize_t | rt_queue_read (RT_QUEUE *q, void *buf, size_t size, RTIME timeout) |
Read a message from a queue. | |
int | rt_queue_inquire (RT_QUEUE *q, RT_QUEUE_INFO *info) |
Inquire about a message queue. | |
int | rt_queue_bind (RT_QUEUE *q, const char *name, RTIME timeout) |
Bind to a shared message queue. | |
int | rt_queue_unbind (RT_QUEUE *q) |
Unbind from a shared message queue. |
|
Allocate a message queue buffer. This service allocates a message buffer from the queue's internal pool which can be subsequently filled by the caller then passed to rt_queue_send() for sending.
This service can be called from:
Rescheduling: never. |
|
Bind to a shared message queue. This user-space only service retrieves the uniform descriptor of a given shared Xenomai message queue identified by its symbolic name. If the queue does not exist on entry, this service blocks the caller until a queue of the given name is created.
Environments: This service can be called from:
Rescheduling: always unless the request is immediately satisfied or timeout specifies a non-blocking operation.
|
|
Create a message queue. Create a message queue object that allows multiple tasks to exchange data through the use of variable-sized messages. A message queue is created empty. Message queues can be local to the kernel space, or shared between kernel and user-space. This service needs the special character device /dev/rtheap (10,254) when called from user-space tasks.
Environments: This service can be called from:
Rescheduling: possible. |
|
Delete a message queue. Destroy a message queue and release all the tasks currently pending on it. A queue exists in the system since rt_queue_create() has been called to create it, so this service must be called in order to destroy it afterwards.
Environments: This service can be called from:
Rescheduling: possible. |
|
Free a message queue buffer. This service releases a message buffer returned by rt_queue_receive() to the queue's internal pool.
This service can be called from:
Rescheduling: never. |
|
Inquire about a message queue. Return various information about the status of a given queue.
Environments: This service can be called from:
Rescheduling: never. |
|
Read a message from a queue. This service retrieves the next message available from the given queue. Unless otherwise specified, the caller is blocked for a given amount of time if no message is immediately available on entry. This services differs from rt_queue_receive() in that it copies back the payload data to a user-defined memory area, instead of returning a pointer to the message buffer holding such data.
Environments: This service can be called from:
Rescheduling: always unless the request is immediately satisfied or timeout specifies a non-blocking operation.
|
|
Receive a message from a queue. This service retrieves the next message available from the given queue. Unless otherwise specified, the caller is blocked for a given amount of time if no message is immediately available on entry.
Environments: This service can be called from:
Rescheduling: always unless the request is immediately satisfied or timeout specifies a non-blocking operation.
|
|
Send a message to a queue. This service sends a complete message to a given queue. The message must have been allocated by a previous call to rt_queue_alloc().
Environments: This service can be called from:
Rescheduling: possible. |
|
Unbind from a shared message queue. This user-space only service unbinds the calling task from the message queue object previously retrieved by a call to rt_queue_bind(). Unbinding from a message queue when it is no more needed is especially important in order to properly release the mapping resources used to attach the shared queue memory to the caller's address space.
Rescheduling: never. |
|
Write a message to a queue. This service writes a complete message to a given queue. This service differs from rt_queue_send() in that it accepts a pointer to the raw data to be sent, instead of a canned message buffer.
Environments: This service can be called from:
Rescheduling: possible. |