# the kernel EXTRAVERSION to figure it out. Translate this information
# into a define visible from the C preprocessor.
-DEB_API_VERSION=$(shell $(MAKEFILEDIR)/abi-debian-version.sh $(KERNELDIR))
+DEB_API_VERSION:=$(shell $(MAKEFILEDIR)/abi-debian-version.sh $(KERNELDIR))
ifneq ($(DEB_API_VERSION), 0)
ccflags-y += -DDEBIAN_API_VERSION=$(DEB_API_VERSION)
endif
+
+RT_PATCH_VERSION:=$(shell $(MAKEFILEDIR)/rt-patch-version.sh $(KERNELDIR))
+
+ifneq ($(RT_PATCH_VERSION), 0)
+ ccflags-y += -DRT_PATCH_VERSION=$(RT_PATCH_VERSION)
+endif
LTTNG_RHEL_VERSION_CODE < \
LTTNG_RHEL_KERNEL_VERSION(a_high, b_high, c_high, d_high, e_high))
+#define LTTNG_RT_KERNEL_VERSION(a, b, c, d) \
+ (((a) << 24) + ((b) << 16) + ((c) << 8) + (d))
+
+#ifdef RT_PATCH_VERSION
+#define LTTNG_RT_VERSION_CODE \
+ ((LINUX_VERSION_CODE << 8) + RT_PATCH_VERSION)
+#else
+#define LTTNG_RT_VERSION_CODE 0
+#endif
+
+#define LTTNG_RT_KERNEL_RANGE(a_low, b_low, c_low, d_low, \
+ a_high, b_high, c_high, d_high) \
+ (LTTNG_RT_VERSION_CODE >= \
+ LTTNG_RT_KERNEL_VERSION(a_low, b_low, c_low, d_low) && \
+ LTTNG_RT_VERSION_CODE < \
+ LTTNG_RT_KERNEL_VERSION(a_high, b_high, c_high, d_high))
+
#endif /* _LTTNG_KERNEL_VERSION_H */
--- /dev/null
+#!/bin/sh
+
+# First argument is the path to the kernel headers.
+KPATH=$1
+
+VERSIONFILE=""
+
+if [ -f "${KPATH}/localversion-rt" ]; then
+ VERSIONFILE="${KPATH}/localversion-rt"
+
+elif [ -f "${KPATH}/source/localversion-rt" ]; then
+ VERSIONFILE="${KPATH}/source/localversion-rt"
+else
+ echo 0
+ exit 0
+fi
+
+RT_PATCH_VERSION=$(sed -rn 's/^-rt([0-9]+)$/\1/p' "${VERSIONFILE}")
+
+if [ "x${RT_PATCH_VERSION}" = "x" ]; then
+ echo 0
+ exit 0
+fi
+
+echo ${RT_PATCH_VERSION}