Change in libosmocore[master]: make use of OTC_GLOBAL when allocating library-internal contexts
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/13338 ) Change subject: make use of OTC_GLOBAL when allocating library-internal contexts .. Patch Set 23: (3 comments) https://gerrit.osmocom.org/c/libosmocore/+/13338/23/src/gsm/lapd_core.c File src/gsm/lapd_core.c: https://gerrit.osmocom.org/c/libosmocore/+/13338/23/src/gsm/lapd_core.c@257 PS23, Line 257: __thread void *tall_lapd_ctx; > I'd say adding __thread here is actually a different fix/commit. Ack https://gerrit.osmocom.org/c/libosmocore/+/13338/23/src/gsm/lapdm.c File src/gsm/lapdm.c: https://gerrit.osmocom.org/c/libosmocore/+/13338/23/src/gsm/lapdm.c@129 PS23, Line 129: extern __thread void *tall_lapd_ctx; > same (__thread) Ack https://gerrit.osmocom.org/c/libosmocore/+/13338/23/src/signal.c File src/signal.c: https://gerrit.osmocom.org/c/libosmocore/+/13338/23/src/signal.c@42 PS23, Line 42: static void *tall_sigh_ctx2; > why not reuse the tall_sigh_ctx and make it static once we get rid of its use > in openbsc? because we always want to be abl to build old applications against new libosmocore libraries. -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/13338 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I48f475efd3ee0d5120b8fc30861e852d1a6920b1 Gerrit-Change-Number: 13338 Gerrit-PatchSet: 23 Gerrit-Owner: laforge Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria Gerrit-Reviewer: laforge Gerrit-Reviewer: pespin Gerrit-Comment-Date: Thu, 10 Jun 2021 14:36:09 + Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: pespin Gerrit-MessageType: comment
Change in libosmocore[master]: make use of OTC_GLOBAL when allocating library-internal contexts
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/13338 ) Change subject: make use of OTC_GLOBAL when allocating library-internal contexts .. Patch Set 23: Code-Review-1 (5 comments) https://gerrit.osmocom.org/c/libosmocore/+/13338/23/src/gsm/lapd_core.c File src/gsm/lapd_core.c: https://gerrit.osmocom.org/c/libosmocore/+/13338/23/src/gsm/lapd_core.c@257 PS23, Line 257: __thread void *tall_lapd_ctx; I'd say adding __thread here is actually a different fix/commit. https://gerrit.osmocom.org/c/libosmocore/+/13338/23/src/gsm/lapdm.c File src/gsm/lapdm.c: https://gerrit.osmocom.org/c/libosmocore/+/13338/23/src/gsm/lapdm.c@129 PS23, Line 129: extern __thread void *tall_lapd_ctx; same (__thread) https://gerrit.osmocom.org/c/libosmocore/+/13338/23/src/logging.c File src/logging.c: https://gerrit.osmocom.org/c/libosmocore/+/13338/23/src/logging.c@1066 PS23, Line 1066: * \param[in] ctx should be NULL; only used for egacy API compatibility typo: legacy https://gerrit.osmocom.org/c/libosmocore/+/13338/23/src/signal.c File src/signal.c: https://gerrit.osmocom.org/c/libosmocore/+/13338/23/src/signal.c@42 PS23, Line 42: static void *tall_sigh_ctx2; why not reuse the tall_sigh_ctx and make it static once we get rid of its use in openbsc? https://gerrit.osmocom.org/c/libosmocore/+/13338/23/src/vty/telnet_interface.c File src/vty/telnet_interface.c: https://gerrit.osmocom.org/c/libosmocore/+/13338/23/src/vty/telnet_interface.c@78 PS23, Line 78: * \param[in] tall_ctx should be NULL; nly for legacy API compatibility typo: only -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/13338 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I48f475efd3ee0d5120b8fc30861e852d1a6920b1 Gerrit-Change-Number: 13338 Gerrit-PatchSet: 23 Gerrit-Owner: laforge Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria Gerrit-Reviewer: laforge Gerrit-Reviewer: pespin Gerrit-Comment-Date: Wed, 03 Feb 2021 12:30:21 + Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
Change in libosmocore[master]: make use of OTC_GLOBAL when allocating library-internal contexts
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/13338 ) Change subject: make use of OTC_GLOBAL when allocating library-internal contexts .. Set Ready For Review -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/13338 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I48f475efd3ee0d5120b8fc30861e852d1a6920b1 Gerrit-Change-Number: 13338 Gerrit-PatchSet: 23 Gerrit-Owner: laforge Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria Gerrit-Reviewer: laforge Gerrit-Reviewer: pespin Gerrit-Comment-Date: Wed, 03 Feb 2021 12:23:21 + Gerrit-HasComments: No Gerrit-Has-Labels: No Gerrit-MessageType: comment
Change in libosmocore[master]: make use of OTC_GLOBAL when allocating library-internal contexts
Hello Jenkins Builder, fixeria, pespin, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/libosmocore/+/13338 to look at the new patch set (#21). Change subject: make use of OTC_GLOBAL when allocating library-internal contexts .. make use of OTC_GLOBAL when allocating library-internal contexts As libosmcore is now managing the global talloc contexts, there's no point in having APIs where the user tells the library about which talloc contexts to use for a given sub-system. Change-Id: I48f475efd3ee0d5120b8fc30861e852d1a6920b1 --- M include/osmocom/core/signal.h M src/counter.c M src/ctrl/control_vty.c M src/gb/gprs_bssgp.c M src/gsm/lapd_core.c M src/gsm/lapdm.c M src/logging.c M src/signal.c M src/stats.c M src/vty/telnet_interface.c M tests/ctrl/ctrl_test.c 11 files changed, 43 insertions(+), 25 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/38/13338/21 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/13338 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I48f475efd3ee0d5120b8fc30861e852d1a6920b1 Gerrit-Change-Number: 13338 Gerrit-PatchSet: 21 Gerrit-Owner: laforge Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria Gerrit-Reviewer: laforge Gerrit-Reviewer: pespin Gerrit-MessageType: newpatchset
Change in libosmocore[master]: make use of OTC_GLOBAL when allocating library-internal contexts
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/13338 ) Change subject: make use of OTC_GLOBAL when allocating library-internal contexts .. Patch Set 18: Code-Review-1 I think it breaks osmo-sgsn 'make check', I'll investigate. -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/13338 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I48f475efd3ee0d5120b8fc30861e852d1a6920b1 Gerrit-Change-Number: 13338 Gerrit-PatchSet: 18 Gerrit-Owner: laforge Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria Gerrit-Reviewer: laforge Gerrit-Reviewer: pespin Gerrit-Comment-Date: Sun, 01 Dec 2019 09:01:00 + Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
Change in libosmocore[master]: make use of OTC_GLOBAL when allocating library-internal contexts
fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/13338 ) Change subject: make use of OTC_GLOBAL when allocating library-internal contexts .. Patch Set 18: Code-Review+1 (2 comments) https://gerrit.osmocom.org/c/libosmocore/+/13338/18/src/logging.c File src/logging.c: https://gerrit.osmocom.org/c/libosmocore/+/13338/18/src/logging.c@1021 PS18, Line 1021: egacy legacy https://gerrit.osmocom.org/c/libosmocore/+/13338/18/src/vty/telnet_interface.c File src/vty/telnet_interface.c: https://gerrit.osmocom.org/c/libosmocore/+/13338/18/src/vty/telnet_interface.c@78 PS18, Line 78: nly only -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/13338 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I48f475efd3ee0d5120b8fc30861e852d1a6920b1 Gerrit-Change-Number: 13338 Gerrit-PatchSet: 18 Gerrit-Owner: laforge Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria Gerrit-Reviewer: laforge Gerrit-Reviewer: pespin Gerrit-Comment-Date: Sat, 30 Nov 2019 20:50:55 + Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
Change in libosmocore[master]: make use of OTC_GLOBAL when allocating library-internal contexts
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/13338 ) Change subject: make use of OTC_GLOBAL when allocating library-internal contexts .. Set Ready For Review -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/13338 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I48f475efd3ee0d5120b8fc30861e852d1a6920b1 Gerrit-Change-Number: 13338 Gerrit-PatchSet: 18 Gerrit-Owner: laforge Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria Gerrit-Reviewer: laforge Gerrit-Reviewer: pespin Gerrit-Comment-Date: Sat, 30 Nov 2019 20:48:08 + Gerrit-HasComments: No Gerrit-Has-Labels: No Gerrit-MessageType: comment
Change in libosmocore[master]: make use of OTC_GLOBAL when allocating library-internal contexts
fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/13338 ) Change subject: make use of OTC_GLOBAL when allocating library-internal contexts .. Patch Set 15: (1 comment) https://gerrit.osmocom.org/c/libosmocore/+/13338/15/src/ctrl/control_vty.c File src/ctrl/control_vty.c: https://gerrit.osmocom.org/c/libosmocore/+/13338/15/src/ctrl/control_vty.c@85 PS15, Line 85: ctx Wouldn't GCC warn us that this argument is passed but not used? I really like the approach of Wireshark - the '_U_' macro / attribute. -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/13338 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I48f475efd3ee0d5120b8fc30861e852d1a6920b1 Gerrit-Change-Number: 13338 Gerrit-PatchSet: 15 Gerrit-Owner: laforge Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria Gerrit-Reviewer: pespin Gerrit-Comment-Date: Sat, 23 Nov 2019 13:56:36 + Gerrit-HasComments: Yes Gerrit-Has-Labels: No Gerrit-MessageType: comment
Change in ...libosmocore[master]: make use of OTC_GLOBAL when allocating library-internal contexts
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/13338 ) Change subject: make use of OTC_GLOBAL when allocating library-internal contexts .. Patch Set 14: Code-Review-1 (3 comments) https://gerrit.osmocom.org/#/c/13338/14/src/ctrl/control_vty.c File src/ctrl/control_vty.c: https://gerrit.osmocom.org/#/c/13338/14/src/ctrl/control_vty.c@31 PS14, Line 31: static void *ctrl_vty_ctx = NULL; Should be per-thread? https://gerrit.osmocom.org/#/c/13338/14/src/gb/gprs_bssgp.c File src/gb/gprs_bssgp.c: https://gerrit.osmocom.org/#/c/13338/14/src/gb/gprs_bssgp.c@45 PS14, Line 45: void *bssgp_tall_ctx = NULL; Since bssgp_tall_ctx becomes now a child of OTC_GLOBAL (osmo_ctx->global), being osmo_ctx a per-thread variable. now the application has no real control over the talloc context being used, which means bssgp_tall_ctx should be per thread too. Otherwise if _alloc() is called through different threads, thread B may end up using bssgp_tall_ctx allocated under thread A's osmo_ctx. https://gerrit.osmocom.org/#/c/13338/14/src/logging.c File src/logging.c: https://gerrit.osmocom.org/#/c/13338/14/src/logging.c@63 PS14, Line 63: void *tall_log_ctx = NULL; Should be per thread? -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/13338 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I48f475efd3ee0d5120b8fc30861e852d1a6920b1 Gerrit-Change-Number: 13338 Gerrit-PatchSet: 14 Gerrit-Owner: laforge Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria Gerrit-Reviewer: pespin Gerrit-Comment-Date: Mon, 30 Sep 2019 08:48:30 + Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
Change in ...libosmocore[master]: make use of OTC_GLOBAL when allocating library-internal contexts
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/13338 ) Change subject: make use of OTC_GLOBAL when allocating library-internal contexts .. Set Ready For Review -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/13338 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I48f475efd3ee0d5120b8fc30861e852d1a6920b1 Gerrit-Change-Number: 13338 Gerrit-PatchSet: 14 Gerrit-Owner: laforge Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria Gerrit-Comment-Date: Sat, 28 Sep 2019 12:43:24 + Gerrit-HasComments: No Gerrit-Has-Labels: No Gerrit-MessageType: comment
Change in ...libosmocore[master]: make use of OTC_GLOBAL when allocating library-internal contexts
Hello fixeria, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/libosmocore/+/13338 to look at the new patch set (#9). Change subject: make use of OTC_GLOBAL when allocating library-internal contexts .. make use of OTC_GLOBAL when allocating library-internal contexts As libosmcore is now managing the global talloc contexts, there's no point in having APIs where the user tells the library about which talloc contexts to use for a given sub-system. Change-Id: I48f475efd3ee0d5120b8fc30861e852d1a6920b1 --- M include/osmocom/core/signal.h M src/counter.c M src/ctrl/control_vty.c M src/gb/gprs_bssgp.c M src/gsm/lapd_core.c M src/logging.c M src/signal.c M src/stats.c M src/vty/telnet_interface.c M tests/ctrl/ctrl_test.c 10 files changed, 42 insertions(+), 24 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/38/13338/9 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/13338 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I48f475efd3ee0d5120b8fc30861e852d1a6920b1 Gerrit-Change-Number: 13338 Gerrit-PatchSet: 9 Gerrit-Owner: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria Gerrit-MessageType: newpatchset
Change in libosmocore[master]: make use of OTC_GLOBAL when allocating library-internal contexts
Vadim Yanitskiy has posted comments on this change. ( https://gerrit.osmocom.org/13338 ) Change subject: make use of OTC_GLOBAL when allocating library-internal contexts .. Patch Set 5: Code-Review+1 (2 comments) https://gerrit.osmocom.org/#/c/13338/5/src/gsm/lapd_core.c File src/gsm/lapd_core.c: https://gerrit.osmocom.org/#/c/13338/5/src/gsm/lapd_core.c@255 PS5, Line 255: __thread Looks like it should have been done in https://gerrit.osmocom.org/#/c/libosmocore/+/13436/. https://gerrit.osmocom.org/#/c/13338/5/src/logging.c File src/logging.c: https://gerrit.osmocom.org/#/c/13338/5/src/logging.c@962 PS5, Line 962: ctx Should we mark it as '__unused' then? -- To view, visit https://gerrit.osmocom.org/13338 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I48f475efd3ee0d5120b8fc30861e852d1a6920b1 Gerrit-Change-Number: 13338 Gerrit-PatchSet: 5 Gerrit-Owner: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Vadim Yanitskiy Gerrit-Comment-Date: Wed, 03 Apr 2019 16:37:06 + Gerrit-HasComments: Yes Gerrit-HasLabels: Yes
Change in libosmocore[master]: make use of OTC_GLOBAL when allocating library-internal contexts
Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/13338 to look at the new patch set (#2). Change subject: make use of OTC_GLOBAL when allocating library-internal contexts .. make use of OTC_GLOBAL when allocating library-internal contexts As libosmcore is now managing the global talloc contexts, there's no point in having APIs where the user tells the library about which talloc contexts to use for a given sub-system. Change-Id: I48f475efd3ee0d5120b8fc30861e852d1a6920b1 --- M include/osmocom/core/signal.h M src/counter.c M src/ctrl/control_vty.c M src/gb/gprs_bssgp.c M src/gsm/lapd_core.c M src/logging.c M src/signal.c M src/stats.c M src/vty/telnet_interface.c M tests/ctrl/ctrl_test.c 10 files changed, 42 insertions(+), 24 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/38/13338/2 -- To view, visit https://gerrit.osmocom.org/13338 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-MessageType: newpatchset Gerrit-Change-Id: I48f475efd3ee0d5120b8fc30861e852d1a6920b1 Gerrit-Change-Number: 13338 Gerrit-PatchSet: 2 Gerrit-Owner: Harald Welte Gerrit-Reviewer: Jenkins Builder (102)
Change in libosmocore[master]: make use of OTC_GLOBAL when allocating library-internal contexts
Harald Welte has uploaded this change for review. ( https://gerrit.osmocom.org/13338 Change subject: make use of OTC_GLOBAL when allocating library-internal contexts .. make use of OTC_GLOBAL when allocating library-internal contexts As libosmcore is now managing the global talloc contexts, there's no point in having APIs where the user tells the library about which talloc contexts to use for a given sub-system. Change-Id: I48f475efd3ee0d5120b8fc30861e852d1a6920b1 --- M include/osmocom/core/signal.h M src/counter.c M src/ctrl/control_vty.c M src/gb/gprs_bssgp.c M src/gsm/lapd_core.c M src/logging.c M src/signal.c M src/stats.c M src/vty/telnet_interface.c M tests/ctrl/ctrl_test.c 10 files changed, 36 insertions(+), 22 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/38/13338/1 diff --git a/include/osmocom/core/signal.h b/include/osmocom/core/signal.h index 449b976..0f17843 100644 --- a/include/osmocom/core/signal.h +++ b/include/osmocom/core/signal.h @@ -1,6 +1,7 @@ #pragma once #include +#include /*! \defgroup signal Intra-application signals * @{ @@ -34,7 +35,8 @@ /* Management */ -void *osmo_signal_talloc_ctx_init(void *root_ctx); +void *osmo_signal_talloc_ctx_init(void *root_ctx) + OSMO_DEPRECATED("libosmocore internally allocates this context now."); int osmo_signal_register_handler(unsigned int subsys, osmo_signal_cbfn *cbfn, void *data); void osmo_signal_unregister_handler(unsigned int subsys, osmo_signal_cbfn *cbfn, void *data); diff --git a/src/counter.c b/src/counter.c index 0fa3166..482dfc2 100644 --- a/src/counter.c +++ b/src/counter.c @@ -1,7 +1,7 @@ /*! \file counter.c * utility routines for keeping some statistics. */ /* - * (C) 2009 by Harald Welte + * (C) 2009,2019 by Harald Welte * * All Rights Reserved * @@ -39,8 +39,12 @@ * \returns Allocated counter on success; NULL on error */ struct osmo_counter *osmo_counter_alloc(const char *name) { - struct osmo_counter *ctr = talloc_zero(tall_ctr_ctx, struct osmo_counter); + struct osmo_counter *ctr; + if (!tall_ctr_ctx) + tall_ctr_ctx = talloc_named_const(OTC_GLOBAL, 0, "osmo_counter"); + + ctr = talloc_zero(tall_ctr_ctx, struct osmo_counter); if (!ctr) return NULL; diff --git a/src/ctrl/control_vty.c b/src/ctrl/control_vty.c index ef98889..0dc8bfe 100644 --- a/src/ctrl/control_vty.c +++ b/src/ctrl/control_vty.c @@ -79,9 +79,14 @@ return CMD_SUCCESS; } +/*! Initialize the VTY configuration for the CTRL interface. + * \param[in] ctx UNUSED, only for legacy compatibility + * \returns 0 on success; negative on error */ int ctrl_vty_init(void *ctx) { - ctrl_vty_ctx = ctx; + ctrl_vty_ctx = talloc_named_const(OTC_GLOBAL, 0, "ctrl-vty"); + if (!ctrl_vty_ctx) + return -1; install_element(CONFIG_NODE, _ctrl_cmd); install_node(_node, config_write_ctrl); diff --git a/src/gb/gprs_bssgp.c b/src/gb/gprs_bssgp.c index 4a4bab3..884914b 100644 --- a/src/gb/gprs_bssgp.c +++ b/src/gb/gprs_bssgp.c @@ -121,6 +121,9 @@ { struct bssgp_bvc_ctx *ctx; + if (!bssgp_tall_ctx) + bssgp_tall_ctx = talloc_named_const(OTC_GLOBAL, 0, "bssgp"); + ctx = talloc_zero(bssgp_tall_ctx, struct bssgp_bvc_ctx); if (!ctx) return NULL; diff --git a/src/gsm/lapd_core.c b/src/gsm/lapd_core.c index a2ff230..afbb1e9 100644 --- a/src/gsm/lapd_core.c +++ b/src/gsm/lapd_core.c @@ -252,7 +252,7 @@ dl->state = state; } -static void *tall_lapd_ctx = NULL; +static __thread void *tall_lapd_ctx; /* init datalink instance and allocate history */ void lapd_dl_init(struct lapd_datalink *dl, uint8_t k, uint8_t v_range, @@ -299,7 +299,7 @@ lapd_dl_newstate(dl, LAPD_STATE_IDLE); if (!tall_lapd_ctx) - tall_lapd_ctx = talloc_named_const(NULL, 1, "lapd context"); + tall_lapd_ctx = talloc_named_const(OTC_GLOBAL, 1, "lapd context"); dl->tx_hist = talloc_zero_array(tall_lapd_ctx, struct lapd_history, dl->range_hist); } diff --git a/src/logging.c b/src/logging.c index 09021e4..80a1852 100644 --- a/src/logging.c +++ b/src/logging.c @@ -954,7 +954,7 @@ /*! Initialize the Osmocom logging core * \param[in] inf Information regarding logging categories, could be NULL - * \param[in] ctx \ref talloc context for logging allocations + * \param[in] ctx UNUSED, only for legacy API compatibility * \returns 0 in case of success, negative in case of error * * If inf is NULL then only library-internal categories are initialized. @@ -963,7 +963,7 @@ { int i; - tall_log_ctx = talloc_named_const(ctx, 1, "logging"); + tall_log_ctx = talloc_named_const(OTC_GLOBAL, 1, "logging"); if (!tall_log_ctx) return -ENOMEM; diff --git