2 * Copyright (c) 2015 Dmitry V. Levin <ldv@altlinux.org>
3 * Copyright (c) 2015-2018 The strace developers.
6 * SPDX-License-Identifier: LGPL-2.1-or-later
10 #include "print_fields.h"
11 #include "xlat/kcmp_types.h"
13 struct strace_kcmp_epoll_slot {
20 printpidfd(struct tcb *tcp, pid_t pid, int fd)
23 * XXX We want to use printfd here, but we should figure out which
24 * process in strace's PID NS is referred to first.
29 #define PRINT_FIELD_PIDFD(prefix_, where_, field_, tcp_, pid_) \
31 STRACE_PRINTF("%s%s=", (prefix_), #field_); \
32 printpidfd((tcp_), (pid_), (where_).field_); \
37 pid_t pid1 = tcp->u_arg[0];
38 pid_t pid2 = tcp->u_arg[1];
39 int type = tcp->u_arg[2];
40 kernel_ulong_t idx1 = tcp->u_arg[3];
41 kernel_ulong_t idx2 = tcp->u_arg[4];
43 tprintf("%d, %d, ", pid1, pid2);
44 printxval(kcmp_types, type, "KCMP_???");
49 printpidfd(tcp, pid1, idx1);
51 printpidfd(tcp, pid1, idx2);
55 case KCMP_EPOLL_TFD: {
56 struct strace_kcmp_epoll_slot slot;
59 printpidfd(tcp, pid1, idx1);
62 if (umove_or_printaddr(tcp, idx2, &slot))
65 PRINT_FIELD_PIDFD("{", slot, efd, tcp, pid2);
66 PRINT_FIELD_PIDFD(", ", slot, tfd, tcp, pid2);
67 PRINT_FIELD_U(", ", slot, toff);
81 tprintf(", %#" PRI_klx ", %#" PRI_klx, idx1, idx2);