]> granicus.if.org Git - strace/blob - fanotify.c
Remove linux/fanotify.h
[strace] / fanotify.c
1 #include "defs.h"
2
3 #include "xlat/fan_classes.h"
4 #include "xlat/fan_init_flags.h"
5
6 #ifndef FAN_ALL_CLASS_BITS
7 # define FAN_ALL_CLASS_BITS (FAN_CLASS_NOTIF | FAN_CLASS_CONTENT | FAN_CLASS_PRE_CONTENT)
8 #endif
9 #ifndef FAN_NOFD
10 # define FAN_NOFD -1
11 #endif
12
13 int
14 sys_fanotify_init(struct tcb *tcp)
15 {
16         unsigned flags;
17
18         if (exiting(tcp))
19                 return 0;
20
21         flags = tcp->u_arg[0];
22         printxval(fan_classes, flags & FAN_ALL_CLASS_BITS, "FAN_CLASS_???");
23         flags &= ~FAN_ALL_CLASS_BITS;
24         if (flags) {
25                 tprints("|");
26                 printflags(fan_init_flags, flags, "FAN_???");
27         }
28         tprints(", ");
29         tprint_open_modes((unsigned) tcp->u_arg[1]);
30
31         return 0;
32 }
33
34 #include "xlat/fan_mark_flags.h"
35 #include "xlat/fan_event_flags.h"
36
37 int
38 sys_fanotify_mark(struct tcb *tcp)
39 {
40         unsigned long long mask = 0;
41         int argn;
42
43         if (exiting(tcp))
44                 return 0;
45
46         printfd(tcp, tcp->u_arg[0]);
47         tprints(", ");
48         printflags(fan_mark_flags, (unsigned) tcp->u_arg[1], "FAN_MARK_???");
49         tprints(", ");
50         /*
51          * the mask argument is defined as 64-bit,
52          * but kernel uses the lower 32 bits only.
53          */
54         argn = getllval(tcp, &mask, 2);
55         printflags(fan_event_flags, mask, "FAN_???");
56         tprints(", ");
57         if ((int) tcp->u_arg[argn] == FAN_NOFD)
58                 tprints("FAN_NOFD, ");
59         else
60                 print_dirfd(tcp, tcp->u_arg[argn]);
61         printpath(tcp, tcp->u_arg[argn + 1]);
62
63         return 0;
64 }