lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | /* |
| 2 | * mq_getattr.c - get message queue attributes. |
| 3 | */ |
| 4 | |
| 5 | #include <errno.h> |
| 6 | #include <stddef.h> |
| 7 | #include <sys/syscall.h> |
| 8 | |
| 9 | #include <mqueue.h> |
| 10 | |
| 11 | #ifdef __NR_mq_getsetattr |
| 12 | |
| 13 | librt_hidden_proto(mq_setattr) |
| 14 | #define __NR___syscall_mq_getsetattr __NR_mq_getsetattr |
| 15 | static __inline__ _syscall3(int, __syscall_mq_getsetattr, int, mqdes, |
| 16 | const void *, mqstat, void *, omqstat); |
| 17 | |
| 18 | /* |
| 19 | * Set attributes associated with message queue (and possibly also get |
| 20 | * its old attributes) |
| 21 | */ |
| 22 | int mq_setattr(mqd_t mqdes, const struct mq_attr *mqstat, |
| 23 | struct mq_attr *omqstat) |
| 24 | { |
| 25 | return __syscall_mq_getsetattr(mqdes, mqstat, omqstat); |
| 26 | } |
| 27 | |
| 28 | librt_hidden_def(mq_setattr) |
| 29 | |
| 30 | /* Query status and attributes of message queue */ |
| 31 | int mq_getattr(mqd_t mqdes, struct mq_attr *mqstat) |
| 32 | { |
| 33 | return mq_setattr(mqdes, NULL, mqstat); |
| 34 | } |
| 35 | |
| 36 | #endif |