mirror of
https://github.com/troglobit/finit.git
synced 2026-11-06 15:51:03 +00:00
Minor, helper function for logging runlevel as a char
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
e00fda5dc3
commit
feb97bc77c
1 file changed
+12
-5
@@ -77,6 +77,13 @@ static char *sm_status(sm_state_t state)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char sm_runlevel(int lvl)
|
||||||
|
{
|
||||||
|
if (lvl == INIT_LEVEL)
|
||||||
|
return 'S';
|
||||||
|
return lvl + '0';
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Disable login in single user mode and shutdown/reboot
|
* Disable login in single user mode and shutdown/reboot
|
||||||
*
|
*
|
||||||
@@ -116,8 +123,8 @@ void sm_step(sm_t *sm)
|
|||||||
restart:
|
restart:
|
||||||
old_state = sm->state;
|
old_state = sm->state;
|
||||||
|
|
||||||
dbg("state: %s, runlevel: %d, newlevel: %d, teardown: %d, reload: %d",
|
dbg("state: %s, runlevel: %c, newlevel: %d, teardown: %d, reload: %d",
|
||||||
sm_status(sm->state), runlevel, sm->newlevel, sm->in_teardown, sm->reload);
|
sm_status(sm->state), sm_runlevel(runlevel), sm->newlevel, sm->in_teardown, sm->reload);
|
||||||
|
|
||||||
switch (sm->state) {
|
switch (sm->state) {
|
||||||
case SM_BOOTSTRAP_STATE:
|
case SM_BOOTSTRAP_STATE:
|
||||||
@@ -155,11 +162,11 @@ restart:
|
|||||||
plugin_run_hooks(HOOK_SHUTDOWN);
|
plugin_run_hooks(HOOK_SHUTDOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
dbg("Setting new runlevel --> %d <-- previous %d", runlevel, prevlevel);
|
dbg("Setting new runlevel --> %c <-- previous %c", sm_runlevel(runlevel), sm_runlevel(prevlevel));
|
||||||
if (osheading)
|
if (osheading)
|
||||||
logit(LOG_CONSOLE | LOG_NOTICE, "%s, entering runlevel %d", osheading, runlevel);
|
logit(LOG_CONSOLE | LOG_NOTICE, "%s, entering runlevel %c", osheading, sm_runlevel(runlevel));
|
||||||
else
|
else
|
||||||
logit(LOG_CONSOLE | LOG_NOTICE, "Entering runlevel %d", runlevel);
|
logit(LOG_CONSOLE | LOG_NOTICE, "Entering runlevel %c", sm_runlevel(runlevel));
|
||||||
runlevel_set(prevlevel, runlevel);
|
runlevel_set(prevlevel, runlevel);
|
||||||
|
|
||||||
/* Disable login in single-user mode as well as shutdown/reboot */
|
/* Disable login in single-user mode as well as shutdown/reboot */
|
||||||
|
|||||||
Reference in new issue
Block a user