|
FreeRTOS:
POSIX
|
| Return to main page ↑ |
Implementation of message queue functions in mqueue.h. More...
#include <string.h>#include "FreeRTOS_POSIX.h"#include "FreeRTOS_POSIX/errno.h"#include "FreeRTOS_POSIX/fcntl.h"#include "FreeRTOS_POSIX/mqueue.h"#include "FreeRTOS_POSIX/utils.h"Data Structures | |
| struct | QueueElement_t |
| Element of the FreeRTOS queues that store mq data. More... | |
| struct | QueueListElement_t |
| Data structure of an mq. More... | |
Functions | |
| static int | prvCalculateTickTimeout (long lMessageQueueFlags, const struct timespec *const pxAbsoluteTimeout, TickType_t *pxTimeoutTicks) |
| Convert an absolute timespec into a tick timeout, taking into account queue flags. More... | |
| static BaseType_t | prvCreateNewMessageQueue (QueueListElement_t **ppxMessageQueue, const struct mq_attr *const pxAttr, const char *const pcName, size_t xNameLength) |
| Add a new queue to the queue list. More... | |
| static void | prvDeleteMessageQueue (const QueueListElement_t *const pxMessageQueue) |
| Free all the resources used by a message queue. More... | |
| static BaseType_t | prvFindQueueInList (QueueListElement_t **const ppxQueueListElement, const char *const pcName, mqd_t xMessageQueueDescriptor) |
| Attempt to find the queue identified by pcName or xMqId in the queue list. More... | |
| static void | prvInitializeQueueList (void) |
| Initialize the queue list. More... | |
| static BaseType_t | prvValidateQueueName (const char *const pcName, size_t *pxNameLength) |
| Checks that pcName is a valid name for a message queue. More... | |
| int | mq_close (mqd_t mqdes) |
| Close a message queue. More... | |
| int | mq_getattr (mqd_t mqdes, struct mq_attr *mqstat) |
| Get message queue attributes. More... | |
| mqd_t | mq_open (const char *name, int oflag, mode_t mode, struct mq_attr *attr) |
| Open a message queue. More... | |
| ssize_t | mq_receive (mqd_t mqdes, char *msg_ptr, size_t msg_len, unsigned int *msg_prio) |
| Receive a message from a message queue. More... | |
| int | mq_send (mqd_t mqdes, const char *msg_ptr, size_t msg_len, unsigned msg_prio) |
| Send a message to a message queue. More... | |
| ssize_t | mq_timedreceive (mqd_t mqdes, char *msg_ptr, size_t msg_len, unsigned *msg_prio, const struct timespec *abstime) |
| Receive a message from a message queue with timeout. More... | |
| int | mq_timedsend (mqd_t mqdes, const char *msg_ptr, size_t msg_len, unsigned int msg_prio, const struct timespec *abstime) |
| int | mq_unlink (const char *name) |
| Remove a message queue. More... | |
Variables | |
| static StaticSemaphore_t | xQueueListMutex = { { 0 }, .u = { 0 } } |
| Guards access to the list of message queues. | |
| static Link_t | xQueueListHead = { 0 } |
| Head of the linked list of queues. | |
Implementation of message queue functions in mqueue.h.
|
static |
Convert an absolute timespec into a tick timeout, taking into account queue flags.
| [in] | lMessageQueueFlags | Message queue flags to consider. |
| [in] | pxAbsoluteTimeout | The absolute timespec to convert. |
| [out] | pxTimeoutTicks | Output parameter of the timeout in ticks. |
|
static |
Add a new queue to the queue list.
| [out] | ppxMessageQueue | Pointer to new queue. |
| [in] | pxAttr | mq_attr of the new queue. |
| [in] | pcName | Name of new queue. |
| [in] | xNameLength | Length of pcName. |
|
static |
Free all the resources used by a message queue.
| [out] | pxMessageQueue | Pointer to queue to free. |
|
static |
Attempt to find the queue identified by pcName or xMqId in the queue list.
Matches queues by pcName first; if pcName is NULL, matches by xMqId.
| [out] | ppxQueueListElement | Output parameter set when queue is found. |
| [in] | pcName | A queue name to match. |
| [in] | xMessageQueueDescriptor | A queue descriptor to match. |
|
static |
Initialize the queue list.
Performs initialization of the queue list mutex and queue list head.
|
static |
Checks that pcName is a valid name for a message queue.
Also outputs the length of pcName.
| [in] | pcName | The name to check. |
| [out] | pxNameLength | Output parameter for name length. |
| int mq_close | ( | mqd_t | mqdes | ) |
Close a message queue.
http://pubs.opengroup.org/onlinepubs/9699919799/functions/mq_close.html
| 0 | - Upon successful completion |
| -1 | - A error occurred. errno is also set. |
Get message queue attributes.
http://pubs.opengroup.org/onlinepubs/9699919799/functions/mq_getattr.html
| 0 | - Upon successful completion |
| -1 | - A error occurred. errno is also set. |
Open a message queue.
http://pubs.opengroup.org/onlinepubs/9699919799/functions/mq_open.html
| Message | queue descriptor – Upon successful completion |
| (mqd_t) | - 1 – An error occurred. errno is also set. |
Receive a message from a message queue.
http://pubs.opengroup.org/onlinepubs/9699919799/functions/mq_receive.html
| The | length of the selected message in bytes - Upon successful completion. The message is removed from the queue |
| -1 | - An error occurred. errno is also set. |
| int mq_send | ( | mqd_t | mqdes, |
| const char * | msg_ptr, | ||
| size_t | msg_len, | ||
| unsigned | msg_prio | ||
| ) |
Send a message to a message queue.
http://pubs.opengroup.org/onlinepubs/9699919799/functions/mq_send.html
| 0 | - Upon successful completion. |
| -1 | - An error occurred. errno is also set. |
| ssize_t mq_timedreceive | ( | mqd_t | mqdes, |
| char * | msg_ptr, | ||
| size_t | msg_len, | ||
| unsigned * | msg_prio, | ||
| const struct timespec * | abstime | ||
| ) |
Receive a message from a message queue with timeout.
http://pubs.opengroup.org/onlinepubs/9699919799/functions/mq_timedreceive.html
| The | length of the selected message in bytes - Upon successful completion. The message is removed from the queue |
| -1 | - An error occurred. errno is also set. |
| int mq_unlink | ( | const char * | name | ) |
Remove a message queue.
http://pubs.opengroup.org/onlinepubs/9699919799/functions/mq_unlink.html
| 0 | - Upon successful completion. |
| -1 | - An error occurred. errno is also set. |