commit 5b379a91857dd26ff10a6dfbf178d025eaeb082c
parent 5abb56d6fb61e80d95043c5b6f870caf9a8d7d5a
Author: Joris Vink <joris@coders.se>
Date: Thu, 17 Nov 2016 10:05:16 +0100
add a kore_preload() call for single binaries.
This is run on the parent before workers are spawned.
Diffstat:
2 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/includes/kore.h b/includes/kore.h
@@ -639,6 +639,7 @@ void kore_keymgr_run(void);
void kore_keymgr_cleanup(void);
#if defined(KORE_SINGLE_BINARY)
+void kore_preload(void);
void kore_onload(void);
#endif
diff --git a/src/kore.c b/src/kore.c
@@ -400,6 +400,9 @@ kore_server_start(void)
{
u_int32_t tmp;
int quit;
+#if defined(KORE_SINGLE_BINARY)
+ void (*preload)(void);
+#endif
if (foreground == 0 && daemon(1, 1) == -1)
fatal("cannot daemon(): %s", errno_s);
@@ -418,6 +421,11 @@ kore_server_start(void)
#if defined(KORE_USE_JSONRPC)
kore_log(LOG_NOTICE, "jsonrpc built-in enabled");
#endif
+#if defined(KORE_SINGLE_BINARY)
+ *(void **)&(preload) = kore_module_getsym("kore_preload");
+ if (preload != NULL)
+ preload();
+#endif
kore_platform_proctitle("kore [parent]");
kore_msg_init();