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(shmid_ds_t)
21 /* The C library generally exports the struct the current kernel expects. */
23 typedef struct shmid_ds shmid_ds_t;
24 #elif defined HAVE_LINUX_SHM_H
25 /* The linux header might provide the right struct. */
26 # include <linux/shm.h>
27 typedef struct shmid64_ds shmid_ds_t;
32 #include "xlat/shmctl_flags.h"
35 print_shmid_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, &shmid_ds))
47 tprints("{shm_perm={");
48 printuid("uid=", shmid_ds.shm_perm.uid);
49 printuid(", gid=", shmid_ds.shm_perm.gid);
51 print_numeric_umode_t(shmid_ds.shm_perm.mode);
53 if (cmd != IPC_STAT) {
58 tprintf(", key=%u", (unsigned) shmid_ds.shm_perm.__key);
59 printuid(", cuid=", shmid_ds.shm_perm.cuid);
60 printuid(", cgid=", shmid_ds.shm_perm.cgid);
62 tprintf(", shm_segsz=%u", (unsigned) shmid_ds.shm_segsz);
63 tprintf(", shm_cpid=%u", (unsigned) shmid_ds.shm_cpid);
64 tprintf(", shm_lpid=%u", (unsigned) shmid_ds.shm_lpid);
65 tprintf(", shm_nattch=%u", (unsigned) shmid_ds.shm_nattch);
66 tprintf(", shm_atime=%u", (unsigned) shmid_ds.shm_atime);
67 tprintf(", shm_dtime=%u", (unsigned) shmid_ds.shm_dtime);
68 tprintf(", shm_ctime=%u", (unsigned) shmid_ds.shm_ctime);
81 tprintf("%d, ", (int) tcp->u_arg[0]);
82 PRINTCTL(shmctl_flags, tcp->u_arg[1], "SHM_???");
85 const kernel_ulong_t addr = tcp->u_arg[indirect_ipccall(tcp) ? 3 : 2];
86 print_shmid_ds(tcp, addr, tcp->u_arg[1]);