aboutsummaryrefslogtreecommitdiffstats
path: root/src/signal.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2019-03-20 11:39:40 +0100
committerHarald Welte <laforge@gnumonks.org>2019-07-31 11:50:27 +0200
commit6079675bdb652045eff48880b0d9938b3e7e79ad (patch)
treeaf0651e53b2cd9023ee69ea5f29cdf6603bac1e7 /src/signal.c
parent7b4a05d535f0ecc070e9b506ad0a667e24b67f71 (diff)
make use of OTC_GLOBAL when allocating library-internal contextslaforge/context
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
Diffstat (limited to 'src/signal.c')
-rw-r--r--src/signal.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/signal.c b/src/signal.c
index be3b7778..2c7a56f6 100644
--- a/src/signal.c
+++ b/src/signal.c
@@ -36,7 +36,11 @@
* \file signal.c */
+/* legacy export for old openbsc.git versions that insist on setting this directly */
void *tall_sigh_ctx;
+/* actual talloc context used these days */
+static void *tall_sigh_ctx2;
+
static LLIST_HEAD(signal_handler_list);
struct signal_handler {
@@ -46,14 +50,9 @@ struct signal_handler {
void *data;
};
-/*! Initialize a signal_handler talloc context for \ref osmo_signal_register_handler.
- * Create a talloc context called "osmo_signal".
- * \param[in] root_ctx talloc context used as parent for the new "osmo_signal" ctx.
- * \returns the new osmo_signal talloc context, e.g. for reporting
- */
+/* DEPRECATED: Never really worked and we now have OTC_GLOBAL */
void *osmo_signal_talloc_ctx_init(void *root_ctx) {
- tall_sigh_ctx = talloc_named_const(root_ctx, 0, "osmo_signal");
- return tall_sigh_ctx;
+ return tall_sigh_ctx2;
}
/*! Register a new signal handler
@@ -67,7 +66,12 @@ int osmo_signal_register_handler(unsigned int subsys,
{
struct signal_handler *sig_data;
- sig_data = talloc_zero(tall_sigh_ctx, struct signal_handler);
+ if (!tall_sigh_ctx2)
+ tall_sigh_ctx2 = talloc_named_const(OTC_GLOBAL, 0, "osmo_signal");
+ if (!tall_sigh_ctx2)
+ return -ENOMEM;
+
+ sig_data = talloc(tall_sigh_ctx2, struct signal_handler);
if (!sig_data)
return -ENOMEM;