use osmo_init_logging2() with proper talloc ctx
There is a duality of initialization: early_init() in bts.cpp wants to init logging even before static instances get initialized. Make sure that tall_pcu_ctx is initialized during early_init() as well. There is a build context that does not seem to include bts.cpp (osmo-pcu-remote), so to be sure, init tall_pcu_ctx as NULL and both in early_init() as well as pcu_main.cpp, init both tall_pcu_ctx and logging if it is still NULL. Change-Id: I2199b62d0270bd35dec2283e8f5b364b7c63915b
This commit is contained in:
parent
e6e4898027
commit
42f2d61ac9
|
@ -59,7 +59,10 @@ extern "C" {
|
|||
* require logging already to be initialized. */
|
||||
__attribute__((constructor)) static void early_init(void)
|
||||
{
|
||||
osmo_init_logging(&gprs_log_info);
|
||||
if (!tall_pcu_ctx) {
|
||||
tall_pcu_ctx = talloc_named_const(NULL, 1, "Osmo-PCU context");
|
||||
osmo_init_logging2(tall_pcu_ctx, &gprs_log_info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ bool spoof_mnc_3_digits = false;
|
|||
static int config_given = 0;
|
||||
static char *config_file = strdup("osmo-pcu.cfg");
|
||||
extern struct vty_app_info pcu_vty_info;
|
||||
void *tall_pcu_ctx;
|
||||
void *tall_pcu_ctx = NULL;
|
||||
extern void *bv_tall_ctx;
|
||||
static int quit = 0;
|
||||
static int rt_prio = -1;
|
||||
|
@ -181,9 +181,13 @@ int main(int argc, char *argv[])
|
|||
struct gprs_rlcmac_bts *bts;
|
||||
int rc;
|
||||
|
||||
tall_pcu_ctx = talloc_named_const(NULL, 1, "Osmo-PCU context");
|
||||
if (!tall_pcu_ctx)
|
||||
return -ENOMEM;
|
||||
/* tall_pcu_ctx may already have been initialized in bts.cpp during early_init(). */
|
||||
if (!tall_pcu_ctx) {
|
||||
tall_pcu_ctx = talloc_named_const(NULL, 1, "Osmo-PCU context");
|
||||
if (!tall_pcu_ctx)
|
||||
return -ENOMEM;
|
||||
osmo_init_logging2(tall_pcu_ctx, &gprs_log_info);
|
||||
}
|
||||
|
||||
bts = bts_main_data();
|
||||
bts->fc_interval = 1;
|
||||
|
@ -259,7 +263,6 @@ int main(int argc, char *argv[])
|
|||
|
||||
msgb_talloc_ctx_init(tall_pcu_ctx, 0);
|
||||
|
||||
osmo_init_logging(&gprs_log_info);
|
||||
osmo_stats_init(tall_pcu_ctx);
|
||||
rate_ctr_init(tall_pcu_ctx);
|
||||
gprs_ns_set_log_ss(DNS);
|
||||
|
|
|
@ -797,7 +797,7 @@ int main(int argc, char **argv)
|
|||
abort();
|
||||
|
||||
msgb_talloc_ctx_init(tall_pcu_ctx, 0);
|
||||
osmo_init_logging(&gprs_log_info);
|
||||
osmo_init_logging2(tall_pcu_ctx, &gprs_log_info);
|
||||
log_set_use_color(osmo_stderr_target, 0);
|
||||
log_set_print_filename(osmo_stderr_target, 0);
|
||||
if (getenv("LOGL_DEBUG"))
|
||||
|
|
|
@ -155,7 +155,7 @@ int main(int argc, char **argv)
|
|||
|
||||
msgb_talloc_ctx_init(tall_pcu_ctx, 0);
|
||||
|
||||
osmo_init_logging(&gprs_log_info);
|
||||
osmo_init_logging2(tall_pcu_ctx, &gprs_log_info);
|
||||
log_set_use_color(osmo_stderr_target, 0);
|
||||
log_set_print_filename(osmo_stderr_target, 0);
|
||||
log_set_log_level(osmo_stderr_target, LOGL_DEBUG);
|
||||
|
|
|
@ -188,15 +188,15 @@ static void test_EPDAN_decode_tree(void)
|
|||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
osmo_init_logging(&gprs_log_info);
|
||||
log_set_use_color(osmo_stderr_target, 0);
|
||||
log_set_print_filename(osmo_stderr_target, 0);
|
||||
log_parse_category_mask(osmo_stderr_target, "DRLCMACUL,1");
|
||||
|
||||
tall_pcu_ctx = talloc_named_const(NULL, 1, "moiji-mobile bitcompTest context");
|
||||
if (!tall_pcu_ctx)
|
||||
abort();
|
||||
|
||||
osmo_init_logging2(tall_pcu_ctx, &gprs_log_info);
|
||||
log_set_use_color(osmo_stderr_target, 0);
|
||||
log_set_print_filename(osmo_stderr_target, 0);
|
||||
log_parse_category_mask(osmo_stderr_target, "DRLCMACUL,1");
|
||||
|
||||
test_EPDAN_decode_tree();
|
||||
|
||||
if (getenv("TALLOC_REPORT_FULL"))
|
||||
|
|
|
@ -134,7 +134,7 @@ static struct log_info info = {};
|
|||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
osmo_init_logging(&info);
|
||||
osmo_init_logging2(NULL, &info);
|
||||
log_set_use_color(osmo_stderr_target, 0);
|
||||
log_set_print_filename(osmo_stderr_target, 0);
|
||||
log_set_log_level(osmo_stderr_target, LOGL_INFO);
|
||||
|
|
|
@ -1402,7 +1402,7 @@ int main(int argc, char **argv)
|
|||
abort();
|
||||
|
||||
msgb_talloc_ctx_init(tall_pcu_ctx, 0);
|
||||
osmo_init_logging(&gprs_log_info);
|
||||
osmo_init_logging2(tall_pcu_ctx, &gprs_log_info);
|
||||
log_set_use_color(osmo_stderr_target, 0);
|
||||
log_set_print_filename(osmo_stderr_target, 0);
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ int main(int argc, char **argv)
|
|||
abort();
|
||||
|
||||
msgb_talloc_ctx_init(tall_pcu_ctx, 0);
|
||||
osmo_init_logging(&gprs_log_info);
|
||||
osmo_init_logging2(tall_pcu_ctx, &gprs_log_info);
|
||||
vty_init(&pcu_vty_info);
|
||||
pcu_vty_init(&gprs_log_info);
|
||||
|
||||
|
|
|
@ -149,7 +149,7 @@ int main(int argc, char **argv)
|
|||
abort();
|
||||
|
||||
msgb_talloc_ctx_init(tall_pcu_ctx, 0);
|
||||
osmo_init_logging(&gprs_log_info);
|
||||
osmo_init_logging2(tall_pcu_ctx, &gprs_log_info);
|
||||
log_set_use_color(osmo_stderr_target, 0);
|
||||
log_set_print_filename(osmo_stderr_target, 0);
|
||||
log_set_log_level(osmo_stderr_target, LOGL_DEBUG);
|
||||
|
|
|
@ -225,7 +225,7 @@ int main(int argc, char **argv)
|
|||
abort();
|
||||
|
||||
msgb_talloc_ctx_init(tall_pcu_ctx, 0);
|
||||
osmo_init_logging(&gprs_log_info);
|
||||
osmo_init_logging2(tall_pcu_ctx, &gprs_log_info);
|
||||
log_set_use_color(osmo_stderr_target, 0);
|
||||
log_set_print_filename(osmo_stderr_target, 0);
|
||||
log_set_log_level(osmo_stderr_target, LOGL_INFO);
|
||||
|
|
|
@ -524,7 +524,7 @@ int main(int argc, char **argv)
|
|||
abort();
|
||||
|
||||
msgb_talloc_ctx_init(tall_pcu_ctx, 0);
|
||||
osmo_init_logging(&gprs_log_info);
|
||||
osmo_init_logging2(tall_pcu_ctx, &gprs_log_info);
|
||||
log_set_use_color(osmo_stderr_target, 0);
|
||||
log_set_print_filename(osmo_stderr_target, 0);
|
||||
log_set_log_level(osmo_stderr_target, LOGL_INFO);
|
||||
|
|
|
@ -230,7 +230,7 @@ void testCsnLeftAlignedVarBmpBounds(void *test_ctx)
|
|||
int main(int argc, char *argv[])
|
||||
{
|
||||
void *ctx = talloc_named_const(NULL, 1, "RLCMACTest");
|
||||
osmo_init_logging(&gprs_log_info);
|
||||
osmo_init_logging2(ctx, &gprs_log_info);
|
||||
|
||||
//printSizeofRLCMAC();
|
||||
testRlcMacDownlink(ctx);
|
||||
|
|
|
@ -3233,7 +3233,7 @@ int main(int argc, char **argv)
|
|||
abort();
|
||||
|
||||
msgb_talloc_ctx_init(tall_pcu_ctx, 0);
|
||||
osmo_init_logging(&gprs_log_info);
|
||||
osmo_init_logging2(tall_pcu_ctx, &gprs_log_info);
|
||||
log_set_use_color(osmo_stderr_target, 0);
|
||||
log_set_print_filename(osmo_stderr_target, 0);
|
||||
bssgp_set_log_ss(DBSSGP);
|
||||
|
|
|
@ -487,7 +487,7 @@ int main(int argc, char **argv)
|
|||
abort();
|
||||
|
||||
msgb_talloc_ctx_init(tall_pcu_ctx, 0);
|
||||
osmo_init_logging(&gprs_log_info);
|
||||
osmo_init_logging2(tall_pcu_ctx, &gprs_log_info);
|
||||
log_set_use_color(osmo_stderr_target, 0);
|
||||
log_set_print_filename(osmo_stderr_target, 0);
|
||||
|
||||
|
|
Loading…
Reference in New Issue