Commit 56ed8f16 authored by Michael Ellerman's avatar Michael Ellerman Committed by Linus Torvalds

userfaultfd: selftest: only warn if __NR_userfaultfd is undefined

If __NR_userfaultfd is not yet defined by the arch, warn but still build
and run the userfaultfd selftest successfully.
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Signed-off-by: default avatarAndrea 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: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 67f6a029
...@@ -66,9 +66,7 @@ ...@@ -66,9 +66,7 @@
#include <pthread.h> #include <pthread.h>
#include <linux/userfaultfd.h> #include <linux/userfaultfd.h>
#ifndef __NR_userfaultfd #ifdef __NR_userfaultfd
#error "missing __NR_userfaultfd definition"
#endif
static unsigned long nr_cpus, nr_pages, nr_pages_per_cpu, page_size; static unsigned long nr_cpus, nr_pages, nr_pages_per_cpu, page_size;
...@@ -631,3 +629,15 @@ int main(int argc, char **argv) ...@@ -631,3 +629,15 @@ int main(int argc, char **argv)
nr_pages, nr_pages_per_cpu); nr_pages, nr_pages_per_cpu);
return userfaultfd_stress(); 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 */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment