Change in libosmocore[master]: vty cpu sched: do not assert if sched impossible

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Mon Aug 17 10:14:27 UTC 2020


laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/19639 )

Change subject: vty cpu sched: do not assert if sched impossible
......................................................................

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
---
M src/vty/cpu_sched_vty.c
1 file changed, 5 insertions(+), 2 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/vty/cpu_sched_vty.c b/src/vty/cpu_sched_vty.c
index 3b6067a..8cd11fe 100644
--- a/src/vty/cpu_sched_vty.c
+++ b/src/vty/cpu_sched_vty.c
@@ -469,7 +469,7 @@
 	LOGP(DLGLOBAL, LOGL_NOTICE, "Setting SCHED_RR priority %d\n", param.sched_priority);
 	rc = sched_setscheduler(getpid(), SCHED_RR, &param);
 	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 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;

-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/19639
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ic40075df8d4cf9fe8f1d711f899dae9a4b5b0928
Gerrit-Change-Number: 19639
Gerrit-PatchSet: 3
Gerrit-Owner: Hoernchen <ewild at sysmocom.de>
Gerrit-Reviewer: Hoernchen <ewild at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200817/e302f36d/attachment.htm>


More information about the gerrit-log mailing list