diff options
author | Eric <ewild@sysmocom.de> | 2020-08-14 03:15:10 +0200 |
---|---|---|
committer | laforge <laforge@osmocom.org> | 2020-08-17 10:14:27 +0000 |
commit | dde327275c2c37127656248be0e3b8f24cdca283 (patch) | |
tree | 2a9805fca4785a296369df6a00786c6806be6459 /src/vty | |
parent | 523c4e0f448a4db1734341cea7908d6a343d0275 (diff) |
vty cpu sched: do not assert if sched impossible
Shared code might be used by applications that have no vty, so sched
can't be initialized, do not assert and break everything in this case, a
warning should suffice.
Change-Id: Ic40075df8d4cf9fe8f1d711f899dae9a4b5b0928
Diffstat (limited to 'src/vty')
-rw-r--r-- | src/vty/cpu_sched_vty.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/vty/cpu_sched_vty.c b/src/vty/cpu_sched_vty.c index 3b6067a3..8cd11fe1 100644 --- a/src/vty/cpu_sched_vty.c +++ b/src/vty/cpu_sched_vty.c @@ -469,7 +469,7 @@ static int set_sched_rr(unsigned int prio) LOGP(DLGLOBAL, LOGL_NOTICE, "Setting SCHED_RR priority %d\n", param.sched_priority); rc = sched_setscheduler(getpid(), SCHED_RR, ¶m); if (rc == -1) { - LOGP(DLGLOBAL, LOGL_FATAL, "Setting SCHED_RR priority %d failed: %s\n", + LOGP(DLGLOBAL, LOGL_ERROR, "Setting SCHED_RR priority %d failed: %s\n", param.sched_priority, strerror(errno)); return -1; } @@ -631,7 +631,10 @@ int osmo_cpu_sched_vty_apply_localthread(void) int rc = 0; /* Assert subsystem was inited and structs are preset */ - OSMO_ASSERT(sched_vty_opts); + if (!sched_vty_opts) { + LOGP(DLGLOBAL, LOGL_FATAL, "Setting cpu-affinity mask impossible: no opts!\n"); + return 0; + } if (pthread_getname_np(pthread_self(), name, sizeof(name)) == 0) has_name = true; |