Fix decoding of epoll_ctl operation argument
Consistently treat operation argument of epoll_ctl syscall as int
to match the kernel behaviour.
* epoll.c (SYS_FUNC(epoll_ctl)): Assign 2nd argument of syscall
to a variable of type unsigned int and use it in all subsequent
checks and lookups.
* tests/epoll_ctl.c (invoke_syscall): New function.
(main): Use it.
diff --git a/epoll.c b/epoll.c
index 20d306c..7382e0c 100644
--- a/epoll.c
+++ b/epoll.c
@@ -70,12 +70,13 @@
{
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
- printxval(epollctls, tcp->u_arg[1], "EPOLL_CTL_???");
+ const unsigned int op = tcp->u_arg[1];
+ printxval(epollctls, op, "EPOLL_CTL_???");
tprints(", ");
printfd(tcp, tcp->u_arg[2]);
tprints(", ");
struct epoll_event ev;
- if (EPOLL_CTL_DEL == tcp->u_arg[1])
+ if (EPOLL_CTL_DEL == op)
printaddr(tcp->u_arg[3]);
else if (!umove_or_printaddr(tcp, tcp->u_arg[3], &ev))
print_epoll_event(tcp, &ev, sizeof(ev), 0);