blob: 2dcf31cb3c237345dedebd29851d6e8f51f6d298 [file] [log] [blame]
Dmitry V. Levina6ebdb12015-11-15 02:22:44 +00001#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
11int
12main(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}