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 
9 #include <common/list.h>
10 
11 typedef uint32_t mqd_t;
12 
13 struct mq_attr {
14  int mq_flags; /* Flags: 0 or O_NONBLOCK */
15  int mq_maxmsg; /* Max number of the messages in the queue */
16  int mq_msgsize; /* Byte size of the message */
17  int mq_curmsgs; /* Number of the messages currently in the queue */
18 };
19 
28 int mq_getattr(mqd_t mqdes, struct mq_attr *attr);
29 
37 int mq_setattr(mqd_t mqdes,
38  const struct mq_attr *newattr,
39  struct mq_attr *oldattr);
40 
48 mqd_t mq_open(const char *name, int oflag, struct mq_attr *attr);
49 
55 int mq_close(mqd_t mqdes);
56 
57 int mq_unlink(const char *name);
58 
69 ssize_t mq_receive(mqd_t mqdes,
70  char *msg_ptr,
71  size_t msg_len,
72  unsigned int *msg_prio);
73 
83 int mq_send(mqd_t mqdes,
84  const char *msg_ptr,
85  size_t msg_len,
86  unsigned int msg_prio);
87 
88 #endif
Definition: mqueue.h:13
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:204
int mq_close(mqd_t mqdes)
Close the message queue descriptor.
Definition: mqueue.c:209
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:192
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:219
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:197
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:227