mirror of
https://github.com/troglobit/finit.git
synced 2026-10-04 06:44:12 +07:00
Add and improve debug messages, clean out old dev. comments
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
@@ -401,6 +401,7 @@ int api_init(uev_ctx_t *ctx)
|
||||
.sun_path = INIT_SOCKET,
|
||||
};
|
||||
|
||||
_d("Setting up external API socket ...");
|
||||
sd = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0);
|
||||
if (-1 == sd) {
|
||||
_pe("Failed starting external API socket");
|
||||
|
||||
+1
-6
@@ -398,7 +398,7 @@ static int parse_conf_dynamic(char *file, struct timeval *mtime)
|
||||
/* Prepare default limits for each service */
|
||||
memcpy(rlimit, global_rlimit, sizeof(rlimit));
|
||||
|
||||
_d("Parsing %s", file);
|
||||
_d("Parsing %s <<<<<<", file);
|
||||
while (!feof(fp)) {
|
||||
char line[LINE_SIZE] = "";
|
||||
|
||||
@@ -417,7 +417,6 @@ static int parse_conf_dynamic(char *file, struct timeval *mtime)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Reads /etc/finit.conf, once at boot */
|
||||
static int parse_conf(char *file)
|
||||
{
|
||||
FILE *fp;
|
||||
@@ -508,10 +507,6 @@ int conf_reload_dynamic(void)
|
||||
|
||||
rp = realpath(path, NULL);
|
||||
if (!rp) {
|
||||
/*
|
||||
* XXX: Prune from rcsd?
|
||||
* XXX: Possibly temporary service from last boot
|
||||
*/
|
||||
logit(LOG_WARNING, "Skipping %s, dangling symlink: %s", path, strerror(errno));
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -256,18 +256,22 @@ static void finalize(void)
|
||||
/*
|
||||
* Network stuff
|
||||
*/
|
||||
_d("Setting up networking ...");
|
||||
networking();
|
||||
umask(022);
|
||||
|
||||
/* Hooks that rely on loopback, or basic networking being up. */
|
||||
_d("Calling all network up hooks ...");
|
||||
plugin_run_hooks(HOOK_NETWORK_UP);
|
||||
|
||||
/*
|
||||
* Start all tasks/services in the configured runlevel
|
||||
*/
|
||||
_d("Change to default runlevel, start all services ...");
|
||||
service_runlevel(cfglevel);
|
||||
|
||||
/* Clean up bootstrap-only tasks/services that never started */
|
||||
_d("Clean up all bootstrap-only tasks/services ...");
|
||||
svc_prune_bootstrap();
|
||||
|
||||
/* All services/tasks/inetd/etc. in configure runlevel have started */
|
||||
@@ -291,13 +295,16 @@ static void finalize(void)
|
||||
}
|
||||
|
||||
/* Hooks that should run at the very end */
|
||||
_d("Calling all system up hooks ...");
|
||||
plugin_run_hooks(HOOK_SYSTEM_UP);
|
||||
service_step_all(SVC_TYPE_ANY);
|
||||
|
||||
/* Enable silent mode before starting TTYs */
|
||||
_d("Going silent ...");
|
||||
log_silent();
|
||||
|
||||
/* Delayed start of TTYs at bootstrap */
|
||||
_d("Launching all getty services ...");
|
||||
tty_runlevel();
|
||||
}
|
||||
|
||||
@@ -505,11 +512,13 @@ int main(int argc, char* argv[])
|
||||
* Wait for all SVC_TYPE_RUNTASK to have completed their work in
|
||||
* [S], or timeout, before calling finalize()
|
||||
*/
|
||||
_d("Starting bootstrap finalize timer ...");
|
||||
uev_timer_init(&loop, &timer, service_bootstrap_cb, finalize, 1000, 1000);
|
||||
|
||||
/*
|
||||
* Enter main loop to monior /dev/initctl and services
|
||||
*/
|
||||
_d("Entering main loop ...");
|
||||
return uev_run(&loop, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -1095,7 +1095,6 @@ void service_bootstrap_cb(uev_t *w, void *arg, int events)
|
||||
finalize();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Local Variables:
|
||||
* indent-tabs-mode: t
|
||||
|
||||
@@ -95,7 +95,8 @@ void sm_step(sm_t *sm)
|
||||
restart:
|
||||
old_state = sm->state;
|
||||
|
||||
_d("state: %s", sm_status(sm->state));
|
||||
_d("state: %s, runlevel: %d, newlevel: %d, teardown: %d, reload: %d",
|
||||
sm_status(sm->state), runlevel, sm->newlevel, sm->in_teardown, sm->reload);
|
||||
|
||||
switch (sm->state) {
|
||||
case SM_BOOTSTRAP_STATE:
|
||||
|
||||
Reference in New Issue
Block a user