1 /*
2 * Copyright (c) 2007 Ulrich Drepper <drepper@redhat.com>
3 * Copyright (c) 2008-2021 Dmitry V. Levin <ldv@strace.io>
4 * All rights reserved.
5 *
6 * SPDX-License-Identifier: LGPL-2.1-or-later
7 */
8
9 #include "defs.h"
10 #include "kernel_fcntl.h"
11 #include "xlat/efd_flags.h"
12
13 static int
14 do_eventfd(struct tcb *tcp, int flags_arg)
15 {
16 /* initval */
17 unsigned int initval = tcp->u_arg[0];
18 PRINT_VAL_U(initval);
19
20 if (flags_arg >= 0) {
21 /* flags */
22 tprint_arg_next();
23 printflags(efd_flags, tcp->u_arg[flags_arg], "EFD_???");
24 }
25
26 return RVAL_DECODED | RVAL_FD;
27 }
28
29 SYS_FUNC(eventfd)
30 {
31 return do_eventfd(tcp, -1);
32 }
33
34 SYS_FUNC(eventfd2)
35 {
36 return do_eventfd(tcp, 1);
37 }