2 * Copyright (c) 1993 Ulrich Pegelow <pegelow@moorea.uni-muenster.de>
3 * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
4 * Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
5 * Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
6 * Copyright (c) 2003-2006 Roland McGrath <roland@redhat.com>
7 * Copyright (c) 2006-2015 Dmitry V. Levin <ldv@altlinux.org>
8 * Copyright (c) 2015-2018 The strace developers.
11 * SPDX-License-Identifier: LGPL-2.1-or-later
16 #include DEF_MPERS_TYPE(msqid_ds_t)
21 /* The C library generally exports the struct the current kernel expects. */
23 typedef struct msqid_ds msqid_ds_t;
24 #elif defined HAVE_LINUX_MSG_H
25 /* The linux header might provide the right struct. */
26 # include <linux/msg.h>
27 typedef struct msqid64_ds msqid_ds_t;
32 #include "xlat/msgctl_flags.h"
35 print_msqid_ds(struct tcb *const tcp, const kernel_ulong_t addr, int cmd)
37 /* TODO: We don't properly decode old compat ipc calls. */
44 if (umove_or_printaddr(tcp, addr, &msqid_ds))
47 tprints("{msg_perm={");
48 printuid("uid=", msqid_ds.msg_perm.uid);
49 printuid(", gid=", msqid_ds.msg_perm.gid);
51 print_numeric_umode_t(msqid_ds.msg_perm.mode);
53 if (cmd != IPC_STAT) {
58 tprintf(", key=%u", (unsigned) msqid_ds.msg_perm.__key);
59 printuid(", cuid=", msqid_ds.msg_perm.cuid);
60 printuid(", cgid=", msqid_ds.msg_perm.cgid);
62 tprintf(", msg_stime=%u", (unsigned) msqid_ds.msg_stime);
63 tprintf(", msg_rtime=%u", (unsigned) msqid_ds.msg_rtime);
64 tprintf(", msg_ctime=%u", (unsigned) msqid_ds.msg_ctime);
65 tprintf(", msg_qnum=%u", (unsigned) msqid_ds.msg_qnum);
66 tprintf(", msg_qbytes=%u", (unsigned) msqid_ds.msg_qbytes);
67 tprintf(", msg_lspid=%u", (unsigned) msqid_ds.msg_lspid);
68 tprintf(", msg_lrpid=%u", (unsigned) msqid_ds.msg_lrpid);
81 tprintf("%d, ", (int) tcp->u_arg[0]);
82 PRINTCTL(msgctl_flags, tcp->u_arg[1], "MSG_???");
85 const kernel_ulong_t addr = tcp->u_arg[indirect_ipccall(tcp) ? 3 : 2];
86 print_msqid_ds(tcp, addr, tcp->u_arg[1]);