2 * Check decoding of fanotify_init syscall.
4 * Copyright (c) 2016 Eugene Syromyatnikov <evgsyr@gmail.com>
5 * Copyright (c) 2016-2018 The strace developers.
8 * SPDX-License-Identifier: GPL-2.0-or-later
13 #include <asm/unistd.h>
15 #if defined __NR_fanotify_init
21 /* Performs fanotify_init call via the syscall interface. */
23 do_call(kernel_ulong_t flags, const char *flags_str,
24 kernel_ulong_t event_f_flags, const char *event_f_flags_str)
28 rc = syscall(__NR_fanotify_init, flags, event_f_flags);
30 printf("fanotify_init(%s, %s) = %s\n",
31 flags_str, event_f_flags_str, sprintrc(rc));
43 static const struct strval flags[] = {
44 { F8ILL_KULONG_MASK, "FAN_CLASS_NOTIF" },
45 { (kernel_ulong_t) 0xffffffff0000000cULL,
46 "0xc /* FAN_CLASS_??? */" },
47 { (kernel_ulong_t) 0xdec0deddefaced04ULL,
48 "FAN_CLASS_CONTENT|0xefaced00 /* FAN_??? */" },
49 { (kernel_ulong_t) 0xffffffffffffffffULL,
50 "0xc /* FAN_CLASS_??? */|FAN_CLOEXEC|FAN_NONBLOCK|"
51 "FAN_UNLIMITED_QUEUE|FAN_UNLIMITED_MARKS|0xffffffc0" },
53 static const struct strval event_f_flags[] = {
54 { F8ILL_KULONG_MASK, "O_RDONLY" },
55 { (kernel_ulong_t) 0xdeadbeef80000001ULL,
56 "O_WRONLY|0x80000000" }
63 for (i = 0; i < ARRAY_SIZE(flags); i++)
64 for (j = 0; j < ARRAY_SIZE(event_f_flags); j++)
65 do_call(flags[i].val, flags[i].str,
66 event_f_flags[j].val, event_f_flags[j].str);
68 puts("+++ exited with 0 +++");
74 SKIP_MAIN_UNDEFINED("__NR_fanotify_init")