blob: 63816b8d3e9a5b15fd09e468b87f73d91f7c223f [file] [log] [blame]
Dmitry V. Levin99db95d2014-02-05 04:13:18 +00001#include "defs.h"
Dmitry V. Levin99db95d2014-02-05 04:13:18 +00002
Dmitry V. Levin0ed617b2014-04-25 23:30:54 +00003#include "xlat/fan_classes.h"
Dmitry V. Levin0ed617b2014-04-25 23:30:54 +00004#include "xlat/fan_init_flags.h"
Dmitry V. Levin99db95d2014-02-05 04:13:18 +00005
Dmitry V. Levin34bbcc62015-02-19 21:55:09 +00006#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
Dmitry V. Levin99db95d2014-02-05 04:13:18 +000013int
14sys_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
Dmitry V. Levin0ed617b2014-04-25 23:30:54 +000034#include "xlat/fan_mark_flags.h"
Dmitry V. Levin0ed617b2014-04-25 23:30:54 +000035#include "xlat/fan_event_flags.h"
Dmitry V. Levin99db95d2014-02-05 04:13:18 +000036
37int
38sys_fanotify_mark(struct tcb *tcp)
39{
Dmitry V. Levin1ea64732015-01-10 00:08:58 +000040 unsigned long long mask = 0;
41 int argn;
42
Dmitry V. Levin99db95d2014-02-05 04:13:18 +000043 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(", ");
Dmitry V. Levin1ea64732015-01-10 00:08:58 +000050 /*
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);
Mike Frysinger28e3d6f2015-02-26 14:16:13 -050055#ifdef HPPA
56 /* Parsic is weird. See arch/parisc/kernel/sys_parisc32.c. */
57 mask = (mask << 32) | (mask >> 32);
58#endif
Dmitry V. Levin1ea64732015-01-10 00:08:58 +000059 printflags(fan_event_flags, mask, "FAN_???");
Dmitry V. Levin99db95d2014-02-05 04:13:18 +000060 tprints(", ");
Dmitry V. Levin1ea64732015-01-10 00:08:58 +000061 if ((int) tcp->u_arg[argn] == FAN_NOFD)
Dmitry V. Levin99db95d2014-02-05 04:13:18 +000062 tprints("FAN_NOFD, ");
63 else
Dmitry V. Levin1ea64732015-01-10 00:08:58 +000064 print_dirfd(tcp, tcp->u_arg[argn]);
65 printpath(tcp, tcp->u_arg[argn + 1]);
Dmitry V. Levin99db95d2014-02-05 04:13:18 +000066
67 return 0;
68}