xref: /linux/include/trace/syscall.h (revision 69c5079b49fa120c1a108b6e28b3a6a8e4ae2db5)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _TRACE_SYSCALL_H
3 #define _TRACE_SYSCALL_H
4 
5 #include <linux/tracepoint.h>
6 #include <linux/unistd.h>
7 #include <linux/trace_events.h>
8 #include <linux/thread_info.h>
9 
10 #include <asm/ptrace.h>
11 
12 
13 /*
14  * A syscall entry in the ftrace syscalls array.
15  *
16  * @name: name of the syscall
17  * @syscall_nr: number of the syscall
18  * @nb_args: number of parameters it takes
19  * @user_arg_is_str: set if the arg for @user_arg_size is a string
20  * @user_arg_size: holds @arg that has size of the user space to read
21  * @user_mask: mask of @args that will read user space
22  * @types: list of types as strings
23  * @args: list of args as strings (args[i] matches types[i])
24  * @enter_fields: list of fields for syscall_enter trace event
25  * @enter_event: associated syscall_enter trace event
26  * @exit_event: associated syscall_exit trace event
27  */
28 struct syscall_metadata {
29 	const char	*name;
30 	int		syscall_nr;
31 	u8		nb_args:7;
32 	u8		user_arg_is_str:1;
33 	s8		user_arg_size;
34 	short		user_mask;
35 	const char	**types;
36 	const char	**args;
37 	struct list_head enter_fields;
38 
39 	struct trace_event_call *enter_event;
40 	struct trace_event_call *exit_event;
41 };
42 
43 #if defined(CONFIG_TRACEPOINTS) && defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS)
syscall_tracepoint_update(struct task_struct * p)44 static inline void syscall_tracepoint_update(struct task_struct *p)
45 {
46 	if (test_syscall_work(SYSCALL_TRACEPOINT))
47 		set_task_syscall_work(p, SYSCALL_TRACEPOINT);
48 	else
49 		clear_task_syscall_work(p, SYSCALL_TRACEPOINT);
50 }
51 #else
syscall_tracepoint_update(struct task_struct * p)52 static inline void syscall_tracepoint_update(struct task_struct *p)
53 {
54 }
55 #endif
56 
57 #endif /* _TRACE_SYSCALL_H */
58