Dmitry V. Levin | 99db95d | 2014-02-05 04:13:18 +0000 | [diff] [blame] | 1 | #include "defs.h" |
Dmitry V. Levin | 99db95d | 2014-02-05 04:13:18 +0000 | [diff] [blame] | 2 | |
Dmitry V. Levin | 0ed617b | 2014-04-25 23:30:54 +0000 | [diff] [blame] | 3 | #include "xlat/fan_classes.h" |
Dmitry V. Levin | 0ed617b | 2014-04-25 23:30:54 +0000 | [diff] [blame] | 4 | #include "xlat/fan_init_flags.h" |
Dmitry V. Levin | 99db95d | 2014-02-05 04:13:18 +0000 | [diff] [blame] | 5 | |
Dmitry V. Levin | 34bbcc6 | 2015-02-19 21:55:09 +0000 | [diff] [blame] | 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 | |
Dmitry V. Levin | 99db95d | 2014-02-05 04:13:18 +0000 | [diff] [blame] | 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 | |
Dmitry V. Levin | 0ed617b | 2014-04-25 23:30:54 +0000 | [diff] [blame] | 34 | #include "xlat/fan_mark_flags.h" |
Dmitry V. Levin | 0ed617b | 2014-04-25 23:30:54 +0000 | [diff] [blame] | 35 | #include "xlat/fan_event_flags.h" |
Dmitry V. Levin | 99db95d | 2014-02-05 04:13:18 +0000 | [diff] [blame] | 36 | |
| 37 | int |
| 38 | sys_fanotify_mark(struct tcb *tcp) |
| 39 | { |
Dmitry V. Levin | 1ea6473 | 2015-01-10 00:08:58 +0000 | [diff] [blame] | 40 | unsigned long long mask = 0; |
| 41 | int argn; |
| 42 | |
Dmitry V. Levin | 99db95d | 2014-02-05 04:13:18 +0000 | [diff] [blame] | 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(", "); |
Dmitry V. Levin | 1ea6473 | 2015-01-10 00:08:58 +0000 | [diff] [blame] | 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); |
Mike Frysinger | 28e3d6f | 2015-02-26 14:16:13 -0500 | [diff] [blame] | 55 | #ifdef HPPA |
| 56 | /* Parsic is weird. See arch/parisc/kernel/sys_parisc32.c. */ |
| 57 | mask = (mask << 32) | (mask >> 32); |
| 58 | #endif |
Dmitry V. Levin | 1ea6473 | 2015-01-10 00:08:58 +0000 | [diff] [blame] | 59 | printflags(fan_event_flags, mask, "FAN_???"); |
Dmitry V. Levin | 99db95d | 2014-02-05 04:13:18 +0000 | [diff] [blame] | 60 | tprints(", "); |
Dmitry V. Levin | 1ea6473 | 2015-01-10 00:08:58 +0000 | [diff] [blame] | 61 | if ((int) tcp->u_arg[argn] == FAN_NOFD) |
Dmitry V. Levin | 99db95d | 2014-02-05 04:13:18 +0000 | [diff] [blame] | 62 | tprints("FAN_NOFD, "); |
| 63 | else |
Dmitry V. Levin | 1ea6473 | 2015-01-10 00:08:58 +0000 | [diff] [blame] | 64 | print_dirfd(tcp, tcp->u_arg[argn]); |
| 65 | printpath(tcp, tcp->u_arg[argn + 1]); |
Dmitry V. Levin | 99db95d | 2014-02-05 04:13:18 +0000 | [diff] [blame] | 66 | |
| 67 | return 0; |
| 68 | } |