aboutsummaryrefslogtreecommitdiffstats
path: root/src/e1_recorder.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2016-10-19 10:47:17 +0200
committerHarald Welte <laforge@gnumonks.org>2016-10-19 10:55:25 +0200
commitdf7a306df5a1cb41ad42c303001f24a06f28458e (patch)
treec8c0100f1863fb5e93c5920f7603e841202d0aec /src/e1_recorder.c
parent13351138e2081c5d02de11eef1050b17ffa199a1 (diff)
e1_recorder: Add signal handlers for log file rotation + talloc report
Diffstat (limited to 'src/e1_recorder.c')
-rw-r--r--src/e1_recorder.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/e1_recorder.c b/src/e1_recorder.c
index 703a67e..b0ae044 100644
--- a/src/e1_recorder.c
+++ b/src/e1_recorder.c
@@ -1,3 +1,5 @@
+#include <signal.h>
+
#include <osmocom/core/signal.h>
#include <osmocom/core/logging.h>
#include <osmocom/core/application.h>
@@ -82,6 +84,18 @@ struct vty_app_info vty_info = {
static void *rec_tall_ctx;
struct e1_recorder g_recorder;
+static void signal_handler(int signo)
+{
+ switch (signo) {
+ case SIGHUP:
+ storage_close();
+ break;
+ case SIGUSR1:
+ talloc_report(rec_tall_ctx, stderr);
+ break;
+ }
+}
+
int main(int argc, char **argv)
{
int rc;
@@ -96,6 +110,9 @@ int main(int argc, char **argv)
e1inp_vty_init();
recorder_vty_init();
+ signal(SIGHUP, &signal_handler);
+ signal(SIGUSR1, &signal_handler);
+
rc = vty_read_config_file("osmo-e1-recorder.cfg", NULL);
if (rc < 0)
exit(1);