]> granicus.if.org Git - strace/blob - tests/epoll_create1.c
tests: fix build on systems that lack O_CLOEXEC definition
[strace] / tests / epoll_create1.c
1 #ifdef HAVE_CONFIG_H
2 # include "config.h"
3 #endif
4
5 #include <fcntl.h>
6 #include <unistd.h>
7 #include <sys/syscall.h>
8
9 int
10 main(void)
11 {
12 #if defined __NR_epoll_create1 && defined O_CLOEXEC
13         (void) close(0);
14         if (syscall(__NR_epoll_create1, O_CLOEXEC))
15                 return 77;
16         return syscall(__NR_epoll_create1, O_CLOEXEC | O_NONBLOCK) >= 0;
17 #else
18         return 77;
19 #endif
20 }