vty: sub-divide talloc contexts and include them in talloc report
The VTY code makes so many allocations that a full report is
simply too long to provide any useful information. So we sub-divide
it in multiple contexts, and report only one level deep at SIGURS1.
We also introduce SIGUSR2 for the full detailed VTY report.
diff --git a/openbsc/src/bsc_hack.c b/openbsc/src/bsc_hack.c
index 8792cc3..3122fae 100644
--- a/openbsc/src/bsc_hack.c
+++ b/openbsc/src/bsc_hack.c
@@ -138,6 +138,7 @@
}
}
+extern void *tall_vty_ctx;
static void signal_handler(int signal)
{
fprintf(stdout, "signal %u received\n", signal);
@@ -153,8 +154,12 @@
/* in case of abort, we want to obtain a talloc report
* and then return to the caller, who will abort the process */
case SIGUSR1:
+ talloc_report(tall_vty_ctx, stderr);
talloc_report_full(tall_bsc_ctx, stderr);
break;
+ case SIGUSR2:
+ talloc_report_full(tall_vty_ctx, stderr);
+ break;
default:
break;
}
@@ -219,6 +224,7 @@
signal(SIGINT, &signal_handler);
signal(SIGABRT, &signal_handler);
signal(SIGUSR1, &signal_handler);
+ signal(SIGUSR2, &signal_handler);
signal(SIGPIPE, SIG_IGN);
while (1) {