Tenok
A Linux-like Real-Time Operating System for Robotics and Internet of Things
mqueue.h
Go to the documentation of this file.
1 
4 #ifndef __MQUEUE_H__
5 #define __MQUEUE_H__
6 
7 #include <sys/types.h>
8 #include <time.h>
9 
10 #include <common/list.h>
11 
12 typedef uint32_t mqd_t;
13 
14 struct mq_attr {
15  int mq_flags; /* Flags: 0 or O_NONBLOCK */
16  int mq_maxmsg; /* Max number of the messages in the queue */
17  int mq_msgsize; /* Byte size of the message */
18  int mq_curmsgs; /* Number of the messages currently in the queue */
19 };
20 
29 int mq_getattr(mqd_t mqdes, struct mq_attr *attr);
30 
38 int mq_setattr(mqd_t mqdes,
39  const struct mq_attr *newattr,
40  struct mq_attr *oldattr);
41 
49 mqd_t mq_open(const char *name, int oflag, struct mq_attr *attr);
50 
56 int mq_close(mqd_t mqdes);
57 
58 int mq_unlink(const char *name);
59 
70 ssize_t mq_receive(mqd_t mqdes,
71  char *msg_ptr,
72  size_t msg_len,
73  unsigned int *msg_prio);
74 
84 int mq_send(mqd_t mqdes,
85  const char *msg_ptr,
86  size_t msg_len,
87  unsigned int msg_prio);
88 
98 int mq_timedsend(mqd_t mqdes,
99  const char *msg_ptr,
100  size_t msg_len,
101  unsigned int msg_prio,
102  const struct timespec *abs_timeout);
103 
113 ssize_t mq_timedreceive(mqd_t mqdes,
114  char *msg_ptr,
115  size_t msg_len,
116  unsigned int *msg_prio,
117  const struct timespec *abs_timeout);
118 
119 #endif
Definition: mqueue.h:14
Definition: time.h:16
mqd_t mq_open(const char *name, int oflag, struct mq_attr *attr)
Create a new message queue or open an existing queue.
Definition: mqueue.c:222
ssize_t mq_timedreceive(mqd_t mqdes, char *msg_ptr, size_t msg_len, unsigned int *msg_prio, const struct timespec *abs_timeout)
Receive message with absolute timeout.
Definition: mqueue.c:307
int mq_close(mqd_t mqdes)
Close the message queue descriptor.
Definition: mqueue.c:232
int mq_getattr(mqd_t mqdes, struct mq_attr *attr)
Retrieve atributes of the message queue referred to by the message queue descriptor mqdes.
Definition: mqueue.c:198
ssize_t mq_receive(mqd_t mqdes, char *msg_ptr, size_t msg_len, unsigned int *msg_prio)
Remove the oldest message with highest priority from the message queue referred to by the message que...
Definition: mqueue.c:255
int mq_timedsend(mqd_t mqdes, const char *msg_ptr, size_t msg_len, unsigned int msg_prio, const struct timespec *abs_timeout)
Add message with absolute timeout.
Definition: mqueue.c:288
int mq_setattr(mqd_t mqdes, const struct mq_attr *newattr, struct mq_attr *oldattr)
Modify attributes of the message queue referred to by the message queue descriptor mqdes.
Definition: mqueue.c:210
int mq_send(mqd_t mqdes, const char *msg_ptr, size_t msg_len, unsigned int msg_prio)
Add the message pointed to by msg_ptr to the message queue referred to by the message queue descripto...
Definition: mqueue.c:271