• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
SYS_FUNC(fanotify_init)13 SYS_FUNC(fanotify_init)
14 {
15 	unsigned flags;
16 
17 	if (exiting(tcp))
18 		return 0;
19 
20 	flags = tcp->u_arg[0];
21 	printxval(fan_classes, flags & FAN_ALL_CLASS_BITS, "FAN_CLASS_???");
22 	flags &= ~FAN_ALL_CLASS_BITS;
23 	if (flags) {
24 		tprints("|");
25 		printflags(fan_init_flags, flags, "FAN_???");
26 	}
27 	tprints(", ");
28 	tprint_open_modes((unsigned) tcp->u_arg[1]);
29 
30 	return 0;
31 }
32 
33 #include "xlat/fan_mark_flags.h"
34 #include "xlat/fan_event_flags.h"
35 
SYS_FUNC(fanotify_mark)36 SYS_FUNC(fanotify_mark)
37 {
38 	unsigned long long mask = 0;
39 	int argn;
40 
41 	if (exiting(tcp))
42 		return 0;
43 
44 	printfd(tcp, tcp->u_arg[0]);
45 	tprints(", ");
46 	printflags(fan_mark_flags, (unsigned) tcp->u_arg[1], "FAN_MARK_???");
47 	tprints(", ");
48 	/*
49 	 * the mask argument is defined as 64-bit,
50 	 * but kernel uses the lower 32 bits only.
51 	 */
52 	argn = getllval(tcp, &mask, 2);
53 #ifdef HPPA
54 	/* Parsic is weird.  See arch/parisc/kernel/sys_parisc32.c.  */
55 	mask = (mask << 32) | (mask >> 32);
56 #endif
57 	printflags(fan_event_flags, mask, "FAN_???");
58 	tprints(", ");
59 	if ((int) tcp->u_arg[argn] == FAN_NOFD)
60 		tprints("FAN_NOFD, ");
61 	else
62 		print_dirfd(tcp, tcp->u_arg[argn]);
63 	printpath(tcp, tcp->u_arg[argn + 1]);
64 
65 	return 0;
66 }
67