]> granicus.if.org Git - strace/blob - tests/userfaultfd.c
2668986970fc4a8bc2c2a52c46bad78687820c10
[strace] / tests / userfaultfd.c
1 /*
2  * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org>
3  * All rights reserved.
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  */
7
8 #include "tests.h"
9 #include <fcntl.h>
10 #include <asm/unistd.h>
11 #include "scno.h"
12
13 #if defined __NR_userfaultfd && defined O_CLOEXEC
14
15 # include <stdio.h>
16 # include <unistd.h>
17
18 int
19 main(void)
20 {
21         long rc = syscall(__NR_userfaultfd, 1 | O_NONBLOCK | O_CLOEXEC);
22         printf("userfaultfd(O_NONBLOCK|O_CLOEXEC|0x1) = %ld %s (%m)\n",
23                rc, errno2name());
24         puts("+++ exited with 0 +++");
25         return 0;
26 }
27
28 #else
29
30 SKIP_MAIN_UNDEFINED("__NR_userfaultfd && O_CLOEXEC")
31
32 #endif