diff --git a/src/api.c b/src/api.c index 3ea1322d..75ae7d9e 100644 --- a/src/api.c +++ b/src/api.c @@ -50,7 +50,6 @@ #include "sig.h" #include "util.h" -extern svc_t *wdog; static uev_t api_watcher; static int call(int (*action)(svc_t *, void *), char *buf, size_t len) diff --git a/src/conf.c b/src/conf.c index 5a13a637..fb5b3ae5 100644 --- a/src/conf.c +++ b/src/conf.c @@ -1209,6 +1209,20 @@ int conf_init(uev_ctx_t *ctx) /* Initialize global rlimits, e.g. for built-in services */ memcpy(global_rlimit, initial_rlimit, sizeof(global_rlimit)); + /* + * Start built-in watchdogd as soon as possible, if enabled + */ + if (whichp(FINIT_LIBPATH_ "/watchdogd") && fexist(WDT_DEVNODE)) { + service_register(SVC_TYPE_SERVICE, "[123456789] cgroup.init name:watchdog :finit " FINIT_LIBPATH_ "/watchdogd -- Finit watchdog daemon", global_rlimit, NULL); + wdog = svc_find("watchdog", "finit"); + } + + /* + * Start kernel event daemon as soon as possible, if enabled + */ + if (whichp(FINIT_LIBPATH_ "/keventd")) + service_register(SVC_TYPE_SERVICE, "[123456789] cgroup.init " FINIT_LIBPATH_ "/keventd -- Finit kernel event daemon", global_rlimit, NULL); + dbg("Allow plugins to register early runlevel 1 run/task/services ..."); plugin_run_hooks(HOOK_SVC_PLUGIN); diff --git a/src/finit.c b/src/finit.c index 807bf2b5..640aea63 100644 --- a/src/finit.c +++ b/src/finit.c @@ -814,20 +814,6 @@ int main(int argc, char *argv[]) conf_init(&loop); conf_saverc(); - /* - * Start built-in watchdogd as soon as possible, if enabled - */ - if (whichp(FINIT_LIBPATH_ "/watchdogd") && fexist(WDT_DEVNODE)) { - service_register(SVC_TYPE_SERVICE, "[123456789] cgroup.init name:watchdog :finit " FINIT_LIBPATH_ "/watchdogd -- Finit watchdog daemon", global_rlimit, NULL); - wdog = svc_find("watchdog", "finit"); - } - - /* - * Start kernel event daemon as soon as possible, if enabled - */ - if (whichp(FINIT_LIBPATH_ "/keventd")) - service_register(SVC_TYPE_SERVICE, "[123456789] cgroup.init " FINIT_LIBPATH_ "/keventd -- Finit kernel event daemon", global_rlimit, NULL); - /* * Set up inotify watcher for /etc/finit.conf, /etc/finit.d, and * their deps, to figure out how to bootstrap the system. diff --git a/src/private.h b/src/private.h index fe790b5f..0fdac945 100644 --- a/src/private.h +++ b/src/private.h @@ -34,7 +34,7 @@ extern char *finit_conf; extern char *finit_rcsd; - +extern svc_t *wdog; extern int service_interval; int api_init (uev_ctx_t *ctx); diff --git a/src/sig.c b/src/sig.c index 92a6ce59..142f06ea 100644 --- a/src/sig.c +++ b/src/sig.c @@ -97,8 +97,6 @@ #include "util.h" #include "utmp-api.h" -extern svc_t *wdog; - /* * Old-style SysV shutdown sends a setenv cmd INIT_HALT with "=HALT", * "=POWERDOWN", or "" to cancel shutdown, before requesting change to