Mirror of strace – the linux syscall tracer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

fanotify.c 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * Copyright (c) 2014-2015 Dmitry V. Levin <ldv@altlinux.org>
  3. * Copyright (c) 2014-2019 The strace developers.
  4. * All rights reserved.
  5. *
  6. * SPDX-License-Identifier: LGPL-2.1-or-later
  7. */
  8. #include "defs.h"
  9. #include "xlat/fan_classes.h"
  10. #include "xlat/fan_init_flags.h"
  11. #ifndef FAN_ALL_CLASS_BITS
  12. # define FAN_ALL_CLASS_BITS (FAN_CLASS_NOTIF | FAN_CLASS_CONTENT | FAN_CLASS_PRE_CONTENT)
  13. #endif
  14. #ifndef FAN_NOFD
  15. # define FAN_NOFD -1
  16. #endif
  17. SYS_FUNC(fanotify_init)
  18. {
  19. unsigned int flags = tcp->u_arg[0];
  20. printxval(fan_classes, flags & FAN_ALL_CLASS_BITS, "FAN_CLASS_???");
  21. flags &= ~FAN_ALL_CLASS_BITS;
  22. if (flags) {
  23. tprints("|");
  24. printflags(fan_init_flags, flags, "FAN_???");
  25. }
  26. tprints(", ");
  27. tprint_open_modes((unsigned) tcp->u_arg[1]);
  28. return RVAL_DECODED | RVAL_FD;
  29. }
  30. #include "xlat/fan_mark_flags.h"
  31. #include "xlat/fan_event_flags.h"
  32. SYS_FUNC(fanotify_mark)
  33. {
  34. printfd(tcp, tcp->u_arg[0]);
  35. tprints(", ");
  36. printflags(fan_mark_flags, tcp->u_arg[1], "FAN_MARK_???");
  37. tprints(", ");
  38. /*
  39. * the mask argument is defined as 64-bit,
  40. * but kernel uses the lower 32 bits only.
  41. */
  42. unsigned long long mask = 0;
  43. int argn = getllval(tcp, &mask, 2);
  44. #ifdef HPPA
  45. /* Parsic is weird. See arch/parisc/kernel/sys_parisc32.c. */
  46. mask = (mask << 32) | (mask >> 32);
  47. #endif
  48. printflags64(fan_event_flags, mask, "FAN_???");
  49. tprints(", ");
  50. if ((int) tcp->u_arg[argn] == FAN_NOFD)
  51. print_xlat_d(FAN_NOFD);
  52. else
  53. print_dirfd(tcp, tcp->u_arg[argn]);
  54. tprints(", ");
  55. printpath(tcp, tcp->u_arg[argn + 1]);
  56. return RVAL_DECODED;
  57. }