syscall.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #ifndef _TRACE_SYSCALL_H
  2. #define _TRACE_SYSCALL_H
  3. #include <linux/tracepoint.h>
  4. #include <linux/unistd.h>
  5. #include <linux/ftrace_event.h>
  6. #include <asm/ptrace.h>
  7. #ifdef CONFIG_HAVE_SYSCALL_TRACEPOINTS
  8. extern void syscall_regfunc(void);
  9. extern void syscall_unregfunc(void);
  10. DECLARE_TRACE(syscall_enter,
  11. TP_PROTO(struct pt_regs *regs, long id),
  12. TP_ARGS(regs, id)
  13. );
  14. DECLARE_TRACE(syscall_exit,
  15. TP_PROTO(struct pt_regs *regs, long ret),
  16. TP_ARGS(regs, ret)
  17. );
  18. #endif
  19. /*
  20. * A syscall entry in the ftrace syscalls array.
  21. *
  22. * @name: name of the syscall
  23. * @nb_args: number of parameters it takes
  24. * @types: list of types as strings
  25. * @args: list of args as strings (args[i] matches types[i])
  26. * @enter_id: associated ftrace enter event id
  27. * @exit_id: associated ftrace exit event id
  28. * @enter_event: associated syscall_enter trace event
  29. * @exit_event: associated syscall_exit trace event
  30. */
  31. struct syscall_metadata {
  32. const char *name;
  33. int nb_args;
  34. const char **types;
  35. const char **args;
  36. int enter_id;
  37. int exit_id;
  38. struct ftrace_event_call *enter_event;
  39. struct ftrace_event_call *exit_event;
  40. };
  41. #ifdef CONFIG_FTRACE_SYSCALLS
  42. extern struct syscall_metadata *syscall_nr_to_meta(int nr);
  43. extern int syscall_name_to_nr(char *name);
  44. void set_syscall_enter_id(int num, int id);
  45. void set_syscall_exit_id(int num, int id);
  46. extern struct trace_event event_syscall_enter;
  47. extern struct trace_event event_syscall_exit;
  48. extern int reg_event_syscall_enter(void *ptr);
  49. extern void unreg_event_syscall_enter(void *ptr);
  50. extern int reg_event_syscall_exit(void *ptr);
  51. extern void unreg_event_syscall_exit(void *ptr);
  52. extern int syscall_enter_format(struct ftrace_event_call *call,
  53. struct trace_seq *s);
  54. extern int syscall_exit_format(struct ftrace_event_call *call,
  55. struct trace_seq *s);
  56. extern int syscall_enter_define_fields(struct ftrace_event_call *call);
  57. extern int syscall_exit_define_fields(struct ftrace_event_call *call);
  58. enum print_line_t print_syscall_enter(struct trace_iterator *iter, int flags);
  59. enum print_line_t print_syscall_exit(struct trace_iterator *iter, int flags);
  60. #endif
  61. #ifdef CONFIG_EVENT_PROFILE
  62. int reg_prof_syscall_enter(char *name);
  63. void unreg_prof_syscall_enter(char *name);
  64. int reg_prof_syscall_exit(char *name);
  65. void unreg_prof_syscall_exit(char *name);
  66. #endif
  67. #endif /* _TRACE_SYSCALL_H */