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.orglaforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/21357 ) Change subject: oc2g-mgr: generate coredump and exit upon SIGABRT received ...................................................................... oc2g-mgr: generate coredump and exit upon SIGABRT received Previous code relied on abort() switching sigaction to SIG_FDL + retriggering SIGABRT in case the signal handler returns, which would then generate the coredump + terminate the process. However, if a SIGABRT is received from somewhere else (kill -SIGABRT), then the process would print the talloc report and continue running, which is not desired. Change-Id: I7a5756e106ac1061d37b42c22cc127fdacd87ce7 Fixes: OS#4865 --- M src/osmo-bts-oc2g/misc/oc2gbts_mgr.c 1 file changed, 15 insertions(+), 4 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved diff --git a/src/osmo-bts-oc2g/misc/oc2gbts_mgr.c b/src/osmo-bts-oc2g/misc/oc2gbts_mgr.c index 66c9f28..9469259 100644 --- a/src/osmo-bts-oc2g/misc/oc2gbts_mgr.c +++ b/src/osmo-bts-oc2g/misc/oc2gbts_mgr.c @@ -1,7 +1,7 @@ /* Main program for NuRAN Wireless OC-2G BTS management daemon */ /* Copyright (C) 2015 by Yves Godin <support at nuranwireless.com> - * + * * Based on sysmoBTS: * sysmobts_mgr.c * (C) 2012 by Harald Welte <laforge at gnumonks.org> @@ -201,11 +201,11 @@ return 0; } -static void signal_handler(int signal) +static void signal_handler(int signum) { - fprintf(stderr, "signal %u received\n", signal); + fprintf(stderr, "signal %u received\n", signum); - switch (signal) { + switch (signum) { case SIGINT: oc2gbts_check_temp(no_rom_write); oc2gbts_check_power(no_rom_write); @@ -214,6 +214,16 @@ exit(0); break; case SIGABRT: + /* in case of abort, we want to obtain a talloc report and + * then run default SIGABRT handler, who will generate coredump + * and abort the process. abort() should do this for us after we + * return, but program wouldn't exit if an external SIGABRT is + * received. + */ + talloc_report_full(tall_mgr_ctx, stderr); + signal(SIGABRT, SIG_DFL); + raise(SIGABRT); + break; case SIGUSR1: case SIGUSR2: talloc_report_full(tall_mgr_ctx, stderr); @@ -280,6 +290,7 @@ osmo_init_ignore_signals(); signal(SIGINT, &signal_handler); + signal(SIGABRT, &signal_handler); signal(SIGUSR1, &signal_handler); signal(SIGUSR2, &signal_handler); -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/21357 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: I7a5756e106ac1061d37b42c22cc127fdacd87ce7 Gerrit-Change-Number: 21357 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin at sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge at osmocom.org> Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201126/628da369/attachment.htm>