syscall.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. extern void syscall_regfunc(void);
  8. extern void syscall_unregfunc(void);
  9. DECLARE_TRACE_WITH_CALLBACK(syscall_enter,
  10. TP_PROTO(struct pt_regs *regs, long id),
  11. TP_ARGS(regs, id),
  12. syscall_regfunc,
  13. syscall_unregfunc
  14. );
  15. DECLARE_TRACE_WITH_CALLBACK(syscall_exit,
  16. TP_PROTO(struct pt_regs *regs, long ret),
  17. TP_ARGS(regs, ret),
  18. syscall_regfunc,
  19. syscall_unregfunc
  20. );
  21. /*
  22. * A syscall entry in the ftrace syscalls array.
  23. *
  24. * @name: name of the syscall
  25. * @nb_args: number of parameters it takes
  26. * @types: list of types as strings
  27. * @args: list of args as strings (args[i] matches types[i])
  28. */
  29. struct syscall_metadata {
  30. const char *name;
  31. int nb_args;
  32. const char **types;
  33. const char **args;
  34. };
  35. #ifdef CONFIG_FTRACE_SYSCALLS
  36. extern struct syscall_metadata *syscall_nr_to_meta(int nr);
  37. extern int syscall_name_to_nr(char *name);
  38. extern struct trace_event event_syscall_enter;
  39. extern struct trace_event event_syscall_exit;
  40. extern int reg_event_syscall_enter(void *ptr);
  41. extern void unreg_event_syscall_enter(void *ptr);
  42. extern int reg_event_syscall_exit(void *ptr);
  43. extern void unreg_event_syscall_exit(void *ptr);
  44. #endif
  45. #endif /* _TRACE_SYSCALL_H */