syscall.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #ifndef _TRACE_SYSCALL_H
  2. #define _TRACE_SYSCALL_H
  3. #include <linux/tracepoint.h>
  4. #include <asm/ptrace.h>
  5. extern void syscall_regfunc(void);
  6. extern void syscall_unregfunc(void);
  7. DECLARE_TRACE_WITH_CALLBACK(syscall_enter,
  8. TP_PROTO(struct pt_regs *regs, long id),
  9. TP_ARGS(regs, id),
  10. syscall_regfunc,
  11. syscall_unregfunc
  12. );
  13. DECLARE_TRACE_WITH_CALLBACK(syscall_exit,
  14. TP_PROTO(struct pt_regs *regs, long ret),
  15. TP_ARGS(regs, ret),
  16. syscall_regfunc,
  17. syscall_unregfunc
  18. );
  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. */
  27. struct syscall_metadata {
  28. const char *name;
  29. int nb_args;
  30. const char **types;
  31. const char **args;
  32. };
  33. #ifdef CONFIG_FTRACE_SYSCALLS
  34. extern struct syscall_metadata *syscall_nr_to_meta(int nr);
  35. extern void start_ftrace_syscalls(void);
  36. extern void stop_ftrace_syscalls(void);
  37. extern void ftrace_syscall_enter(struct pt_regs *regs);
  38. extern void ftrace_syscall_exit(struct pt_regs *regs);
  39. #else
  40. static inline void start_ftrace_syscalls(void) { }
  41. static inline void stop_ftrace_syscalls(void) { }
  42. static inline void ftrace_syscall_enter(struct pt_regs *regs) { }
  43. static inline void ftrace_syscall_exit(struct pt_regs *regs) { }
  44. #endif
  45. #endif /* _TRACE_SYSCALL_H */