blob: b50d9a974f62cf1696a0c80e68b4160fb5ca62b3 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001/*
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
13librt_hidden_proto(mq_setattr)
14#define __NR___syscall_mq_getsetattr __NR_mq_getsetattr
15static __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 */
22int 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
28librt_hidden_def(mq_setattr)
29
30/* Query status and attributes of message queue */
31int mq_getattr(mqd_t mqdes, struct mq_attr *mqstat)
32{
33 return mq_setattr(mqdes, NULL, mqstat);
34}
35
36#endif