[PATCH] osmo-bts[master]: Treat SIGTERM just like SIGINT in our programs

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/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Sun Aug 20 19:01:59 UTC 2017


Review at  https://gerrit.osmocom.org/3565

Treat SIGTERM just like SIGINT in our programs

When somebody kills the process, it's best to handle the signal
and to use the opportunity for some cleanup.  We always did this
in the BTS on SIGINT, but never on SIGTERM. Let's change it.

Change-Id: I10009c08b7178988f646e2b6035197b9640ac9b5
---
M src/common/main.c
M src/osmo-bts-litecell15/misc/lc15bts_mgr.c
M src/osmo-bts-sysmo/misc/sysmobts_mgr.c
3 files changed, 6 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/65/3565/1

diff --git a/src/common/main.c b/src/common/main.c
index 6c13663..c998c45 100644
--- a/src/common/main.c
+++ b/src/common/main.c
@@ -184,6 +184,7 @@
 
 	switch (signal) {
 	case SIGINT:
+	case SIGTERM:
 		if (!quit) {
 			oml_fail_rep(OSMO_EVT_CRIT_PROC_STOP,
 				     "BTS: SIGINT received -> shutdown");
@@ -324,6 +325,7 @@
 	}
 
 	signal(SIGINT, &signal_handler);
+	signal(SIGTERM, &signal_handler);
 	//signal(SIGABRT, &signal_handler);
 	signal(SIGUSR1, &signal_handler);
 	signal(SIGUSR2, &signal_handler);
diff --git a/src/osmo-bts-litecell15/misc/lc15bts_mgr.c b/src/osmo-bts-litecell15/misc/lc15bts_mgr.c
index cec9a82..7886a5e 100644
--- a/src/osmo-bts-litecell15/misc/lc15bts_mgr.c
+++ b/src/osmo-bts-litecell15/misc/lc15bts_mgr.c
@@ -226,6 +226,7 @@
 
 	switch (signal) {
 	case SIGINT:
+	case SIGTERM:
 		lc15bts_check_temp(no_rom_write);
 		lc15bts_check_power(no_rom_write);
 		lc15bts_check_vswr(no_rom_write);
@@ -297,6 +298,7 @@
 
 	osmo_init_ignore_signals();
 	signal(SIGINT, &signal_handler);
+	signal(SIGTERM, &signal_handler);
 	signal(SIGUSR1, &signal_handler);
 	signal(SIGUSR2, &signal_handler);
 
diff --git a/src/osmo-bts-sysmo/misc/sysmobts_mgr.c b/src/osmo-bts-sysmo/misc/sysmobts_mgr.c
index 6fadf0f..17a6d89 100644
--- a/src/osmo-bts-sysmo/misc/sysmobts_mgr.c
+++ b/src/osmo-bts-sysmo/misc/sysmobts_mgr.c
@@ -198,6 +198,7 @@
 
 	switch (signal) {
 	case SIGINT:
+	case SIGTERM:
 		sysmobts_check_temp(no_eeprom_write);
 		sysmobts_update_hours(no_eeprom_write);
 		exit(0);
@@ -266,6 +267,7 @@
 
 	osmo_init_ignore_signals();
 	signal(SIGINT, &signal_handler);
+	signal(SIGTERM, &signal_handler);
 	signal(SIGUSR1, &signal_handler);
 	signal(SIGUSR2, &signal_handler);
 

-- 
To view, visit https://gerrit.osmocom.org/3565
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I10009c08b7178988f646e2b6035197b9640ac9b5
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>



More information about the gerrit-log mailing list