mq_getsetattr.c 817 B

123456789101112131415161718192021222324252627282930313233343536
  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. librt_hidden_proto(mq_setattr)
  10. #define __NR___syscall_mq_getsetattr __NR_mq_getsetattr
  11. static __inline__ _syscall3(int, __syscall_mq_getsetattr, int, mqdes,
  12. const void *, mqstat, void *, omqstat);
  13. /*
  14. * Set attributes associated with message queue (and possibly also get
  15. * its old attributes)
  16. */
  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. librt_hidden_def(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