1 /*
2 * Copyright (c) 2004 Ulrich Drepper <drepper@redhat.com>
3 * Copyright (c) 2005-2015 Dmitry V. Levin <ldv@strace.io>
4 * Copyright (c) 2015-2021 The strace developers.
5 * All rights reserved.
6 *
7 * SPDX-License-Identifier: LGPL-2.1-or-later
8 */
9
10 #include "defs.h"
11
12 #include DEF_MPERS_TYPE(mq_attr_t)
13
14 #include "kernel_types.h"
15 #include <linux/mqueue.h>
16 typedef struct mq_attr mq_attr_t;
17
18 #include MPERS_DEFS
19
20 #include "kernel_fcntl.h"
21 #include "xlat/mq_attr_flags.h"
22
23 MPERS_PRINTER_DECL(void, printmqattr, struct tcb *const tcp,
24 const kernel_ulong_t addr, const bool decode_flags)
25 {
26 mq_attr_t attr;
27 if (umove_or_printaddr(tcp, addr, &attr))
28 return;
29 if (decode_flags) {
30 tprint_struct_begin();
31 PRINT_FIELD_FLAGS(attr, mq_flags, mq_attr_flags, "O_???");
32 } else {
33 tprint_struct_begin();
34 PRINT_FIELD_X(attr, mq_flags);
35 }
36 tprint_struct_next();
37 PRINT_FIELD_D(attr, mq_maxmsg);
38 tprint_struct_next();
39 PRINT_FIELD_D(attr, mq_msgsize);
40 tprint_struct_next();
41 PRINT_FIELD_D(attr, mq_curmsgs);
42 tprint_struct_end();
43 }