* tests/fanotify_init.c: New file. * tests/fanotify_init.test: New test. * tests/.gitignore: Add fanotify_init. * tests/Makefile.am (check_PROGRAMS): Likewise. (DECODER_TESTS): Add fanotify_init.test. --- tests/.gitignore | 1 + tests/Makefile.am | 2 ++ tests/fanotify_init.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++ tests/fanotify_init.test | 6 ++++ 4 files changed, 77 insertions(+) create mode 100644 tests/fanotify_init.c create mode 100755 tests/fanotify_init.test
diff --git a/tests/.gitignore b/tests/.gitignore index 191bb6f..826df34 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -49,6 +49,7 @@ faccessat fadvise64 fadvise64_64 fallocate +fanotify_init fanotify_mark fchdir fchmod diff --git a/tests/Makefile.am b/tests/Makefile.am index e3adfbf..a25df97 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -109,6 +109,7 @@ check_PROGRAMS = \ fadvise64 \ fadvise64_64 \ fallocate \ + fanotify_init \ fanotify_mark \ fchdir \ fchmod \ @@ -470,6 +471,7 @@ DECODER_TESTS = \ fadvise64.test \ fadvise64_64.test \ fallocate.test \ + fanotify_init.test \ fanotify_mark.test \ fchdir.test \ fchmod.test \ diff --git a/tests/fanotify_init.c b/tests/fanotify_init.c new file mode 100644 index 0000000..bfefe0e --- /dev/null +++ b/tests/fanotify_init.c @@ -0,0 +1,68 @@ +#include "tests.h" + +#include <asm/unistd.h> + +#if defined __NR_fanotify_init + +# include <limits.h> +# include <stdio.h> +# include <unistd.h> + +# include "kernel_types.h" + +/* Performs fanotify_init call via the syscall interface. */ +static void +do_call(kernel_ulong_t flags, const char *flags_str, + kernel_ulong_t event_f_flags, const char *event_f_flags_str) +{ + long rc; + + rc = syscall(__NR_fanotify_init, flags, event_f_flags); + + printf("fanotify_init(%s, %s) = %s\n", + flags_str, event_f_flags_str, sprintrc(rc)); +} + +struct strval { + kernel_ulong_t val; + const char *str; +}; + + +int +main(void) +{ + static const struct strval flags[] = { + { (kernel_ulong_t) 0xffffffff00000000ULL, "FAN_CLASS_NOTIF" }, + { (kernel_ulong_t) 0xffffffff0000000cULL, + "0xc /* FAN_CLASS_??? */" }, + { (kernel_ulong_t) 0xdec0deddefaced04ULL, + "FAN_CLASS_CONTENT|0xefaced00 /* FAN_??? */" }, + { (kernel_ulong_t) 0xffffffffffffffffULL, + "0xc /* FAN_CLASS_??? */|FAN_CLOEXEC|FAN_NONBLOCK|" + "FAN_UNLIMITED_QUEUE|FAN_UNLIMITED_MARKS|0xffffffc0" }, + }; + static const struct strval event_f_flags[] = { + { (kernel_ulong_t) 0xffffffff00000000ULL, "O_RDONLY" }, + { (kernel_ulong_t) 0xdeadbeefff000001ULL, + "O_WRONLY|0xff000000" } + }; + + unsigned int i; + unsigned int j; + + + for (i = 0; i < ARRAY_SIZE(flags); i++) + for (j = 0; j < ARRAY_SIZE(event_f_flags); j++) + do_call(flags[i].val, flags[i].str, + event_f_flags[j].val, event_f_flags[j].str); + + puts("+++ exited with 0 +++"); + return 0; +} + +#else + +SKIP_MAIN_UNDEFINED("__NR_fanotify_init") + +#endif diff --git a/tests/fanotify_init.test b/tests/fanotify_init.test new file mode 100755 index 0000000..3bd4663 --- /dev/null +++ b/tests/fanotify_init.test @@ -0,0 +1,6 @@ +#!/bin/sh + +# Check decoding of fanotify_init syscall. + +. "${srcdir=.}/init.sh" +run_strace_match_diff -a32 -- 1.7.10.4 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ Strace-devel mailing list Strace-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/strace-devel