2 * Copyright (c) 2004-2007 Ulrich Drepper <drepper@redhat.com>
3 * Copyright (c) 2004 Roland McGrath <roland@redhat.com>
4 * Copyright (c) 2005-2015 Dmitry V. Levin <ldv@altlinux.org>
5 * Copyright (c) 2015-2018 The strace developers.
8 * SPDX-License-Identifier: LGPL-2.1-or-later
13 #include <sys/epoll.h>
15 SYS_FUNC(epoll_create)
17 tprintf("%d", (int) tcp->u_arg[0]);
19 return RVAL_DECODED | RVAL_FD;
22 #include "xlat/epollflags.h"
24 SYS_FUNC(epoll_create1)
26 printflags(epollflags, tcp->u_arg[0], "EPOLL_???");
28 return RVAL_DECODED | RVAL_FD;
31 #include "xlat/epollevents.h"
34 print_epoll_event(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
36 const struct epoll_event *ev = elem_buf;
39 printflags(epollevents, ev->events, "EPOLL???");
40 /* We cannot know what format the program uses, so print u32 and u64
41 which will cover every value. */
42 tprintf(", {u32=%" PRIu32 ", u64=%" PRIu64 "}}",
43 ev->data.u32, ev->data.u64);
48 #include "xlat/epollctls.h"
52 printfd(tcp, tcp->u_arg[0]);
54 const unsigned int op = tcp->u_arg[1];
55 printxval(epollctls, op, "EPOLL_CTL_???");
57 printfd(tcp, tcp->u_arg[2]);
59 struct epoll_event ev;
60 if (EPOLL_CTL_DEL == op)
61 printaddr(tcp->u_arg[3]);
62 else if (!umove_or_printaddr(tcp, tcp->u_arg[3], &ev))
63 print_epoll_event(tcp, &ev, sizeof(ev), 0);
69 epoll_wait_common(struct tcb *tcp)
72 printfd(tcp, tcp->u_arg[0]);
75 struct epoll_event ev;
76 print_array(tcp, tcp->u_arg[1], tcp->u_rval, &ev, sizeof(ev),
77 tfetch_mem, print_epoll_event, 0);
78 tprintf(", %d, %d", (int) tcp->u_arg[2], (int) tcp->u_arg[3]);
84 epoll_wait_common(tcp);
90 epoll_wait_common(tcp);
93 /* NB: kernel requires arg[5] == NSIG_BYTES */
94 print_sigset_addr_len(tcp, tcp->u_arg[4], tcp->u_arg[5]);
95 tprintf(", %" PRI_klu, tcp->u_arg[5]);