blob: 0f899461d6237499809a64cf67f34aa5cc5e1080 [file] [log] [blame]
Dmitry V. Levin28471d12015-08-01 20:36:53 +00001#include "defs.h"
Dmitry V. Levinc8cba992015-08-01 21:08:13 +00002#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. Levin28471d12015-08-01 20:36:53 +00008
9static int
10do_eventfd(struct tcb *tcp, int flags_arg)
11{
Dmitry V. Levin00cc3502015-08-01 20:43:51 +000012 tprintf("%u", (unsigned int) tcp->u_arg[0]);
Dmitry V. Levin28471d12015-08-01 20:36:53 +000013 if (flags_arg >= 0) {
14 tprints(", ");
Dmitry V. Levinc8cba992015-08-01 21:08:13 +000015 printflags(efd_flags, tcp->u_arg[flags_arg], "EFD_???");
Dmitry V. Levin28471d12015-08-01 20:36:53 +000016 }
17
Dmitry V. Levinede0c482015-08-01 20:39:48 +000018 return RVAL_DECODED | RVAL_FD;
Dmitry V. Levin28471d12015-08-01 20:36:53 +000019}
20
21SYS_FUNC(eventfd)
22{
23 return do_eventfd(tcp, -1);
24}
25
26SYS_FUNC(eventfd2)
27{
28 return do_eventfd(tcp, 1);
29}