Dmitry V. Levin | a6ebdb1 | 2015-11-15 02:22:44 +0000 | [diff] [blame^] | 1 | #ifdef HAVE_CONFIG_H |
| 2 | # include "config.h" |
| 3 | #endif |
| 4 | |
| 5 | #include <errno.h> |
| 6 | #include <fcntl.h> |
| 7 | #include <stdio.h> |
| 8 | #include <unistd.h> |
| 9 | #include <sys/syscall.h> |
| 10 | |
| 11 | int |
| 12 | main(void) |
| 13 | { |
| 14 | #if defined __NR_userfaultfd && defined O_CLOEXEC |
| 15 | if (syscall(__NR_userfaultfd, 1 | O_NONBLOCK | O_CLOEXEC) != -1) |
| 16 | return 77; |
| 17 | printf("userfaultfd(O_NONBLOCK|O_CLOEXEC|0x1) = -1 %s\n", |
| 18 | errno == ENOSYS ? |
| 19 | "ENOSYS (Function not implemented)" : |
| 20 | "EINVAL (Invalid argument)"); |
| 21 | puts("+++ exited with 0 +++"); |
| 22 | return 0; |
| 23 | #else |
| 24 | return 77; |
| 25 | #endif |
| 26 | } |