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