syscalls.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #undef TRACE_SYSTEM
  3. #define TRACE_SYSTEM raw_syscalls
  4. #undef TRACE_INCLUDE_FILE
  5. #define TRACE_INCLUDE_FILE syscalls
  6. #if !defined(_TRACE_EVENTS_SYSCALLS_H) || defined(TRACE_HEADER_MULTI_READ)
  7. #define _TRACE_EVENTS_SYSCALLS_H
  8. #include <linux/tracepoint.h>
  9. #include <asm/ptrace.h>
  10. #include <asm/syscall.h>
  11. #ifdef CONFIG_HAVE_SYSCALL_TRACEPOINTS
  12. TRACE_EVENT_FN(sys_enter,
  13. TP_PROTO(struct pt_regs *regs, long id),
  14. TP_ARGS(regs, id),
  15. TP_STRUCT__entry(
  16. __field( long, id )
  17. __array( unsigned long, args, 6 )
  18. ),
  19. TP_fast_assign(
  20. __entry->id = id;
  21. syscall_get_arguments(current, regs, 0, 6, __entry->args);
  22. ),
  23. TP_printk("NR %ld (%lx, %lx, %lx, %lx, %lx, %lx)",
  24. __entry->id,
  25. __entry->args[0], __entry->args[1], __entry->args[2],
  26. __entry->args[3], __entry->args[4], __entry->args[5]),
  27. syscall_regfunc, syscall_unregfunc
  28. );
  29. TRACE_EVENT_FLAGS(sys_enter, TRACE_EVENT_FL_CAP_ANY)
  30. TRACE_EVENT_FN(sys_exit,
  31. TP_PROTO(struct pt_regs *regs, long ret),
  32. TP_ARGS(regs, ret),
  33. TP_STRUCT__entry(
  34. __field( long, id )
  35. __field( long, ret )
  36. ),
  37. TP_fast_assign(
  38. __entry->id = syscall_get_nr(current, regs);
  39. __entry->ret = ret;
  40. ),
  41. TP_printk("NR %ld = %ld",
  42. __entry->id, __entry->ret),
  43. syscall_regfunc, syscall_unregfunc
  44. );
  45. TRACE_EVENT_FLAGS(sys_exit, TRACE_EVENT_FL_CAP_ANY)
  46. #endif /* CONFIG_HAVE_SYSCALL_TRACEPOINTS */
  47. #endif /* _TRACE_EVENTS_SYSCALLS_H */
  48. /* This part must be outside protection */
  49. #include <trace/define_trace.h>