AWS IoT FreeRTOS+POSIX
mqueue.h
Go to the documentation of this file.
1 /*
2  * Amazon FreeRTOS+POSIX V1.0.0
3  * Copyright (C) 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a copy of
6  * this software and associated documentation files (the "Software"), to deal in
7  * the Software without restriction, including without limitation the rights to
8  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9  * the Software, and to permit persons to whom the Software is furnished to do so,
10  * subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in all
13  * copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21  *
22  * http://aws.amazon.com/freertos
23  * http://www.FreeRTOS.org
24  */
25 
33 #ifndef _FREERTOS_POSIX_MQUEUE_H_
34 #define _FREERTOS_POSIX_MQUEUE_H_
35 
36 /* FreeRTOS+POSIX includes. */
37 #include "FreeRTOS_POSIX/time.h"
38 
42 typedef void * mqd_t;
43 
47 struct mq_attr
48 {
49  long mq_flags;
50  long mq_maxmsg;
51  long mq_msgsize;
52  long mq_curmsgs;
53 };
54 
67 int mq_close( mqd_t mqdes );
68 
81 int mq_getattr( mqd_t mqdes,
82  struct mq_attr * mqstat );
83 
111 mqd_t mq_open( const char * name,
112  int oflag,
113  mode_t mode,
114  struct mq_attr * attr );
115 
138 ssize_t mq_receive( mqd_t mqdes,
139  char * msg_ptr,
140  size_t msg_len,
141  unsigned int * msg_prio );
142 
166 int mq_send( mqd_t mqdes,
167  const char * msg_ptr,
168  size_t msg_len,
169  unsigned msg_prio );
170 
197  char * msg_ptr,
198  size_t msg_len,
199  unsigned * msg_prio,
200  const struct timespec * abstime );
201 
228 int mq_timedsend( mqd_t mqdes,
229  const char * msg_ptr,
230  size_t msg_len,
231  unsigned msg_prio,
232  const struct timespec * abstime );
233 
248 int mq_unlink( const char * name );
249 
250 #endif /* ifndef _FREERTOS_POSIX_MQUEUE_H_ */
int mq_getattr(mqd_t mqdes, struct mq_attr *mqstat)
Get message queue attributes.
Definition: FreeRTOS_POSIX_mqueue.c:453
long mq_curmsgs
Definition: mqueue.h:52
int mq_unlink(const char *name)
Remove a message queue.
Definition: FreeRTOS_POSIX_mqueue.c:821
Time types.
long mq_maxmsg
Definition: mqueue.h:50
Message queue attributes.
Definition: mqueue.h:47
int ssize_t
Used for a count of bytes or an error indication. Enabled/disabled by posixconfigENABLE_SSIZE_T.
Definition: types.h:134
int mq_close(mqd_t mqdes)
Close a message queue.
Definition: FreeRTOS_POSIX_mqueue.c:390
int mode_t
Used for some file attributes. Enabled/disabled by posixconfigENABLE_MODE_T.
Definition: types.h:60
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.
Definition: FreeRTOS_POSIX_mqueue.c:623
int mq_send(mqd_t mqdes, const char *msg_ptr, size_t msg_len, unsigned msg_prio)
Send a message to a message queue.
Definition: FreeRTOS_POSIX_mqueue.c:613
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.
Definition: FreeRTOS_POSIX_mqueue.c:603
long mq_msgsize
Definition: mqueue.h:51
void * mqd_t
Message queue descriptor.
Definition: mqueue.h:42
long mq_flags
Definition: mqueue.h:49
represents an elapsed time
Definition: time.h:78
int mq_timedsend(mqd_t mqdes, const char *msg_ptr, size_t msg_len, unsigned msg_prio, const struct timespec *abstime)
Send a message to a message queue with timeout.
Definition: FreeRTOS_POSIX_mqueue.c:716
mqd_t mq_open(const char *name, int oflag, mode_t mode, struct mq_attr *attr)
Open a message queue.
Definition: FreeRTOS_POSIX_mqueue.c:486