Dmitry V. Levin | 28471d1 | 2015-08-01 20:36:53 +0000 | [diff] [blame] | 1 | #include "defs.h" |
Dmitry V. Levin | c8cba99 | 2015-08-01 21:08:13 +0000 | [diff] [blame^] | 2 | #include <fcntl.h> |
| 3 | #ifdef HAVE_SYS_EVENTFD_H |
| 4 | # include <sys/eventfd.h> |
| 5 | #endif |
| 6 | |
| 7 | #include "xlat/efd_flags.h" |
Dmitry V. Levin | 28471d1 | 2015-08-01 20:36:53 +0000 | [diff] [blame] | 8 | |
| 9 | static int |
| 10 | do_eventfd(struct tcb *tcp, int flags_arg) |
| 11 | { |
Dmitry V. Levin | 00cc350 | 2015-08-01 20:43:51 +0000 | [diff] [blame] | 12 | tprintf("%u", (unsigned int) tcp->u_arg[0]); |
Dmitry V. Levin | 28471d1 | 2015-08-01 20:36:53 +0000 | [diff] [blame] | 13 | if (flags_arg >= 0) { |
| 14 | tprints(", "); |
Dmitry V. Levin | c8cba99 | 2015-08-01 21:08:13 +0000 | [diff] [blame^] | 15 | printflags(efd_flags, tcp->u_arg[flags_arg], "EFD_???"); |
Dmitry V. Levin | 28471d1 | 2015-08-01 20:36:53 +0000 | [diff] [blame] | 16 | } |
| 17 | |
Dmitry V. Levin | ede0c48 | 2015-08-01 20:39:48 +0000 | [diff] [blame] | 18 | return RVAL_DECODED | RVAL_FD; |
Dmitry V. Levin | 28471d1 | 2015-08-01 20:36:53 +0000 | [diff] [blame] | 19 | } |
| 20 | |
| 21 | SYS_FUNC(eventfd) |
| 22 | { |
| 23 | return do_eventfd(tcp, -1); |
| 24 | } |
| 25 | |
| 26 | SYS_FUNC(eventfd2) |
| 27 | { |
| 28 | return do_eventfd(tcp, 1); |
| 29 | } |