Timur Davydov has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/42690?usp=email )
Change subject: build: make sched_* usage optional ......................................................................
build: make sched_* usage optional
Add configure checks for sched_* APIs and guard usage of sched_setscheduler with HAVE_SCHED_SETSCHEDULER.
This avoids build/runtime issues on platforms without scheduler support.
Change-Id: I5af357c1e2074fa1e05ac6bc20af8535c474d906 --- M configure.ac M src/common/main.c 2 files changed, 6 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/90/42690/1
diff --git a/configure.ac b/configure.ac index 1d69bc3..8f8e0d9 100644 --- a/configure.ac +++ b/configure.ac @@ -331,6 +331,10 @@ AC_DEFINE(HAVE_SYS_TIMERFD_H, 1, [Define if we found sys/timerfd.h]) fi
+dnl Check the scheduller functions +AC_CHECK_HEADERS([sched.h]) +AC_CHECK_FUNCS([sched_setaffinity sched_setscheduler]) + # Generate manuals AC_ARG_ENABLE(manuals, [AS_HELP_STRING( diff --git a/src/common/main.c b/src/common/main.c index 2bdd8ce..8327b57 100644 --- a/src/common/main.c +++ b/src/common/main.c @@ -305,6 +305,7 @@ exit(1); }
+#ifdef HAVE_SCHED_SETSCHEDULER /* enable realtime priority for us */ if (rt_prio != -1) { struct sched_param param; @@ -318,6 +319,7 @@ exit(1); } } +#endif /* HAVE_SCHED_SETSCHEDULER */
if (bts_init(g_bts) < 0) { fprintf(stderr, "unable to open bts\n");