syscall.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _TRACE_SYSCALL_H
  3. #define _TRACE_SYSCALL_H
  4. #include <linux/tracepoint.h>
  5. #include <linux/unistd.h>
  6. #include <linux/trace_events.h>
  7. #include <linux/thread_info.h>
  8. #include <asm/ptrace.h>
  9. /*
  10. * A syscall entry in the ftrace syscalls array.
  11. *
  12. * @name: name of the syscall
  13. * @syscall_nr: number of the syscall
  14. * @nb_args: number of parameters it takes
  15. * @types: list of types as strings
  16. * @args: list of args as strings (args[i] matches types[i])
  17. * @enter_fields: list of fields for syscall_enter trace event
  18. * @enter_event: associated syscall_enter trace event
  19. * @exit_event: associated syscall_exit trace event
  20. */
  21. struct syscall_metadata {
  22. const char *name;
  23. int syscall_nr;
  24. int nb_args;
  25. const char **types;
  26. const char **args;
  27. struct list_head enter_fields;
  28. struct trace_event_call *enter_event;
  29. struct trace_event_call *exit_event;
  30. };
  31. #if defined(CONFIG_TRACEPOINTS) && defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS)
  32. static inline void syscall_tracepoint_update(struct task_struct *p)
  33. {
  34. if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
  35. set_tsk_thread_flag(p, TIF_SYSCALL_TRACEPOINT);
  36. else
  37. clear_tsk_thread_flag(p, TIF_SYSCALL_TRACEPOINT);
  38. }
  39. #else
  40. static inline void syscall_tracepoint_update(struct task_struct *p)
  41. {
  42. }
  43. #endif
  44. #endif /* _TRACE_SYSCALL_H */