mq_getsetattr.c 802 B

1234567891011121314151617181920212223242526272829303132333435
  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. attribute_hidden
  17. int __mq_setattr(mqd_t mqdes, const struct mq_attr *mqstat,
  18. struct mq_attr *omqstat)
  19. {
  20. return __syscall_mq_getsetattr(mqdes, mqstat, omqstat);
  21. }
  22. strong_alias(__mq_setattr,mq_setattr)
  23. /* Query status and attributes of message queue */
  24. int mq_getattr(mqd_t mqdes, struct mq_attr *mqstat)
  25. {
  26. return __mq_setattr(mqdes, NULL, mqstat);
  27. }
  28. #endif