| 1 | /* |
| 2 | * ltt/probes/syscall-trace.c |
| 3 | * |
| 4 | * System call tracepoint probes. |
| 5 | * |
| 6 | * (C) Copyright 2009 - Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> |
| 7 | * Dual LGPL v2.1/GPL v2 license. |
| 8 | */ |
| 9 | |
| 10 | #include <linux/module.h> |
| 11 | #include <trace/syscall.h> |
| 12 | |
| 13 | #include "../ltt-type-serializer.h" |
| 14 | |
| 15 | |
| 16 | /* kernel_syscall_entry specialized tracepoint probe */ |
| 17 | |
| 18 | void probe_syscall_entry(void *_data, struct pt_regs *regs, long id); |
| 19 | |
| 20 | DEFINE_MARKER_TP(kernel, syscall_entry, syscall_entry, |
| 21 | probe_syscall_entry, "ip #p%ld syscall_id #2u%u"); |
| 22 | |
| 23 | notrace void probe_syscall_entry(void *_data, struct pt_regs *regs, long id) |
| 24 | { |
| 25 | struct marker *marker; |
| 26 | struct serialize_long_short data; |
| 27 | |
| 28 | data.f1 = instruction_pointer(regs); |
| 29 | data.f2 = (unsigned short)id; |
| 30 | |
| 31 | marker = &GET_MARKER(kernel, syscall_entry); |
| 32 | ltt_specialized_trace(marker, marker->single.probe_private, |
| 33 | &data, serialize_sizeof(data), sizeof(long)); |
| 34 | } |
| 35 | |
| 36 | /* kernel_syscall_exit specialized tracepoint probe */ |
| 37 | |
| 38 | void probe_syscall_exit(void *_data, long ret); |
| 39 | |
| 40 | DEFINE_MARKER_TP(kernel, syscall_exit, syscall_exit, |
| 41 | probe_syscall_exit, "ret %ld"); |
| 42 | |
| 43 | notrace void probe_syscall_exit(void *_data, long ret) |
| 44 | { |
| 45 | struct marker *marker; |
| 46 | |
| 47 | marker = &GET_MARKER(kernel, syscall_exit); |
| 48 | ltt_specialized_trace(marker, marker->single.probe_private, |
| 49 | &ret, sizeof(ret), sizeof(ret)); |
| 50 | } |
| 51 | |
| 52 | MODULE_LICENSE("GPL and additional rights"); |
| 53 | MODULE_AUTHOR("Mathieu Desnoyers"); |
| 54 | MODULE_DESCRIPTION("syscall Tracepoint Probes"); |