strace/tests/eventfd.c
Dmitry V. Levin 857adac3a5 tests: fix build on systems that lack O_CLOEXEC definition
* tests/epoll_create1.c (main): Check that O_CLOEXEC is defined.
* tests/eventfd.c (main): Likewise.
* tests/signalfd.c (main): Likewise.
2015-08-26 21:05:17 +00:00

20 lines
312 B
C

#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <fcntl.h>
#include <unistd.h>
#include <sys/syscall.h>
int
main(void)
{
#if defined __NR_eventfd2 && defined O_CLOEXEC
(void) close(0);
return syscall(__NR_eventfd2, -1L, 1 | O_CLOEXEC | O_NONBLOCK) == 0 ?
0 : 77;
#else
return 77;
#endif
}