Amazon FreeRTOS: POSIX
Return to main page ↑
mqueue.h
Go to the documentation of this file.
1 /*
2  * Amazon FreeRTOS POSIX V1.1.0
3  * Copyright (C) 2019 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 
48 struct mq_attr
49 {
50  long mq_flags;
51  long mq_maxmsg;
52  long mq_msgsize;
53  long mq_curmsgs;
54 };
55 
68 int mq_close( mqd_t mqdes );
69 
82 int mq_getattr( mqd_t mqdes,
83  struct mq_attr * mqstat );
84 
112 mqd_t mq_open( const char * name,
113  int oflag,
114  mode_t mode,
115  struct mq_attr * attr );
116 
139 ssize_t mq_receive( mqd_t mqdes,
140  char * msg_ptr,
141  size_t msg_len,
142  unsigned int * msg_prio );
143 
167 int mq_send( mqd_t mqdes,
168  const char * msg_ptr,
169  size_t msg_len,
170  unsigned msg_prio );
171 
198  char * msg_ptr,
199  size_t msg_len,
200  unsigned * msg_prio,
201  const struct timespec * abstime );
202 
229 int mq_timedsend( mqd_t mqdes,
230  const char * msg_ptr,
231  size_t msg_len,
232  unsigned msg_prio,
233  const struct timespec * abstime );
234 
249 int mq_unlink( const char * name );
250 
251 #endif /* ifndef _FREERTOS_POSIX_MQUEUE_H_ */
ssize_t
int ssize_t
Used for a count of bytes or an error indication.
Definition: types.h:165
mq_open
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:494
mq_receive
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:611
mq_getattr
int mq_getattr(mqd_t mqdes, struct mq_attr *mqstat)
Get message queue attributes.
Definition: FreeRTOS_POSIX_mqueue.c:461
mq_send
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:621
mq_attr::mq_flags
long mq_flags
Definition: mqueue.h:50
mq_attr::mq_curmsgs
long mq_curmsgs
Definition: mqueue.h:53
mq_unlink
int mq_unlink(const char *name)
Remove a message queue.
Definition: FreeRTOS_POSIX_mqueue.c:829
mode_t
int mode_t
Used for some file attributes.
Definition: types.h:69
mq_attr
Message queue attributes.
Definition: mqueue.h:48
time.h
Time types.
mq_timedreceive
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:631
mqd_t
void * mqd_t
Message queue descriptor.
Definition: mqueue.h:42
mq_attr::mq_maxmsg
long mq_maxmsg
Definition: mqueue.h:51
mq_attr::mq_msgsize
long mq_msgsize
Definition: mqueue.h:52
timespec
represents an elapsed time
Definition: time.h:79
mq_timedsend
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.
mq_close
int mq_close(mqd_t mqdes)
Close a message queue.
Definition: FreeRTOS_POSIX_mqueue.c:398