syscalls.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #undef TRACE_SYSTEM
  2. #define TRACE_SYSTEM raw_syscalls
  3. #define TRACE_INCLUDE_FILE syscalls
  4. #if !defined(_TRACE_EVENTS_SYSCALLS_H) || defined(TRACE_HEADER_MULTI_READ)
  5. #define _TRACE_EVENTS_SYSCALLS_H
  6. #include <linux/tracepoint.h>
  7. #include <asm/ptrace.h>
  8. #include <asm/syscall.h>
  9. #ifdef CONFIG_HAVE_SYSCALL_TRACEPOINTS
  10. extern void syscall_regfunc(void);
  11. extern void syscall_unregfunc(void);
  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>