Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Josh Stone | 1c569f0 | 2009-08-24 14:43:14 -0700 | [diff] [blame] | 2 | #undef TRACE_SYSTEM |
Lai Jiangshan | b8007ef | 2009-11-03 13:45:32 +0800 | [diff] [blame] | 3 | #define TRACE_SYSTEM raw_syscalls |
Rik van Riel | bf7165c | 2016-09-28 22:55:54 -0400 | [diff] [blame] | 4 | #undef TRACE_INCLUDE_FILE |
Lai Jiangshan | b8007ef | 2009-11-03 13:45:32 +0800 | [diff] [blame] | 5 | #define TRACE_INCLUDE_FILE syscalls |
Josh Stone | 1c569f0 | 2009-08-24 14:43:14 -0700 | [diff] [blame] | 6 | |
| 7 | #if !defined(_TRACE_EVENTS_SYSCALLS_H) || defined(TRACE_HEADER_MULTI_READ) |
| 8 | #define _TRACE_EVENTS_SYSCALLS_H |
| 9 | |
| 10 | #include <linux/tracepoint.h> |
| 11 | |
| 12 | #include <asm/ptrace.h> |
| 13 | #include <asm/syscall.h> |
| 14 | |
| 15 | |
| 16 | #ifdef CONFIG_HAVE_SYSCALL_TRACEPOINTS |
| 17 | |
Josh Stone | 1c569f0 | 2009-08-24 14:43:14 -0700 | [diff] [blame] | 18 | TRACE_EVENT_FN(sys_enter, |
| 19 | |
| 20 | TP_PROTO(struct pt_regs *regs, long id), |
| 21 | |
| 22 | TP_ARGS(regs, id), |
| 23 | |
| 24 | TP_STRUCT__entry( |
| 25 | __field( long, id ) |
| 26 | __array( unsigned long, args, 6 ) |
| 27 | ), |
| 28 | |
| 29 | TP_fast_assign( |
| 30 | __entry->id = id; |
Steven Rostedt (Red Hat) | b35f549 | 2016-11-07 16:26:37 -0500 | [diff] [blame] | 31 | syscall_get_arguments(current, regs, __entry->args); |
Josh Stone | 1c569f0 | 2009-08-24 14:43:14 -0700 | [diff] [blame] | 32 | ), |
| 33 | |
| 34 | TP_printk("NR %ld (%lx, %lx, %lx, %lx, %lx, %lx)", |
| 35 | __entry->id, |
| 36 | __entry->args[0], __entry->args[1], __entry->args[2], |
| 37 | __entry->args[3], __entry->args[4], __entry->args[5]), |
| 38 | |
| 39 | syscall_regfunc, syscall_unregfunc |
| 40 | ); |
| 41 | |
Frederic Weisbecker | fe55420 | 2010-11-18 01:52:06 +0100 | [diff] [blame] | 42 | TRACE_EVENT_FLAGS(sys_enter, TRACE_EVENT_FL_CAP_ANY) |
| 43 | |
Josh Stone | 1c569f0 | 2009-08-24 14:43:14 -0700 | [diff] [blame] | 44 | TRACE_EVENT_FN(sys_exit, |
| 45 | |
| 46 | TP_PROTO(struct pt_regs *regs, long ret), |
| 47 | |
| 48 | TP_ARGS(regs, ret), |
| 49 | |
| 50 | TP_STRUCT__entry( |
| 51 | __field( long, id ) |
| 52 | __field( long, ret ) |
| 53 | ), |
| 54 | |
| 55 | TP_fast_assign( |
| 56 | __entry->id = syscall_get_nr(current, regs); |
| 57 | __entry->ret = ret; |
| 58 | ), |
| 59 | |
| 60 | TP_printk("NR %ld = %ld", |
| 61 | __entry->id, __entry->ret), |
| 62 | |
| 63 | syscall_regfunc, syscall_unregfunc |
| 64 | ); |
| 65 | |
Frederic Weisbecker | fe55420 | 2010-11-18 01:52:06 +0100 | [diff] [blame] | 66 | TRACE_EVENT_FLAGS(sys_exit, TRACE_EVENT_FL_CAP_ANY) |
| 67 | |
Josh Stone | 1c569f0 | 2009-08-24 14:43:14 -0700 | [diff] [blame] | 68 | #endif /* CONFIG_HAVE_SYSCALL_TRACEPOINTS */ |
| 69 | |
| 70 | #endif /* _TRACE_EVENTS_SYSCALLS_H */ |
| 71 | |
| 72 | /* This part must be outside protection */ |
| 73 | #include <trace/define_trace.h> |
| 74 | |