From 72cb9f7e44555965873bc0aa44fa030be3a79167 Mon Sep 17 00:00:00 2001 From: Tom Jones Date: Thu, 25 Jan 2024 10:24:08 +0000 Subject: 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 --- src/vlib/threads.h | 24 ++++++++++++++++++------ 1 file 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 #include +#ifdef __linux__ #include +#elif __FreeBSD__ +#include +#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 { -- cgit 1.2.3-korg