Dmitry V. Levin
c8cba990a2
* configure.ac (AC_CHECK_HEADERS): Add sys/eventfd.h. * eventfd.c: Include <fcntl.h>. [HAVE_SYS_EVENTFD_H] Include <sys/eventfd.h>. Include "xlat/efd_flags.h". (do_eventfd): Use efd_flags for flags decoding. * xlat/efd_flags.in: New file. * tests/eventfd.c: New file. * tests/eventfd.expected: Likewise. * tests/eventfd.test: New test. * tests/Makefile.am (check_PROGRAMS): Add eventfd. (TESTS): Add eventfd.test. (EXTRA_DIST): Add eventfd.expected. * tests/.gitignore: Add eventfd.
30 lines
469 B
C
30 lines
469 B
C
#include "defs.h"
|
|
#include <fcntl.h>
|
|
#ifdef HAVE_SYS_EVENTFD_H
|
|
# include <sys/eventfd.h>
|
|
#endif
|
|
|
|
#include "xlat/efd_flags.h"
|
|
|
|
static int
|
|
do_eventfd(struct tcb *tcp, int flags_arg)
|
|
{
|
|
tprintf("%u", (unsigned int) tcp->u_arg[0]);
|
|
if (flags_arg >= 0) {
|
|
tprints(", ");
|
|
printflags(efd_flags, tcp->u_arg[flags_arg], "EFD_???");
|
|
}
|
|
|
|
return RVAL_DECODED | RVAL_FD;
|
|
}
|
|
|
|
SYS_FUNC(eventfd)
|
|
{
|
|
return do_eventfd(tcp, -1);
|
|
}
|
|
|
|
SYS_FUNC(eventfd2)
|
|
{
|
|
return do_eventfd(tcp, 1);
|
|
}
|