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-2017 The strace developers.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. The name of the author may not be used to endorse or promote products
17 * derived from this software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 #include <sys/epoll.h>
35 SYS_FUNC(epoll_create)
37 tprintf("%d", (int) tcp->u_arg[0]);
39 return RVAL_DECODED | RVAL_FD;
42 #include "xlat/epollflags.h"
44 SYS_FUNC(epoll_create1)
46 printflags(epollflags, tcp->u_arg[0], "EPOLL_???");
48 return RVAL_DECODED | RVAL_FD;
51 #include "xlat/epollevents.h"
54 print_epoll_event(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
56 const struct epoll_event *ev = elem_buf;
59 printflags(epollevents, ev->events, "EPOLL???");
60 /* We cannot know what format the program uses, so print u32 and u64
61 which will cover every value. */
62 tprintf(", {u32=%" PRIu32 ", u64=%" PRIu64 "}}",
63 ev->data.u32, ev->data.u64);
68 #include "xlat/epollctls.h"
72 printfd(tcp, tcp->u_arg[0]);
74 const unsigned int op = tcp->u_arg[1];
75 printxval(epollctls, op, "EPOLL_CTL_???");
77 printfd(tcp, tcp->u_arg[2]);
79 struct epoll_event ev;
80 if (EPOLL_CTL_DEL == op)
81 printaddr(tcp->u_arg[3]);
82 else if (!umove_or_printaddr(tcp, tcp->u_arg[3], &ev))
83 print_epoll_event(tcp, &ev, sizeof(ev), 0);
89 epoll_wait_common(struct tcb *tcp)
92 printfd(tcp, tcp->u_arg[0]);
95 struct epoll_event ev;
96 print_array(tcp, tcp->u_arg[1], tcp->u_rval, &ev, sizeof(ev),
97 umoven_or_printaddr, print_epoll_event, 0);
98 tprintf(", %d, %d", (int) tcp->u_arg[2], (int) tcp->u_arg[3]);
104 epoll_wait_common(tcp);
108 SYS_FUNC(epoll_pwait)
110 epoll_wait_common(tcp);
113 /* NB: kernel requires arg[5] == NSIG_BYTES */
114 print_sigset_addr_len(tcp, tcp->u_arg[4], tcp->u_arg[5]);
115 tprintf(", %" PRI_klu, tcp->u_arg[5]);