summaryrefslogtreecommitdiff
path: root/components/libc/pthreads/mqueue.h
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2016-05-10 09:22:01 +0800
committerBernard Xiong <[email protected]>2016-05-10 09:22:01 +0800
commit64feef0dde9d8353ffe4a3f257ab17848ccf6f53 (patch)
treedd3f096b8a3c249e5327cc34a0c105c5125099e1 /components/libc/pthreads/mqueue.h
parenteb320a0104bbaa6c1235fe899b6d099fdabe8c25 (diff)
[LIBC] mv pthreads/libdl to libc and rename dfs_lwip to dfs_net
Diffstat (limited to 'components/libc/pthreads/mqueue.h')
-rw-r--r--components/libc/pthreads/mqueue.h73
1 files changed, 73 insertions, 0 deletions
diff --git a/components/libc/pthreads/mqueue.h b/components/libc/pthreads/mqueue.h
new file mode 100644
index 0000000000..de2925837f
--- /dev/null
+++ b/components/libc/pthreads/mqueue.h
@@ -0,0 +1,73 @@
+/*
+ * File : mqueue.h
+ * This file is part of RT-Thread RTOS
+ * COPYRIGHT (C) 2012, RT-Thread Development Team
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Change Logs:
+ * Date Author Notes
+ */
+
+#ifndef __MQUEUE_H__
+#define __MQUEUE_H__
+
+#include <rtthread.h>
+#include <pthread.h>
+
+struct mqdes
+{
+ /* reference count and unlinked */
+ rt_uint16_t refcount;
+ rt_uint16_t unlinked;
+
+ /* RT-Thread message queue */
+ rt_mq_t mq;
+ /* next posix mqueue */
+ struct mqdes* next;
+};
+typedef struct mqdes* mqd_t;
+
+struct mq_attr
+{
+ long mq_flags; /* Message queue flags. */
+ long mq_maxmsg; /* Maximum number of messages. */
+ long mq_msgsize; /* Maximum message size. */
+ long mq_curmsgs; /* Number of messages currently queued. */
+};
+
+int mq_close(mqd_t mqdes);
+int mq_getattr(mqd_t mqdes, struct mq_attr *mqstat);
+int mq_notify(mqd_t mqdes, const struct sigevent *notification);
+mqd_t mq_open(const char *name, int oflag, ...);
+ssize_t mq_receive(mqd_t mqdes, char *msg_ptr, size_t msg_len, unsigned *msg_prio);
+int mq_send(mqd_t mqdes, const char *msg_ptr, size_t msg_len, unsigned msg_prio);
+int mq_setattr(mqd_t mqdes,
+ const struct mq_attr *mqstat,
+ struct mq_attr *omqstat);
+ssize_t mq_timedreceive(mqd_t mqdes,
+ char *msg_ptr,
+ size_t msg_len,
+ unsigned *msg_prio,
+ const struct timespec *abs_timeout);
+int mq_timedsend(mqd_t mqdes,
+ const char *msg_ptr,
+ size_t msg_len,
+ unsigned msg_prio,
+ const struct timespec *abs_timeout);
+
+int mq_unlink(const char *name);
+
+#endif