aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Jones <thj@freebsd.org>2024-01-25 10:24:08 +0000
committerDamjan Marion <dmarion@0xa5.net>2024-02-23 10:02:34 +0000
commit72cb9f7e44555965873bc0aa44fa030be3a79167 (patch)
tree59eeb32f617ecb12ac5eb3775504fb7b9b18125d
parent532a1ce98a47cffbbd6454f503c099bd68b426e7 (diff)
vlib: Use platform specific headers for sched.h
FreeBSD only defines posix scheduling policies, remove the others from the for each look to allow build. Type: improvement Change-Id: Ifdb9414417e8b6ffdf216fd001708b347c496b97 Signed-off-by: Tom Jones <thj@freebsd.org>
-rw-r--r--src/vlib/threads.h24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/vlib/threads.h b/src/vlib/threads.h
index e5a1f6d7ec5..9617cdd32e3 100644
--- a/src/vlib/threads.h
+++ b/src/vlib/threads.h
@@ -17,7 +17,11 @@
#include <vlib/main.h>
#include <vppinfra/callback.h>
+#ifdef __linux__
#include <linux/sched.h>
+#elif __FreeBSD__
+#include <sys/sched.h>
+#endif /* __linux__ */
void vlib_set_thread_name (char *name);
@@ -214,12 +218,20 @@ __foreach_vlib_main_helper (vlib_main_t *ii, vlib_main_t **p)
__foreach_vlib_main_helper (ii, &this_vlib_main); ii++) \
if (this_vlib_main)
-#define foreach_sched_policy \
- _(SCHED_OTHER, OTHER, "other") \
- _(SCHED_BATCH, BATCH, "batch") \
- _(SCHED_IDLE, IDLE, "idle") \
- _(SCHED_FIFO, FIFO, "fifo") \
- _(SCHED_RR, RR, "rr")
+#define foreach_sched_policy_posix \
+ _ (SCHED_OTHER, OTHER, "other") \
+ _ (SCHED_FIFO, FIFO, "fifo") \
+ _ (SCHED_RR, RR, "rr")
+#define foreach_sched_policy_linux \
+ _ (SCHED_BATCH, BATCH, "batch") \
+ _ (SCHED_IDLE, IDLE, "idle")
+
+#ifdef __linux__
+#define foreach_sched_policy \
+ foreach_sched_policy_posix foreach_sched_policy_linux
+#else
+#define foreach_sched_policy foreach_sched_policy_posix
+#endif /* __linux__ */
typedef enum
{