[PATCH] osmo-hlr[master]: main: add and use root talloc ctx

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Wed Feb 1 03:44:56 UTC 2017


Hello Jenkins Builder, Holger Freyther,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/1705

to look at the new patch set (#2).

main: add and use root talloc ctx

Create hlr_ctx and pass on to DB and GSUP server code.
Add call msgb_talloc_ctx_init(hlr_ctx).

Instead of printing the entire talloc context on exit, just print the hlr_ctx
upon SIGUSR1 (like our other binaries do). Otherwise we will get pages of
talloc output on each program exit as soon as we add a VTY (next patch).

Change-Id: I3c64cb4ad7a681b88c7409296ad3afeb8000e2a4
---
M src/hlr.c
1 file changed, 7 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/05/1705/2

diff --git a/src/hlr.c b/src/hlr.c
index 674a58b..bf0655e 100644
--- a/src/hlr.c
+++ b/src/hlr.c
@@ -516,6 +516,7 @@
 	return 0;
 }
 
+static void *hlr_ctx = NULL;
 static struct osmo_gsup_server *gs;
 
 static void signal_hdlr(int signal)
@@ -526,11 +527,12 @@
 		osmo_gsup_server_destroy(gs);
 		db_close(g_dbc);
 		log_fini();
+		talloc_report_full(hlr_ctx, stderr);
 		exit(0);
 		break;
 	case SIGUSR1:
 		LOGP(DMAIN, LOGL_DEBUG, "Talloc Report due to SIGUSR1\n");
-		talloc_report_full(NULL, stderr);
+		talloc_report_full(hlr_ctx, stderr);
 		break;
 	}
 }
@@ -539,7 +541,8 @@
 {
 	int rc;
 
-	talloc_enable_leak_report_full();
+	hlr_ctx = talloc_named_const(NULL, 1, "OsmoHLR");
+	msgb_talloc_ctx_init(hlr_ctx, 0);
 
 	rc = osmo_init_logging(&hlr_log_info);
 	if (rc < 0) {
@@ -554,13 +557,13 @@
 		exit(1);
 	}
 
-	g_dbc = db_open(NULL, "hlr.db");
+	g_dbc = db_open(hlr_ctx, "hlr.db");
 	if (!g_dbc) {
 		LOGP(DMAIN, LOGL_FATAL, "Error opening database\n");
 		exit(1);
 	}
 
-	gs = osmo_gsup_server_create(NULL, NULL, 2222, read_cb);
+	gs = osmo_gsup_server_create(hlr_ctx, NULL, 2222, read_cb);
 	if (!gs) {
 		LOGP(DMAIN, LOGL_FATAL, "Error starting GSUP server\n");
 		exit(1);

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I3c64cb4ad7a681b88c7409296ad3afeb8000e2a4
Gerrit-PatchSet: 2
Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Holger Freyther <holger at freyther.de>
Gerrit-Reviewer: Jenkins Builder


More information about the gerrit-log mailing list