From: Tom Jones Date: Thu, 25 Jan 2024 10:24:08 +0000 (+0000) Subject: vlib: Use platform specific headers for sched.h X-Git-Tag: v24.10-rc0~216 X-Git-Url: https://gerrit.fd.io/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F52%2F40252%2F7;p=vpp.git 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 --- 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 {