aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2015-08-25 14:20:17 +1000
committerStephen Rothwell <sfr@canb.auug.org.au>2015-08-25 14:20:17 +1000
commit9cd61f5b0d6dfe91a4b25077898bccfdd96f8991 (patch)
tree6f7f64493bd47206dc9dddf15c4cdfe24bc44091 /tools
parentcee01619dc5696c648e3c601387f8692e1c589ed (diff)
selftests: vm: pick up sanitized kernel headers
Add the usr/include subdirectory of the top-level tree to the include path, and make sure to include headers without relative paths to make sure the sanitized headers get picked up. Otherwise the compiler will not be able to find the linux/compiler.h header included by the non- sanitized include/uapi/linux/userfaultfd.h. While at it, make sure to only hardcode the syscall numbers on x86 and PowerPC if they haven't been properly picked up from the headers. Signed-off-by: Thierry Reding <treding@nvidia.com> Cc: Shuah Khan <shuahkh@osg.samsung.com> Cc: Andrea Arcangeli <aarcange@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/selftests/vm/Makefile2
-rw-r--r--tools/testing/selftests/vm/userfaultfd.c4
2 files changed, 4 insertions, 2 deletions
diff --git a/tools/testing/selftests/vm/Makefile b/tools/testing/selftests/vm/Makefile
index 0d6854744b37..33f7bbf5ab03 100644
--- a/tools/testing/selftests/vm/Makefile
+++ b/tools/testing/selftests/vm/Makefile
@@ -1,6 +1,6 @@
# Makefile for vm selftests
-CFLAGS = -Wall
+CFLAGS = -Wall -I ../../../../usr/include $(EXTRA_CFLAGS)
BINARIES = compaction_test
BINARIES += hugepage-mmap
BINARIES += hugepage-shm
diff --git a/tools/testing/selftests/vm/userfaultfd.c b/tools/testing/selftests/vm/userfaultfd.c
index 0c0b83953352..7dfbd6b78511 100644
--- a/tools/testing/selftests/vm/userfaultfd.c
+++ b/tools/testing/selftests/vm/userfaultfd.c
@@ -64,8 +64,9 @@
#include <sys/syscall.h>
#include <sys/ioctl.h>
#include <pthread.h>
-#include "../../../../include/uapi/linux/userfaultfd.h"
+#include <linux/userfaultfd.h>
+#ifndef __NR_userfaultfd
#ifdef __x86_64__
#define __NR_userfaultfd 323
#elif defined(__i386__)
@@ -75,6 +76,7 @@
#else
#error "missing __NR_userfaultfd definition"
#endif
+#endif
static unsigned long nr_cpus, nr_pages, nr_pages_per_cpu, page_size;