Add x86-32 syscall list for kernel 6.0.7
[lttng-modules.git] / include / wrapper / tracepoint.h
CommitLineData
b7cdc182 1/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
9f36eaed 2 *
3a523f5b
MD
3 * wrapper/tracepoint.h
4 *
5 * wrapper around DECLARE_EVENT_CLASS.
6 *
7 * Copyright (C) 2011-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3a523f5b
MD
8 */
9
9f36eaed
MJ
10#ifndef _LTTNG_WRAPPER_TRACEPOINT_H
11#define _LTTNG_WRAPPER_TRACEPOINT_H
12
5f4c791e 13#include <lttng/kernel-version.h>
3a523f5b 14#include <linux/tracepoint.h>
dd8d5afb 15#include <linux/module.h>
3a523f5b 16
5f4c791e 17#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,10,0))
0116245f
MJ
18#define LTTNG_DEFINE_TRACE(name, proto, args) \
19 DEFINE_TRACE(name, PARAMS(proto), PARAMS(args))
20#else
21#define LTTNG_DEFINE_TRACE(name, proto, args) \
22 DEFINE_TRACE(name)
23#endif
24
5f4c791e 25#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,15,0))
20591cf7 26
2df37e95 27#include <lttng/tracepoint.h>
20591cf7
MD
28
29#define lttng_wrapper_tracepoint_probe_register lttng_tracepoint_probe_register
30#define lttng_wrapper_tracepoint_probe_unregister lttng_tracepoint_probe_unregister
31
5f4c791e 32#else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,15,0)) */
20591cf7 33
df46e53b
MJ
34#define lttng_wrapper_tracepoint_probe_register tracepoint_probe_register
35#define lttng_wrapper_tracepoint_probe_unregister tracepoint_probe_unregister
20591cf7
MD
36
37static inline
38int lttng_tracepoint_init(void)
39{
40 return 0;
41}
42
43static inline
44void lttng_tracepoint_exit(void)
45{
46}
47
5f4c791e 48#endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,15,0)) */
20591cf7 49
5f4c791e 50#if (LTTNG_LINUX_VERSION_CODE < LTTNG_KERNEL_VERSION(3,15,0) && defined(CONFIG_MODULE_SIG))
dd8d5afb
MD
51
52#include <linux/kallsyms.h>
5a2f5e92 53#include <wrapper/kallsyms.h>
dd8d5afb
MD
54
55static inline
56int wrapper_tracepoint_module_notify(struct notifier_block *nb,
57 unsigned long val, struct module *mod)
58{
59 int (*tracepoint_module_notify_sym)(struct notifier_block *nb,
60 unsigned long val, struct module *mod);
61
62 tracepoint_module_notify_sym =
63 (void *) kallsyms_lookup_funcptr("tracepoint_module_notify");
64 if (tracepoint_module_notify_sym) {
65 return tracepoint_module_notify_sym(nb, val, mod);
66 } else {
e36de50d 67 printk_once(KERN_WARNING "LTTng: tracepoint_module_notify symbol lookup failed. It probably means you kernel don't need this work-around. Please consider upgrading LTTng modules to make this warning go away.\n");
dd8d5afb
MD
68 return -ENOSYS;
69 }
70}
71
3dfec228
MJ
72/*
73 * No canary for 'tracepoint_module_notify()', it's only defined in 'kernel/tracepoint.c'.
74 *
75 * static inline
76 * int __canary__tracepoint_module_notify(struct notifier_block *nb,
77 * unsigned long val, struct module *mod)
78 * {
79 * return tracepoint_module_notify(nb, val, mod);
80 * }
81 */
82
5f4c791e 83#endif /* #if (LTTNG_LINUX_VERSION_CODE < LTTNG_KERNEL_VERSION(3,15,0) && defined(CONFIG_MODULE_SIG)) */
0147ae64 84
5f4c791e 85#if (LTTNG_LINUX_VERSION_CODE < LTTNG_KERNEL_VERSION(3,15,0) && defined(CONFIG_MODULE_SIG) && defined(MODULE))
0147ae64 86
dd8d5afb
MD
87static inline
88int wrapper_lttng_fixup_sig(struct module *mod)
89{
90 int ret = 0;
91
92 /*
93 * This is for module.c confusing force loaded modules with
94 * unsigned modules.
95 */
96 if (!THIS_MODULE->sig_ok &&
97 THIS_MODULE->taints & (1U << TAINT_FORCED_MODULE)) {
98 THIS_MODULE->taints &= ~(1U << TAINT_FORCED_MODULE);
99 ret = wrapper_tracepoint_module_notify(NULL,
100 MODULE_STATE_COMING, mod);
101 THIS_MODULE->taints |= (1U << TAINT_FORCED_MODULE);
102 }
103 return ret;
104}
105
5f4c791e 106#else /* #if (LTTNG_LINUX_VERSION_CODE < LTTNG_KERNEL_VERSION(3,15,0) && defined(CONFIG_MODULE_SIG) && defined(MODULE)) */
dd8d5afb
MD
107
108static inline
109int wrapper_lttng_fixup_sig(struct module *mod)
110{
111 return 0;
112}
113
5f4c791e 114#endif /* #else #if (LTTNG_LINUX_VERSION_CODE < LTTNG_KERNEL_VERSION(3,15,0) && defined(CONFIG_MODULE_SIG) && defined(MODULE)) */
dd8d5afb 115
5f4c791e 116#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,19,0))
c1b0a625
MD
117static inline struct tracepoint *lttng_tracepoint_ptr_deref(tracepoint_ptr_t *p)
118{
119 return tracepoint_ptr_deref(p);
120}
5f4c791e 121#else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,19,0)) */
61259e63 122static inline struct tracepoint *lttng_tracepoint_ptr_deref(struct tracepoint * const *p)
c1b0a625
MD
123{
124 return *p;
125}
5f4c791e 126#endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,19,0)) */
c1b0a625 127
3a523f5b 128#endif /* _LTTNG_WRAPPER_TRACEPOINT_H */
This page took 0.054293 seconds and 4 git commands to generate.