| 1 | /* |
| 2 | * lttng-compat-syscalls.c |
| 3 | * |
| 4 | * Copyright 2010-2011 (c) - Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| 5 | * |
| 6 | * LTTng compat syscall probes. |
| 7 | * |
| 8 | * Dual LGPL v2.1/GPL v2 license. |
| 9 | */ |
| 10 | |
| 11 | #include <linux/module.h> |
| 12 | #include <linux/slab.h> |
| 13 | #include <linux/compat.h> |
| 14 | #include <asm/ptrace.h> |
| 15 | #include <asm/syscall.h> |
| 16 | |
| 17 | #include "ltt-events.h" |
| 18 | |
| 19 | extern |
| 20 | void syscall_entry_probe(void *__data, struct pt_regs *regs, long id); |
| 21 | |
| 22 | /* |
| 23 | * Take care of NOARGS not supported by mainline. |
| 24 | */ |
| 25 | #define DECLARE_EVENT_CLASS_NOARGS(name, tstruct, assign, print) |
| 26 | #define DEFINE_EVENT_NOARGS(template, name) |
| 27 | #define TRACE_EVENT_NOARGS(name, struct, assign, print) |
| 28 | |
| 29 | /* |
| 30 | * Create LTTng tracepoint probes. |
| 31 | */ |
| 32 | #define LTTNG_PACKAGE_BUILD |
| 33 | #define CREATE_TRACE_POINTS |
| 34 | #define TP_MODULE_OVERRIDE |
| 35 | #define TRACE_INCLUDE_PATH ../instrumentation/syscalls/headers |
| 36 | |
| 37 | /* Hijack probe callback for system calls */ |
| 38 | #define TP_PROBE_CB(_template) &syscall_entry_probe |
| 39 | #include "instrumentation/syscalls/headers/compat_syscalls_integers.h" |
| 40 | #include "instrumentation/syscalls/headers/compat_syscalls_pointers.h" |
| 41 | #undef TP_PROBE_CB |
| 42 | |
| 43 | #undef TP_MODULE_OVERRIDE |
| 44 | #undef LTTNG_PACKAGE_BUILD |
| 45 | #undef CREATE_TRACE_POINTS |
| 46 | |
| 47 | #undef TRACE_SYSCALL_TABLE |
| 48 | #define TRACE_SYSCALL_TABLE(_template, _name, _nr, _nrargs) \ |
| 49 | [ _nr ] = { \ |
| 50 | .func = __event_probe__##_template, \ |
| 51 | .nrargs = (_nrargs), \ |
| 52 | .fields = __event_fields___##_template, \ |
| 53 | .desc = &__event_desc___##_name, \ |
| 54 | }, |
| 55 | |
| 56 | #define CREATE_SYSCALL_TABLE |
| 57 | |
| 58 | /* Create compatibility syscall table */ |
| 59 | const struct trace_syscall_entry compat_sc_table[] = { |
| 60 | #include "instrumentation/syscalls/headers/compat_syscalls_integers.h" |
| 61 | #include "instrumentation/syscalls/headers/compat_syscalls_pointers.h" |
| 62 | }; |
| 63 | const size_t compat_sc_table_len = ARRAY_SIZE(compat_sc_table); |
| 64 | |
| 65 | #undef CREATE_SYSCALL_TABLE |