1
0

mqueue.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #ifndef __MQUEUE_H__
  2. #define __MQUEUE_H__
  3. #include <rtthread.h>
  4. #include <pthread.h>
  5. struct mqdes
  6. {
  7. /* reference count and unlinked */
  8. rt_uint16_t refcount;
  9. rt_uint16_t unlinked;
  10. /* RT-Thread message queue */
  11. rt_mq_t mq;
  12. /* next posix mqueue */
  13. struct mqdes* next;
  14. };
  15. typedef struct mqdes* mqd_t;
  16. struct mq_attr
  17. {
  18. long mq_flags; /* Message queue flags. */
  19. long mq_maxmsg; /* Maximum number of messages. */
  20. long mq_msgsize; /* Maximum message size. */
  21. long mq_curmsgs; /* Number of messages currently queued. */
  22. };
  23. int mq_close(mqd_t mqdes);
  24. int mq_getattr(mqd_t mqdes, struct mq_attr *mqstat);
  25. int mq_notify(mqd_t mqdes, const struct sigevent *notification);
  26. mqd_t mq_open(const char *name, int oflag, ...);
  27. ssize_t mq_receive(mqd_t mqdes, char *msg_ptr, size_t msg_len, unsigned *msg_prio);
  28. int mq_send(mqd_t mqdes, const char *msg_ptr, size_t msg_len, unsigned msg_prio);
  29. int mq_setattr(mqd_t mqdes, const struct mq_attr *mqstat,
  30. struct mq_attr *omqstat);
  31. ssize_t mq_timedreceive(mqd_t mqdes, char *msg_ptr, size_t msg_len,
  32. unsigned *msg_prio, const struct timespec *abs_timeout);
  33. int mq_timedsend(mqd_t mqdes, const char *msg_ptr, size_t msg_len, unsigned msg_prio,
  34. const struct timespec *abs_timeout);
  35. int mq_unlink(const char *name);
  36. #endif