summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/osmocom/core/signal.h1
-rw-r--r--src/signal.c9
2 files changed, 10 insertions, 0 deletions
diff --git a/include/osmocom/core/signal.h b/include/osmocom/core/signal.h
index ae78f152..449b9762 100644
--- a/include/osmocom/core/signal.h
+++ b/include/osmocom/core/signal.h
@@ -34,6 +34,7 @@ typedef int osmo_signal_cbfn(unsigned int subsys, unsigned int signal, void *han
/* Management */
+void *osmo_signal_talloc_ctx_init(void *root_ctx);
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/signal.c b/src/signal.c
index 745d7c38..188876b8 100644
--- a/src/signal.c
+++ b/src/signal.c
@@ -46,6 +46,15 @@ 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
+ */
+void *osmo_signal_talloc_ctx_init(void *root_ctx) {
+ tall_sigh_ctx = talloc_named_const(tall_sigh_ctx, 0, "osmo_signal");
+ return tall_sigh_ctx;
+}
/*! Register a new signal handler
* \param[in] subsys Subsystem number