xref: /linux/include/trace/events/syscalls.h (revision e58e871becec2d3b04ed91c0c16fe8deac9c9dfa)
1 #undef TRACE_SYSTEM
2 #define TRACE_SYSTEM raw_syscalls
3 #undef TRACE_INCLUDE_FILE
4 #define TRACE_INCLUDE_FILE syscalls
5 
6 #if !defined(_TRACE_EVENTS_SYSCALLS_H) || defined(TRACE_HEADER_MULTI_READ)
7 #define _TRACE_EVENTS_SYSCALLS_H
8 
9 #include <linux/tracepoint.h>
10 
11 #include <asm/ptrace.h>
12 #include <asm/syscall.h>
13 
14 
15 #ifdef CONFIG_HAVE_SYSCALL_TRACEPOINTS
16 
17 TRACE_EVENT_FN(sys_enter,
18 
19 	TP_PROTO(struct pt_regs *regs, long id),
20 
21 	TP_ARGS(regs, id),
22 
23 	TP_STRUCT__entry(
24 		__field(	long,		id		)
25 		__array(	unsigned long,	args,	6	)
26 	),
27 
28 	TP_fast_assign(
29 		__entry->id	= id;
30 		syscall_get_arguments(current, regs, 0, 6, __entry->args);
31 	),
32 
33 	TP_printk("NR %ld (%lx, %lx, %lx, %lx, %lx, %lx)",
34 		  __entry->id,
35 		  __entry->args[0], __entry->args[1], __entry->args[2],
36 		  __entry->args[3], __entry->args[4], __entry->args[5]),
37 
38 	syscall_regfunc, syscall_unregfunc
39 );
40 
41 TRACE_EVENT_FLAGS(sys_enter, TRACE_EVENT_FL_CAP_ANY)
42 
43 TRACE_EVENT_FN(sys_exit,
44 
45 	TP_PROTO(struct pt_regs *regs, long ret),
46 
47 	TP_ARGS(regs, ret),
48 
49 	TP_STRUCT__entry(
50 		__field(	long,	id	)
51 		__field(	long,	ret	)
52 	),
53 
54 	TP_fast_assign(
55 		__entry->id	= syscall_get_nr(current, regs);
56 		__entry->ret	= ret;
57 	),
58 
59 	TP_printk("NR %ld = %ld",
60 		  __entry->id, __entry->ret),
61 
62 	syscall_regfunc, syscall_unregfunc
63 );
64 
65 TRACE_EVENT_FLAGS(sys_exit, TRACE_EVENT_FL_CAP_ANY)
66 
67 #endif /* CONFIG_HAVE_SYSCALL_TRACEPOINTS */
68 
69 #endif /* _TRACE_EVENTS_SYSCALLS_H */
70 
71 /* This part must be outside protection */
72 #include <trace/define_trace.h>
73 
74