]> granicus.if.org Git - strace/blob - print_mq_attr.c
tests: workaround systemd-nspawn habit of disabling unimplemented syscalls
[strace] / print_mq_attr.c
1 /*
2  * Copyright (c) 2004 Ulrich Drepper <drepper@redhat.com>
3  * Copyright (c) 2005-2015 Dmitry V. Levin <ldv@altlinux.org>
4  * Copyright (c) 2015-2018 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 #ifdef HAVE_MQUEUE_H
15 # include <mqueue.h>
16 typedef struct mq_attr mq_attr_t;
17 #elif defined HAVE_LINUX_MQUEUE_H
18 # include <linux/types.h>
19 # include <linux/mqueue.h>
20 typedef struct mq_attr mq_attr_t;
21 #endif
22
23 #include "xlat/mq_attr_flags.h"
24
25 #include MPERS_DEFS
26
27 MPERS_PRINTER_DECL(void, printmqattr, struct tcb *const tcp,
28                    const kernel_ulong_t addr, const bool decode_flags)
29 {
30 #if defined HAVE_MQUEUE_H || defined HAVE_LINUX_MQUEUE_H
31         mq_attr_t attr;
32         if (umove_or_printaddr(tcp, addr, &attr))
33                 return;
34         tprints("{mq_flags=");
35         if (decode_flags)
36                 printflags64(mq_attr_flags,
37                              zero_extend_signed_to_ull(attr.mq_flags),
38                              "O_???");
39         else
40                 tprintf("%#llx", zero_extend_signed_to_ull(attr.mq_flags));
41         tprintf(", mq_maxmsg=%lld, mq_msgsize=%lld, mq_curmsgs=%lld}",
42                 sign_extend_unsigned_to_ll(attr.mq_maxmsg),
43                 sign_extend_unsigned_to_ll(attr.mq_msgsize),
44                 sign_extend_unsigned_to_ll(attr.mq_curmsgs));
45 #else
46         printaddr(addr);
47 #endif
48 }