mq_getsetattr.c 743 B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * mq_getattr.c - get message queue attributes.
  3. */
  4. #include <errno.h>
  5. #include <stddef.h>
  6. #include <sys/syscall.h>
  7. #include <mqueue.h>
  8. #ifdef __NR_mq_getsetattr
  9. #define __NR___syscall_mq_getsetattr __NR_mq_getsetattr
  10. static inline _syscall3(int, __syscall_mq_getsetattr, int, mqdes,
  11. const void *, mqstat, void *, omqstat);
  12. /*
  13. * Set attributes associated with message queue (and possibly also get
  14. * its old attributes)
  15. */
  16. int mq_setattr(mqd_t mqdes, const struct mq_attr *mqstat,
  17. struct mq_attr *omqstat)
  18. {
  19. return __syscall_mq_getsetattr(mqdes, mqstat, omqstat);
  20. }
  21. /* Query status and attributes of message queue */
  22. int mq_getattr(mqd_t mqdes, struct mq_attr *mqstat)
  23. {
  24. return mq_setattr(mqdes, NULL, mqstat);
  25. }
  26. #endif