]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
userfaultfd: selftest: only warn if __NR_userfaultfd is undefined
authorMichael Ellerman <mpe@ellerman.id.au>
Tue, 22 Sep 2015 21:58:58 +0000 (14:58 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 22 Sep 2015 22:09:53 +0000 (15:09 -0700)
If __NR_userfaultfd is not yet defined by the arch, warn but still build
and run the userfaultfd selftest successfully.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
Cc: Dr. David Alan Gilbert <dgilbert@redhat.com>
Cc: Shuah Khan <shuahkh@osg.samsung.com>
Cc: Thierry Reding <treding@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
tools/testing/selftests/vm/userfaultfd.c

index a9e0b9143f06f7a31b5da01e885e53764809c4e9..0671ae1d1052e0fc53d638d7ed5aa14f51253e8e 100644 (file)
@@ -66,9 +66,7 @@
 #include <pthread.h>
 #include <linux/userfaultfd.h>
 
-#ifndef __NR_userfaultfd
-#error "missing __NR_userfaultfd definition"
-#endif
+#ifdef __NR_userfaultfd
 
 static unsigned long nr_cpus, nr_pages, nr_pages_per_cpu, page_size;
 
@@ -631,3 +629,15 @@ int main(int argc, char **argv)
               nr_pages, nr_pages_per_cpu);
        return userfaultfd_stress();
 }
+
+#else /* __NR_userfaultfd */
+
+#warning "missing __NR_userfaultfd definition"
+
+int main(void)
+{
+       printf("skip: Skipping userfaultfd test (missing __NR_userfaultfd)\n");
+       return 0;
+}
+
+#endif /* __NR_userfaultfd */