mirror of
https://github.com/troglobit/finit.git
synced 2026-11-06 15:51:03 +00:00
Refactor, move registration of static services to conf_init()
All services registered in the system rely on conf_init() having been set up properly, e.g., global_rlimit. Having conf_init() be responsible also for registering static services is only logical, and also helps us clean up main() a bit. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
82dfa002ff
commit
e9515971ea
5 files changed
+15
-18
No files matched your search
@@ -50,7 +50,6 @@
|
|||||||
#include "sig.h"
|
#include "sig.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
extern svc_t *wdog;
|
|
||||||
static uev_t api_watcher;
|
static uev_t api_watcher;
|
||||||
|
|
||||||
static int call(int (*action)(svc_t *, void *), char *buf, size_t len)
|
static int call(int (*action)(svc_t *, void *), char *buf, size_t len)
|
||||||
|
|||||||
+14
@@ -1209,6 +1209,20 @@ int conf_init(uev_ctx_t *ctx)
|
|||||||
/* Initialize global rlimits, e.g. for built-in services */
|
/* Initialize global rlimits, e.g. for built-in services */
|
||||||
memcpy(global_rlimit, initial_rlimit, sizeof(global_rlimit));
|
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 ...");
|
dbg("Allow plugins to register early runlevel 1 run/task/services ...");
|
||||||
plugin_run_hooks(HOOK_SVC_PLUGIN);
|
plugin_run_hooks(HOOK_SVC_PLUGIN);
|
||||||
|
|
||||||
|
|||||||
-14
@@ -814,20 +814,6 @@ int main(int argc, char *argv[])
|
|||||||
conf_init(&loop);
|
conf_init(&loop);
|
||||||
conf_saverc();
|
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
|
* Set up inotify watcher for /etc/finit.conf, /etc/finit.d, and
|
||||||
* their deps, to figure out how to bootstrap the system.
|
* their deps, to figure out how to bootstrap the system.
|
||||||
|
|||||||
+1
-1
@@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
extern char *finit_conf;
|
extern char *finit_conf;
|
||||||
extern char *finit_rcsd;
|
extern char *finit_rcsd;
|
||||||
|
extern svc_t *wdog;
|
||||||
extern int service_interval;
|
extern int service_interval;
|
||||||
|
|
||||||
int api_init (uev_ctx_t *ctx);
|
int api_init (uev_ctx_t *ctx);
|
||||||
|
|||||||
@@ -97,8 +97,6 @@
|
|||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "utmp-api.h"
|
#include "utmp-api.h"
|
||||||
|
|
||||||
extern svc_t *wdog;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Old-style SysV shutdown sends a setenv cmd INIT_HALT with "=HALT",
|
* Old-style SysV shutdown sends a setenv cmd INIT_HALT with "=HALT",
|
||||||
* "=POWERDOWN", or "" to cancel shutdown, before requesting change to
|
* "=POWERDOWN", or "" to cancel shutdown, before requesting change to
|
||||||
|
|||||||
Reference in new issue
Block a user