summaryrefslogtreecommitdiff
path: root/src/epoll.c
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@strace.io>2021-02-14 08:00:00 +0000
committerDmitry V. Levin <ldv@strace.io>2021-02-14 08:00:00 +0000
commitf8144e5f9e5d8a6399049893a704346f5c04b0c7 (patch)
treebd1c0e638420aeb013a7562bc1389bf83f90804f /src/epoll.c
parentaebc987170528342b2c31f60b60a0f6fb071b24c (diff)
downloadstrace-f8144e5f9e5d8a6399049893a704346f5c04b0c7.tar.gz
Implement decoding of epoll_pwait2 syscall
Introduced by Linux kernel commits v5.11-rc1~61^2~3 and v5.11-rc1~61^2~2. * src/epoll.c (epoll_wait_common): Add print_timeout argument, use it to print tcp->u_arg[3]. (print_timeout_int): New function. (SYS_FUNC(epoll_wait)): Pass it to epoll_wait_common. (epoll_pwait_common): New function. (SYS_FUNC(epoll_pwait)): Use it. (SYS_FUNC(epoll_pwait2)): New function. * src/linux/generic/syscallent-common.h [BASE_NR + 441]: Wire up epoll_pwait2. * NEWS: Mention this change. * tests/epoll_pwait2.c: New file. * tests/epoll_pwait2-P.c: Likewise. * tests/epoll_pwait2-y.c: Likewise. * tests/gen_tests.in (epoll_pwait2, epoll_pwait2-P, epoll_pwait2-y): New entries. * tests/pure_executables.list: Add epoll_pwait2, epoll_pwait2-P, and epoll_pwait2-y. * tests/.gitignore: Likewise.
Diffstat (limited to 'src/epoll.c')
-rw-r--r--src/epoll.c31
1 files changed, 26 insertions, 5 deletions
diff --git a/src/epoll.c b/src/epoll.c
index d87e0b8bc..80f2ed511 100644
--- a/src/epoll.c
+++ b/src/epoll.c
@@ -79,7 +79,7 @@ SYS_FUNC(epoll_ctl)
}
static void
-epoll_wait_common(struct tcb *tcp)
+epoll_wait_common(struct tcb *tcp, const print_obj_by_addr_fn print_timeout)
{
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
@@ -88,19 +88,30 @@ epoll_wait_common(struct tcb *tcp)
struct epoll_event ev;
print_array(tcp, tcp->u_arg[1], tcp->u_rval, &ev, sizeof(ev),
tfetch_mem, print_epoll_event, 0);
- tprintf(", %d, %d", (int) tcp->u_arg[2], (int) tcp->u_arg[3]);
+ tprints(", ");
+ tprintf("%d", (int) tcp->u_arg[2]);
+ tprints(", ");
+ print_timeout(tcp, tcp->u_arg[3]);
}
}
+static int
+print_timeout_int(struct tcb *tcp, kernel_ulong_t arg)
+{
+ tprintf("%d", (int) arg);
+ return 0;
+}
+
SYS_FUNC(epoll_wait)
{
- epoll_wait_common(tcp);
+ epoll_wait_common(tcp, print_timeout_int);
return 0;
}
-SYS_FUNC(epoll_pwait)
+static int
+epoll_pwait_common(struct tcb *tcp, const print_obj_by_addr_fn print_timeout)
{
- epoll_wait_common(tcp);
+ epoll_wait_common(tcp, print_timeout);
if (exiting(tcp)) {
tprints(", ");
/* NB: kernel requires arg[5] == NSIG_BYTES */
@@ -109,3 +120,13 @@ SYS_FUNC(epoll_pwait)
}
return 0;
}
+
+SYS_FUNC(epoll_pwait)
+{
+ return epoll_pwait_common(tcp, print_timeout_int);
+}
+
+SYS_FUNC(epoll_pwait2)
+{
+ return epoll_pwait_common(tcp, print_timespec64);
+}