[PATCH] osmo-ggsn[master]: use osmo_init_logging2

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Tue Apr 17 12:31:50 UTC 2018


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

use osmo_init_logging2

Change-Id: Ic38fff17cc985238b91999c8acdd92d22fd28c72
---
M ggsn/ggsn.c
M sgsnemu/sgsnemu.c
M tests/gtp/gtpie_test.c
M tests/lib/in46a_test.c
M tests/lib/ippool_test.c
5 files changed, 18 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ggsn refs/changes/52/7852/1

diff --git a/ggsn/ggsn.c b/ggsn/ggsn.c
index df071d2..cb11c49 100644
--- a/ggsn/ggsn.c
+++ b/ggsn/ggsn.c
@@ -1073,7 +1073,7 @@
 	signal(SIGUSR2, &signal_handler);
 
 	osmo_init_ignore_signals();
-	osmo_init_logging(&log_info);
+	osmo_init_logging2(tall_ggsn_ctx, &log_info);
 	osmo_stats_init(tall_ggsn_ctx);
 
 	vty_init(&g_vty_info);
diff --git a/sgsnemu/sgsnemu.c b/sgsnemu/sgsnemu.c
index 804b542..99f56da 100644
--- a/sgsnemu/sgsnemu.c
+++ b/sgsnemu/sgsnemu.c
@@ -20,6 +20,7 @@
 #endif
 
 #include <osmocom/core/application.h>
+#include <osmocom/core/msgb.h>
 
 #include <ctype.h>
 #include <netdb.h>
@@ -79,6 +80,7 @@
 struct tun_t *tun = NULL;	/* TUN instance */
 int maxfd = 0;			/* For select() */
 int echoversion = 1;		/* First try this version */
+void *tall_sgsnemu_ctx;		/* root talloc ctx */
 
 /* Struct with local versions of gengetopt options */
 struct {
@@ -1540,7 +1542,9 @@
 	signal(SIGHUP,  signal_handler);
 	signal(SIGINT,  signal_handler);
 
-	osmo_init_logging(&log_info);
+	tall_sgsnemu_ctx = talloc_named_const(NULL, 0, "sgsnemu");
+	msgb_talloc_ctx_init(tall_sgsnemu_ctx, 0);
+	osmo_init_logging2(tall_sgsnemu_ctx, &log_info);
 
 	/* Process options given in configuration file and command line */
 	if (process_options(argc, argv))
diff --git a/tests/gtp/gtpie_test.c b/tests/gtp/gtpie_test.c
index e3bc2e0..95dd900 100644
--- a/tests/gtp/gtpie_test.c
+++ b/tests/gtp/gtpie_test.c
@@ -7,6 +7,7 @@
 #include <osmocom/core/utils.h>
 #include <osmocom/core/application.h>
 #include <osmocom/core/logging.h>
+#include <osmocom/core/msgb.h>
 #include <osmocom/core/bits.h>
 
 #include "../../lib/syserr.h"
@@ -108,7 +109,9 @@
 
 int main(int argc, char **argv)
 {
-	osmo_init_logging(&log_info);
+	void *tall_ctx = talloc_named_const(NULL, 1, "Root context");
+	msgb_talloc_ctx_init(tall_ctx, 0);
+	osmo_init_logging2(tall_ctx, &log_info);
 	log_set_use_color(osmo_stderr_target, 0);
 	log_set_print_filename(osmo_stderr_target, 0);
 
diff --git a/tests/lib/in46a_test.c b/tests/lib/in46a_test.c
index b22da16..407ac5d 100644
--- a/tests/lib/in46a_test.c
+++ b/tests/lib/in46a_test.c
@@ -10,6 +10,7 @@
 #include <osmocom/core/utils.h>
 #include <osmocom/core/application.h>
 #include <osmocom/core/logging.h>
+#include <osmocom/core/msgb.h>
 #include <osmocom/core/bits.h>
 
 #include "../../lib/in46_addr.h"
@@ -426,7 +427,9 @@
 
 int main(int argc, char **argv)
 {
-	osmo_init_logging(&log_info);
+	void *tall_ctx = talloc_named_const(NULL, 1, "Root context");
+	msgb_talloc_ctx_init(tall_ctx, 0);
+	osmo_init_logging2(tall_ctx, &log_info);
 	log_set_use_color(osmo_stderr_target, 0);
 	log_set_print_filename(osmo_stderr_target, 0);
 
diff --git a/tests/lib/ippool_test.c b/tests/lib/ippool_test.c
index 8d3f46c..6155ab8 100644
--- a/tests/lib/ippool_test.c
+++ b/tests/lib/ippool_test.c
@@ -7,6 +7,7 @@
 #include <osmocom/core/utils.h>
 #include <osmocom/core/application.h>
 #include <osmocom/core/logging.h>
+#include <osmocom/core/msgb.h>
 
 #include "../../lib/in46_addr.h"
 #include "../../lib/ippool.h"
@@ -126,7 +127,9 @@
 
 int main(int argc, char **argv)
 {
-	osmo_init_logging(&log_info);
+	void *tall_ctx = talloc_named_const(NULL, 1, "Root context");
+	msgb_talloc_ctx_init(tall_ctx, 0);
+	osmo_init_logging2(tall_ctx, &log_info);
 	log_set_use_color(osmo_stderr_target, 0);
 	log_set_print_filename(osmo_stderr_target, 0);
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic38fff17cc985238b91999c8acdd92d22fd28c72
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>



More information about the gerrit-log mailing list