mqueue.h 1.2 KB

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