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