1 /* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
3 * lttng-syscalls-entry-compat-table.c
5 * LTTng syscall entry compat probes.
7 * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 * Copyright (C) 2021 Francis Deslauriers <francis.deslauriers@efficios.com>
11 #include <wrapper/tracepoint.h>
13 #include "lttng-syscalls.h"
16 #ifdef IA32_NR_syscalls
17 #define NR_compat_syscalls IA32_NR_syscalls
19 #define NR_compat_syscalls NR_syscalls
23 * Create LTTng tracepoint probes.
25 #define LTTNG_PACKAGE_BUILD
26 #define CREATE_TRACE_POINTS
27 #define TP_MODULE_NOINIT
28 #define TRACE_INCLUDE_PATH instrumentation/syscalls
30 #define PARAMS(args...) args
37 #define sc_in(...) __VA_ARGS__
41 #define sc_inout(...) __VA_ARGS__
43 #define LTTNG_TRACEPOINT_TYPE_EXTERN
45 #include <lttng/events-reset.h>
47 /* Hijack probe callback for system call enter */
49 #define TP_PROBE_CB(_template) &syscall_entry_event_probe
50 #define LTTNG_SC_COMPAT
51 #define SC_LTTNG_TRACEPOINT_EVENT(_name, _proto, _args, _fields) \
52 LTTNG_TRACEPOINT_EVENT(compat_syscall_entry_##_name, PARAMS(_proto), PARAMS(_args), \
54 #define SC_LTTNG_TRACEPOINT_EVENT_CODE(_name, _proto, _args, _locvar, _code_pre, _fields, _code_post) \
55 LTTNG_TRACEPOINT_EVENT_CODE(compat_syscall_entry_##_name, PARAMS(_proto), PARAMS(_args), \
56 PARAMS(_locvar), PARAMS(_code_pre), \
57 PARAMS(_fields), PARAMS(_code_post))
58 #define SC_LTTNG_TRACEPOINT_EVENT_CLASS_NOARGS(_name, _fields) \
59 LTTNG_TRACEPOINT_EVENT_CLASS_NOARGS(compat_syscall_entry_##_name, PARAMS(_fields))
60 #define SC_LTTNG_TRACEPOINT_EVENT_INSTANCE_NOARGS(_template, _name) \
61 LTTNG_TRACEPOINT_EVENT_INSTANCE_NOARGS(compat_syscall_entry_##_template, compat_syscall_entry_##_name)
63 #define SC_LTTNG_TRACEPOINT_ENUM(_name, _values) \
64 LTTNG_TRACEPOINT_ENUM(_name, PARAMS(_values))
66 #define TRACE_SYSTEM compat_syscall_entry_integers
67 #define TRACE_INCLUDE_FILE compat_syscalls_integers
68 #include <instrumentation/syscalls/syscalls_integers.h>
69 #undef TRACE_INCLUDE_FILE
71 #define TRACE_SYSTEM compat_syscall_entry_pointers
72 #define TRACE_INCLUDE_FILE compat_syscalls_pointers
73 #include <instrumentation/syscalls/syscalls_pointers.h>
74 #undef TRACE_INCLUDE_FILE
76 #undef SC_LTTNG_TRACEPOINT_ENUM
77 #undef SC_LTTNG_TRACEPOINT_EVENT_CODE
78 #undef SC_LTTNG_TRACEPOINT_EVENT
79 #undef SC_LTTNG_TRACEPOINT_EVENT_CLASS_NOARGS
80 #undef SC_LTTNG_TRACEPOINT_EVENT_INSTANCE_NOARGS
83 #undef _TRACE_SYSCALLS_INTEGERS_H
84 #undef _TRACE_SYSCALLS_POINTERS_H
85 #undef LTTNG_SC_COMPAT
87 #define CREATE_SYSCALL_TABLE
92 #undef TRACE_SYSCALL_TABLE
93 #define TRACE_SYSCALL_TABLE(_template, _name, _nr, _nrargs) \
95 .event_func = __event_probe__compat_syscall_entry_##_template, \
96 .nrargs = (_nrargs), \
97 .fields = __event_fields___compat_syscall_entry_##_template, \
98 .desc = &__event_desc___compat_syscall_entry_##_name, \
101 /* Event compat syscall enter table */
102 const struct trace_syscall_entry _compat_sc_table
[] = {
103 #include <instrumentation/syscalls/compat_syscalls_integers.h>
104 #include <instrumentation/syscalls/compat_syscalls_pointers.h>
107 const struct trace_syscall_table compat_sc_table
= {
108 .table
= _compat_sc_table
,
109 .len
= ARRAY_SIZE(_compat_sc_table
),
114 #undef CREATE_SYSCALL_TABLE