From c63b106760cc99aa857caa104a2d24cd3753e161 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Tue, 9 Jan 2024 20:55:58 -0500 Subject: [PATCH] Fix: Include linux/sched/rt.h for kernels v3.9 to v3.14 From kernel v3.0 to v3.8, MAX_RT_PRIO is defined in linux/sched.h. From kernel v3.9 to v3.14, MAX_RT_PRIO is defined in linux/sched/rt.h, which is not included by linux/sched.h (hence this work-around). From kernel v3.15 onwards, MAX_RT_PRIO is defined in linux/sched/prio.h, which is included by linux/sched.h. Add the missing linux/sched/rt.h include for the affected kernel version range. Signed-off-by: Mathieu Desnoyers Change-Id: Ie7e1d9dc710621deca04553a9b5ba7f9a4d83c15 --- src/lttng-context-prio.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/lttng-context-prio.c b/src/lttng-context-prio.c index cbe94800..8cb025cd 100644 --- a/src/lttng-context-prio.c +++ b/src/lttng-context-prio.c @@ -15,6 +15,18 @@ #include #include #include +#include + +/* + * From kernel v3.0 to v3.8, MAX_RT_PRIO is defined in linux/sched.h. + * From kernel v3.9 to v3.14, MAX_RT_PRIO is defined in linux/sched/rt.h, + * which is not included by linux/sched.h (hence this work-around). + * From kernel v3.15 onwards, MAX_RT_PRIO is defined in linux/sched/prio.h, + * which is included by linux/sched.h. + */ +#if LTTNG_KERNEL_RANGE(3,9,0, 3,15,0) +# include +#endif /* * task_prio() has been implemented as p->prio - MAX_RT_PRIO since at -- 2.34.1