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.
20 lines
286 B
C
20 lines
286 B
C
#ifdef HAVE_CONFIG_H
|
|
# include "config.h"
|
|
#endif
|
|
|
|
#include <fcntl.h>
|
|
#include <unistd.h>
|
|
#include <sys/syscall.h>
|
|
|
|
int
|
|
main(void)
|
|
{
|
|
#ifdef __NR_eventfd2
|
|
(void) close(0);
|
|
return syscall(__NR_eventfd2, -1L, 1 | O_CLOEXEC | O_NONBLOCK) == 0 ?
|
|
0 : 77;
|
|
#else
|
|
return 77;
|
|
#endif
|
|
}
|