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

virtphy: Add SIGINT+SIGTERM handlers

Change-Id: I2fe65e0c1912c4d72c276a2db169f0bdbcbda2b8
---
M src/host/virt_phy/src/virtphy.c
1 file changed, 6 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/66/3566/1

diff --git a/src/host/virt_phy/src/virtphy.c b/src/host/virt_phy/src/virtphy.c
index 412b742..153f890 100644
--- a/src/host/virt_phy/src/virtphy.c
+++ b/src/host/virt_phy/src/virtphy.c
@@ -177,6 +177,10 @@
        LOGP(DMAIN, LOGL_NOTICE, "Signal %d received\n", signum);
 
        switch (signum) {
+       case SIGINT:
+       case SIGTERM:
+               exit(0);
+               break;
        case SIGUSR1:
                talloc_report_full(tall_vphy_ctx, stderr);
                break;
@@ -190,6 +194,8 @@
        tall_vphy_ctx = talloc_named_const(NULL, 1, "root");
 
        msgb_talloc_ctx_init(tall_vphy_ctx, 0);
+       signal(SIGINT, &signal_handler);
+       signal(SIGTERM, &signal_handler);
        signal(SIGUSR1, &signal_handler);
        osmo_init_ignore_signals();
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2fe65e0c1912c4d72c276a2db169f0bdbcbda2b8
Gerrit-PatchSet: 1
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <[email protected]>

Reply via email to