syscalls.h 1.4 KB

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