[MERGED] osmo-trx[master]: osmo-trx: set up signals using libosmocore helpers
Harald Welte has submitted this change and it was merged. Change subject: osmo-trx: set up signals using libosmocore helpers .. osmo-trx: set up signals using libosmocore helpers Change-Id: I86e78cd6054d0deff1b1aa061299d9f307e2a352 --- M Transceiver52M/osmo-trx.cpp 1 file changed, 20 insertions(+), 12 deletions(-) Approvals: Vadim Yanitskiy: Looks good to me, but someone else must approve Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/Transceiver52M/osmo-trx.cpp b/Transceiver52M/osmo-trx.cpp index 16866f4..0562dcd 100644 --- a/Transceiver52M/osmo-trx.cpp +++ b/Transceiver52M/osmo-trx.cpp @@ -37,6 +37,7 @@ #include extern "C" { +#include #include "convolve.h" #include "convert.h" } @@ -240,20 +241,27 @@ static void sig_handler(int signo) { - fprintf(stdout, "Received shutdown signal"); - gshutdown = true; + fprintf(stdout, "signal %d received\n", signo); + switch (signo) { + case SIGINT: + case SIGTERM: + fprintf(stdout, "shutting down\n"); + gshutdown = true; + break; + default: + break; + } } static void setup_signal_handlers() { - if (signal(SIGINT, sig_handler) == SIG_ERR) { - fprintf(stderr, "Failed to install SIGINT signal handler\n"); - exit(EXIT_FAILURE); - } - if (signal(SIGTERM, sig_handler) == SIG_ERR) { - fprintf(stderr, "Couldn't install SIGTERM signal handler\n"); - exit( EXIT_FAILURE); - } + /* Handle keyboard interrupt SIGINT */ + signal(SIGINT, _handler); + signal(SIGTERM, _handler); + signal(SIGABRT, _handler); + signal(SIGUSR1, _handler); + signal(SIGUSR2, _handler); + osmo_init_ignore_signals(); } @@ -478,6 +486,8 @@ RadioDevice::InterfaceType iface = RadioDevice::NORMAL; struct trx_config config; + setup_signal_handlers(); + #ifdef HAVE_SSE3 printf("Info: SSE3 support compiled in"); #ifdef HAVE___BUILTIN_CPU_SUPPORTS @@ -511,8 +521,6 @@ if (set_sched_rr(config.sched_rr) < 0) return EXIT_FAILURE; } - - setup_signal_handlers(); /* Check database sanity */ if (!trx_setup_config()) { -- To view, visit https://gerrit.osmocom.org/6646 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I86e78cd6054d0deff1b1aa061299d9f307e2a352 Gerrit-PatchSet: 5 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Pau Espin PedrolGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Vadim Yanitskiy
osmo-trx[master]: osmo-trx: set up signals using libosmocore helpers
Patch Set 5: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/6646 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I86e78cd6054d0deff1b1aa061299d9f307e2a352 Gerrit-PatchSet: 5 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Pau Espin PedrolGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Vadim Yanitskiy Gerrit-HasComments: No
osmo-trx[master]: osmo-trx: set up signals using libosmocore helpers
Patch Set 2: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/6646 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I86e78cd6054d0deff1b1aa061299d9f307e2a352 Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Pau Espin PedrolGerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Vadim Yanitskiy Gerrit-HasComments: No
[PATCH] osmo-trx[master]: osmo-trx: set up signals using libosmocore helpers
Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/6646 to look at the new patch set (#2). osmo-trx: set up signals using libosmocore helpers Change-Id: I86e78cd6054d0deff1b1aa061299d9f307e2a352 --- M Transceiver52M/osmo-trx.cpp 1 file changed, 20 insertions(+), 12 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/46/6646/2 diff --git a/Transceiver52M/osmo-trx.cpp b/Transceiver52M/osmo-trx.cpp index 16866f4..0562dcd 100644 --- a/Transceiver52M/osmo-trx.cpp +++ b/Transceiver52M/osmo-trx.cpp @@ -37,6 +37,7 @@ #include extern "C" { +#include #include "convolve.h" #include "convert.h" } @@ -240,20 +241,27 @@ static void sig_handler(int signo) { - fprintf(stdout, "Received shutdown signal"); - gshutdown = true; + fprintf(stdout, "signal %d received\n", signo); + switch (signo) { + case SIGINT: + case SIGTERM: + fprintf(stdout, "shutting down\n"); + gshutdown = true; + break; + default: + break; + } } static void setup_signal_handlers() { - if (signal(SIGINT, sig_handler) == SIG_ERR) { - fprintf(stderr, "Failed to install SIGINT signal handler\n"); - exit(EXIT_FAILURE); - } - if (signal(SIGTERM, sig_handler) == SIG_ERR) { - fprintf(stderr, "Couldn't install SIGTERM signal handler\n"); - exit( EXIT_FAILURE); - } + /* Handle keyboard interrupt SIGINT */ + signal(SIGINT, _handler); + signal(SIGTERM, _handler); + signal(SIGABRT, _handler); + signal(SIGUSR1, _handler); + signal(SIGUSR2, _handler); + osmo_init_ignore_signals(); } @@ -478,6 +486,8 @@ RadioDevice::InterfaceType iface = RadioDevice::NORMAL; struct trx_config config; + setup_signal_handlers(); + #ifdef HAVE_SSE3 printf("Info: SSE3 support compiled in"); #ifdef HAVE___BUILTIN_CPU_SUPPORTS @@ -511,8 +521,6 @@ if (set_sched_rr(config.sched_rr) < 0) return EXIT_FAILURE; } - - setup_signal_handlers(); /* Check database sanity */ if (!trx_setup_config()) { -- To view, visit https://gerrit.osmocom.org/6646 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I86e78cd6054d0deff1b1aa061299d9f307e2a352 Gerrit-PatchSet: 2 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Pau Espin PedrolGerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Vadim Yanitskiy
[PATCH] osmo-trx[master]: osmo-trx: set up signals using libosmocore helpers
Review at https://gerrit.osmocom.org/6646 osmo-trx: set up signals using libosmocore helpers Change-Id: I86e78cd6054d0deff1b1aa061299d9f307e2a352 --- M Transceiver52M/osmo-trx.cpp 1 file changed, 20 insertions(+), 12 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/46/6646/1 diff --git a/Transceiver52M/osmo-trx.cpp b/Transceiver52M/osmo-trx.cpp index 16866f4..07fa5fe 100644 --- a/Transceiver52M/osmo-trx.cpp +++ b/Transceiver52M/osmo-trx.cpp @@ -37,6 +37,7 @@ #include extern "C" { +#include #include "convolve.h" #include "convert.h" } @@ -240,20 +241,27 @@ static void sig_handler(int signo) { - fprintf(stdout, "Received shutdown signal"); - gshutdown = true; + fprintf(stdout, "signal %d received\n", signo); + switch (signo) { + case SIGINT: + case SIGTERM: + fprintf(stdout, "SIGINT received, shutting down\n"); + gshutdown = true; + break; + default: + break; + } } static void setup_signal_handlers() { - if (signal(SIGINT, sig_handler) == SIG_ERR) { - fprintf(stderr, "Failed to install SIGINT signal handler\n"); - exit(EXIT_FAILURE); - } - if (signal(SIGTERM, sig_handler) == SIG_ERR) { - fprintf(stderr, "Couldn't install SIGTERM signal handler\n"); - exit( EXIT_FAILURE); - } + /* Handle keyboard interrupt SIGINT */ + signal(SIGINT, _handler); + signal(SIGTERM, _handler); + signal(SIGABRT, _handler); + signal(SIGUSR1, _handler); + signal(SIGUSR2, _handler); + osmo_init_ignore_signals(); } @@ -478,6 +486,8 @@ RadioDevice::InterfaceType iface = RadioDevice::NORMAL; struct trx_config config; + setup_signal_handlers(); + #ifdef HAVE_SSE3 printf("Info: SSE3 support compiled in"); #ifdef HAVE___BUILTIN_CPU_SUPPORTS @@ -511,8 +521,6 @@ if (set_sched_rr(config.sched_rr) < 0) return EXIT_FAILURE; } - - setup_signal_handlers(); /* Check database sanity */ if (!trx_setup_config()) { -- To view, visit https://gerrit.osmocom.org/6646 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I86e78cd6054d0deff1b1aa061299d9f307e2a352 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Pau Espin Pedrol
osmo-trx[master]: osmo-trx: set up signals using libosmocore helpers
Patch Set 1: (1 comment) https://gerrit.osmocom.org/#/c/6646/1/Transceiver52M/osmo-trx.cpp File Transceiver52M/osmo-trx.cpp: Line 248: fprintf(stdout, "SIGINT received, shutting down\n"); We already printed, which signal was received. Let's either drop the 'SIGINT received' part, either drop the whole line? -- To view, visit https://gerrit.osmocom.org/6646 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I86e78cd6054d0deff1b1aa061299d9f307e2a352 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Pau Espin PedrolGerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Vadim Yanitskiy Gerrit-HasComments: Yes