Split syscall tracepoint generation in their own files
[lttng-modules.git] / src / lttng-syscalls-entry-table.c
1 /* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
2 *
3 * lttng-syscalls-entry-table.c
4 *
5 * LTTng syscall entry probes.
6 *
7 * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 * Copyright (C) 2021 Francis Deslauriers <francis.deslauriers@efficios.com>
9 */
10
11 #include <wrapper/tracepoint.h>
12
13 #include "lttng-syscalls.h"
14
15
16 #ifdef IA32_NR_syscalls
17 #define NR_compat_syscalls IA32_NR_syscalls
18 #else
19 #define NR_compat_syscalls NR_syscalls
20 #endif
21
22 /*
23 * Create LTTng tracepoint probes.
24 */
25 #define LTTNG_PACKAGE_BUILD
26 #define CREATE_TRACE_POINTS
27 #define TP_MODULE_NOINIT
28 #define TRACE_INCLUDE_PATH instrumentation/syscalls/headers
29
30 #define PARAMS(args...) args
31
32 #define SC_ENTER
33
34 #undef sc_exit
35 #define sc_exit(...)
36 #undef sc_in
37 #define sc_in(...) __VA_ARGS__
38 #undef sc_out
39 #define sc_out(...)
40 #undef sc_inout
41 #define sc_inout(...) __VA_ARGS__
42
43 #define LTTNG_TRACEPOINT_TYPE_EXTERN
44
45 #include <lttng/events-reset.h>
46
47 /* Hijack probe callback for system call enter */
48 #undef TP_PROBE_CB
49 #define TP_PROBE_CB(_template) &syscall_entry_event_probe
50 #define SC_LTTNG_TRACEPOINT_EVENT(_name, _proto, _args, _fields) \
51 LTTNG_TRACEPOINT_EVENT(syscall_entry_##_name, PARAMS(_proto), PARAMS(_args), \
52 PARAMS(_fields))
53 #define SC_LTTNG_TRACEPOINT_EVENT_CODE(_name, _proto, _args, _locvar, _code_pre, _fields, _code_post) \
54 LTTNG_TRACEPOINT_EVENT_CODE(syscall_entry_##_name, PARAMS(_proto), PARAMS(_args), \
55 PARAMS(_locvar), PARAMS(_code_pre), \
56 PARAMS(_fields), PARAMS(_code_post))
57 #define SC_LTTNG_TRACEPOINT_EVENT_CLASS_NOARGS(_name, _fields) \
58 LTTNG_TRACEPOINT_EVENT_CLASS_NOARGS(syscall_entry_##_name, PARAMS(_fields))
59 #define SC_LTTNG_TRACEPOINT_EVENT_INSTANCE_NOARGS(_template, _name) \
60 LTTNG_TRACEPOINT_EVENT_INSTANCE_NOARGS(syscall_entry_##_template, syscall_entry_##_name)
61
62 #define SC_LTTNG_TRACEPOINT_ENUM(_name, _values) \
63 LTTNG_TRACEPOINT_ENUM(_name, PARAMS(_values))
64 #undef TRACE_SYSTEM
65 #define TRACE_SYSTEM syscall_entry_integers
66 #define TRACE_INCLUDE_FILE syscalls_integers
67 #include <instrumentation/syscalls/headers/syscalls_integers.h>
68 #undef TRACE_INCLUDE_FILE
69 #undef TRACE_SYSTEM
70 #define TRACE_SYSTEM syscall_entry_pointers
71 #define TRACE_INCLUDE_FILE syscalls_pointers
72 #include <instrumentation/syscalls/headers/syscalls_pointers.h>
73 #undef TRACE_INCLUDE_FILE
74 #undef TRACE_SYSTEM
75 #undef SC_LTTNG_TRACEPOINT_ENUM
76 #undef SC_LTTNG_TRACEPOINT_EVENT_CODE
77 #undef SC_LTTNG_TRACEPOINT_EVENT
78 #undef SC_LTTNG_TRACEPOINT_EVENT_CLASS_NOARGS
79 #undef SC_LTTNG_TRACEPOINT_EVENT_INSTANCE_NOARGS
80 #undef TP_PROBE_CB
81 #undef _TRACE_SYSCALLS_INTEGERS_H
82 #undef _TRACE_SYSCALLS_POINTERS_H
83
84 #define CREATE_SYSCALL_TABLE
85
86 #undef sc_exit
87 #define sc_exit(...)
88
89 #undef TRACE_SYSCALL_TABLE
90 #define TRACE_SYSCALL_TABLE(_template, _name, _nr, _nrargs) \
91 [ _nr ] = { \
92 .event_func = __event_probe__syscall_entry_##_template, \
93 .nrargs = (_nrargs), \
94 .fields = __event_fields___syscall_entry_##_template, \
95 .desc = &__event_desc___syscall_entry_##_name, \
96 },
97
98 /* Event syscall enter tracing table */
99 static const struct trace_syscall_entry _sc_table[] = {
100 #include <instrumentation/syscalls/headers/syscalls_integers.h>
101 #include <instrumentation/syscalls/headers/syscalls_pointers.h>
102 };
103
104 const struct trace_syscall_table sc_table = {
105 .table = _sc_table,
106 .len = ARRAY_SIZE(_sc_table),
107 };
108
109 #undef SC_ENTER
110
111 #undef CREATE_SYSCALL_TABLE
This page took 0.030734 seconds and 4 git commands to generate.