Clean up bootstrap-only tasks when leaving bootstrap 'S' runlevel

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson
2015-11-26 20:22:24 +01:00
parent 8df2b7b6e9
commit b4ccc8b008
4 changed files with 26 additions and 3 deletions
+2 -2
View File
@@ -43,9 +43,9 @@
int debug = 0;
int quiet = KERNEL_QUIET; /* Delayed disable of verbose mode. */
int verbose = VERBOSE_MODE;
int runlevel = 0; /* Bootstrap */
int runlevel = 0; /* Bootstrap 'S' */
int cfglevel = RUNLEVEL; /* Fallback if no configured runlevel */
int prevlevel = 0; /* HALT */
int prevlevel = -1;
char *sdown = NULL;
char *network = NULL;
char *username = NULL;
+5 -1
View File
@@ -598,7 +598,8 @@ void service_runlevel(int newlevel)
else
erase("/etc/nologin");
if (0 != prevlevel)
/* No TTYs run at bootstrap, they have a delayed start. */
if (prevlevel > 0)
tty_runlevel(runlevel);
}
@@ -869,6 +870,9 @@ void service_monitor(pid_t lost)
if (lost != svc->pid)
continue;
if (!prevlevel && svc_clean_bootstrap(svc))
continue;
if (SVC_TYPE_SERVICE != svc->type) {
svc->pid = 0;
continue;
+18
View File
@@ -359,6 +359,24 @@ void svc_clean_dynamic(void (*cb)(svc_t *))
}
}
/**
* svc_clean_bootstrap - Remove bootstrap-only services after boot
* @svc: Pointer to &svc_t object
*
* Returns:
* %TRUE(1) if object was bootstrap-only, otherwise %FALSE(0)
*/
int svc_clean_bootstrap(svc_t *svc)
{
if (!ISOTHER(svc->runlevels, 0)) {
svc->pid = 0;
svc_del(svc);
return 1;
}
return 0;
}
char *svc_status(svc_t *svc)
{
if (svc->pid)
+1
View File
@@ -144,6 +144,7 @@ void svc_foreach_dynamic (void (*cb)(svc_t *));
void svc_mark_dynamic (void);
void svc_check_dirty (svc_t *svc, time_t mtime);
void svc_clean_dynamic (void (*cb)(svc_t *));
int svc_clean_bootstrap (svc_t *svc);
char *svc_status (svc_t *svc);
int svc_next_id (char *cmd);