path: root/src/signal.c
diff options
authorPau Espin Pedrol <pespin@sysmocom.de>2018-08-16 19:05:19 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2018-08-16 21:03:32 +0200
commit0b6fcb0349a608023d971d576fe2ee6af18dcb45 (patch)
treefaf63605c9cfb3eb45b43233aa2c38a7003de251 /src/signal.c
parentacc0a070c770eb16aba8ef93780eda5365057b6c (diff)
signal: Introduce API osmo_signal_talloc_ctx_init
Otherwise applications need to use "extern void* tall_sigh_ctx" and set it manually (that symbol is not exported in any header file) or end up allocating struct signal_handler into the NULL talloc ctx. API created in a similar way as already existing msgb_talloc_ctx_init(), but without the pool_size because it's not considered necessary in this case. Change-Id: Id58ca18eb826b8f4183a7cf0dbb2b38cba702a09
Diffstat (limited to 'src/signal.c')
1 files changed, 9 insertions, 0 deletions
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