mqueue.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. #ifndef __MQUEUE_H__
  2. #define __MQUEUE_H__
  3. #include <rtthread.h>
  4. #include <sys/types.h>
  5. #include <sys/time.h>
  6. #include <sys/signal.h>
  7. #include <pthread.h>
  8. typedef rt_mq_t mqd_t;
  9. struct mq_attr
  10. {
  11. long mq_flags; /* Message queue flags. */
  12. long mq_maxmsg; /* Maximum number of messages. */
  13. long mq_msgsize; /* Maximum message size. */
  14. long mq_curmsgs; /* Number of messages currently queued. */
  15. };
  16. int mq_close(mqd_t mqdes);
  17. int mq_getattr(mqd_t mqdes, struct mq_attr *mqstat);
  18. int mq_notify(mqd_t mqdes, const struct sigevent *notification);
  19. mqd_t mq_open(const char *name, int oflag, ...);
  20. ssize_t mq_receive(mqd_t mqdes, char *msg_ptr, size_t msg_len, unsigned *msg_prio);
  21. int mq_send(mqd_t mqdes, const char *msg_ptr, size_t msg_len, unsigned msg_prio);
  22. int mq_setattr(mqd_t mqdes, const struct mq_attr *mqstat,
  23. struct mq_attr *omqstat);
  24. ssize_t mq_timedreceive(mqd_t mqdes, char *msg_ptr, size_t msg_len,
  25. unsigned *msg_prio, const struct timespec *abs_timeout);
  26. int mq_timedsend(mqd_t mqdes, const char *msg_ptr, size_t msg_len, unsigned msg_prio,
  27. const struct timespec *abs_timeout);
  28. int mq_unlink(const char *name);
  29. #endif