uprobe: Support multiple call sites for the same uprobe event
[lttng-modules.git] / lttng-kernel-version.h
CommitLineData
9f36eaed
MJ
1/* SPDX-License-Identifier: (GPL-2.0 or LGPL-2.1)
2 *
5fa38800
MD
3 * lttng-kernel-version.h
4 *
5 * Contains helpers to check more complex kernel version conditions.
6 *
7 * Copyright (C) 2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5fa38800
MD
8 */
9
9f36eaed
MJ
10#ifndef _LTTNG_KERNEL_VERSION_H
11#define _LTTNG_KERNEL_VERSION_H
12
5fa38800 13#include <linux/version.h>
9f61c55f
MD
14
15#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33))
16#include <generated/utsrelease.h>
17#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)) */
7b10d281 18#include <linux/utsrelease.h>
9f61c55f 19#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)) */
5fa38800
MD
20
21/*
22 * This macro checks if the kernel version is between the two specified
144bbfd5 23 * versions (lower limit inclusive, upper limit exclusive).
5fa38800
MD
24 */
25#define LTTNG_KERNEL_RANGE(a_low, b_low, c_low, a_high, b_high, c_high) \
26 (LINUX_VERSION_CODE >= KERNEL_VERSION(a_low, b_low, c_low) && \
144bbfd5 27 LINUX_VERSION_CODE < KERNEL_VERSION(a_high, b_high, c_high))
5fa38800 28
c94ac1ac
MJ
29/* Ubuntu */
30
3e5941df 31#define LTTNG_UBUNTU_KERNEL_VERSION(a, b, c, d) \
5c7af523 32 (((a) << 24) + ((b) << 16) + ((c) << 8) + (d))
3e5941df 33
05732a66 34#ifdef UTS_UBUNTU_RELEASE_ABI
3e5941df
JD
35#define LTTNG_UBUNTU_VERSION_CODE \
36 ((LINUX_VERSION_CODE << 8) + UTS_UBUNTU_RELEASE_ABI)
05732a66
MD
37#else
38#define LTTNG_UBUNTU_VERSION_CODE 0
39#endif
3e5941df
JD
40
41#define LTTNG_UBUNTU_KERNEL_RANGE(a_low, b_low, c_low, d_low, \
42 a_high, b_high, c_high, d_high) \
05732a66 43 (LTTNG_UBUNTU_VERSION_CODE >= \
3e5941df
JD
44 LTTNG_UBUNTU_KERNEL_VERSION(a_low, b_low, c_low, d_low) && \
45 LTTNG_UBUNTU_VERSION_CODE < \
46 LTTNG_UBUNTU_KERNEL_VERSION(a_high, b_high, c_high, d_high))
47
c94ac1ac
MJ
48/* Debian */
49
72e6c528
MD
50#define LTTNG_DEBIAN_KERNEL_VERSION(a, b, c, d, e, f) \
51 (((((a) << 16) + ((b) << 8) + (c)) * 1000000ULL) + ((d) * 10000) + ((e) * 100) + (f))
52
05732a66 53#ifdef DEBIAN_API_VERSION
72e6c528
MD
54#define LTTNG_DEBIAN_VERSION_CODE \
55 ((LINUX_VERSION_CODE * 1000000ULL) + DEBIAN_API_VERSION)
05732a66
MD
56#else
57#define LTTNG_DEBIAN_VERSION_CODE 0
58#endif
72e6c528
MD
59
60#define LTTNG_DEBIAN_KERNEL_RANGE(a_low, b_low, c_low, d_low, e_low, f_low, \
61 a_high, b_high, c_high, d_high, e_high, f_high) \
05732a66 62 (LTTNG_DEBIAN_VERSION_CODE >= \
72e6c528
MD
63 LTTNG_DEBIAN_KERNEL_VERSION(a_low, b_low, c_low, d_low, e_low, f_low) && \
64 LTTNG_DEBIAN_VERSION_CODE < \
65 LTTNG_DEBIAN_KERNEL_VERSION(a_high, b_high, c_high, d_high, e_high, f_high))
66
c94ac1ac
MJ
67#define LTTNG_RHEL_KERNEL_VERSION(a, b, c, d, e, f) \
68 (((((a) << 16) + ((b) << 8) + (c)) * 10000000ULL) + ((d) * 10000) + ((e) * 100) + (f))
69
70/* RHEL */
f30ae671 71
c94ac1ac 72#ifdef RHEL_API_VERSION
f30ae671 73#define LTTNG_RHEL_VERSION_CODE \
c94ac1ac 74 ((LINUX_VERSION_CODE * 10000000ULL) + RHEL_API_VERSION)
f30ae671
MD
75#else
76#define LTTNG_RHEL_VERSION_CODE 0
77#endif
78
c94ac1ac
MJ
79#define LTTNG_RHEL_KERNEL_RANGE(a_low, b_low, c_low, d_low, e_low, f_low, \
80 a_high, b_high, c_high, d_high, e_high, f_high) \
f30ae671 81 (LTTNG_RHEL_VERSION_CODE >= \
c94ac1ac 82 LTTNG_RHEL_KERNEL_VERSION(a_low, b_low, c_low, d_low, e_low, f_low) && \
f30ae671 83 LTTNG_RHEL_VERSION_CODE < \
c94ac1ac
MJ
84 LTTNG_RHEL_KERNEL_VERSION(a_high, b_high, c_high, d_high, e_high, f_high))
85
ce66b486
MJ
86/* SUSE Linux enterprise */
87
88#define LTTNG_SLE_KERNEL_VERSION(a, b, c, d, e, f) \
89 (((((a) << 16) + ((b) << 8) + (c)) * 10000000ULL) + ((d) * 10000) + ((e) * 100) + (f))
90
91#ifdef SLE_API_VERSION
92#define LTTNG_SLE_VERSION_CODE \
93 ((LINUX_VERSION_CODE * 10000000ULL) + SLE_API_VERSION)
94#else
95#define LTTNG_SLE_VERSION_CODE 0
96#endif
97
98#define LTTNG_SLE_KERNEL_RANGE(a_low, b_low, c_low, d_low, e_low, f_low, \
99 a_high, b_high, c_high, d_high, e_high, f_high) \
100 (LTTNG_SLE_VERSION_CODE >= \
101 LTTNG_SLE_KERNEL_VERSION(a_low, b_low, c_low, d_low, e_low, f_low) && \
102 LTTNG_SLE_VERSION_CODE < \
103 LTTNG_SLE_KERNEL_VERSION(a_high, b_high, c_high, d_high, e_high, f_high))
104
e4838da1
LG
105/* Fedora */
106
107#define LTTNG_FEDORA_KERNEL_VERSION(a, b, c, d) \
108 (((((a) << 16) + ((b) << 8) + (c)) * 10000ULL) + (d))
109
110#ifdef FEDORA_REVISION_VERSION
111#define LTTNG_FEDORA_VERSION_CODE \
112 ((LINUX_VERSION_CODE * 10000ULL) + FEDORA_REVISION_VERSION)
113#else
114#define LTTNG_FEDORA_VERSION_CODE 0
115#endif
116
117#define LTTNG_FEDORA_KERNEL_RANGE(a_low, b_low, c_low, d_low, \
118 a_high, b_high, c_high, d_high) \
119 (LTTNG_FEDORA_VERSION_CODE >= \
120 LTTNG_FEDORA_KERNEL_VERSION(a_low, b_low, c_low, d_low) && \
121 LTTNG_FEDORA_VERSION_CODE < \
122 LTTNG_FEDORA_KERNEL_VERSION(a_high, b_high, c_high, d_high))
123
c94ac1ac 124/* RT patch */
f30ae671 125
b4c8e4d3
MJ
126#define LTTNG_RT_KERNEL_VERSION(a, b, c, d) \
127 (((a) << 24) + ((b) << 16) + ((c) << 8) + (d))
128
129#ifdef RT_PATCH_VERSION
130#define LTTNG_RT_VERSION_CODE \
131 ((LINUX_VERSION_CODE << 8) + RT_PATCH_VERSION)
132#else
133#define LTTNG_RT_VERSION_CODE 0
134#endif
135
136#define LTTNG_RT_KERNEL_RANGE(a_low, b_low, c_low, d_low, \
137 a_high, b_high, c_high, d_high) \
138 (LTTNG_RT_VERSION_CODE >= \
139 LTTNG_RT_KERNEL_VERSION(a_low, b_low, c_low, d_low) && \
140 LTTNG_RT_VERSION_CODE < \
141 LTTNG_RT_KERNEL_VERSION(a_high, b_high, c_high, d_high))
142
5fa38800 143#endif /* _LTTNG_KERNEL_VERSION_H */
This page took 0.036753 seconds and 4 git commands to generate.