aboutsummaryrefslogtreecommitdiff
path: root/src/progman.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/progman.c')
-rw-r--r--src/progman.c55
1 files changed, 43 insertions, 12 deletions
diff --git a/src/progman.c b/src/progman.c
index f0d0de6..15b8c44 100644
--- a/src/progman.c
+++ b/src/progman.c
@@ -106,6 +106,29 @@ progman_iterate_comp (int (*fun) (struct component *, void *), void *data)
break;
}
+void
+progman_sysvinit_enable (int (*fun) (struct component *, int, void *),
+ void *data)
+{
+ struct prog *prog;
+
+ for (prog = proghead; prog; prog = prog->next)
+ if (IS_COMPONENT (prog) && is_sysvinit (prog->v.p.comp))
+ {
+ int rc = fun (prog->v.p.comp, prog->v.p.status == status_finished,
+ data);
+ if (rc < 0)
+ continue;
+ if (rc)
+ prog->v.p.status = status_enabled;
+ else
+ prog->v.p.status = status_disabled;
+ debug (1, ("%s: %s", prog->tag,
+ prog->v.p.status == status_enabled ?
+ "enabled" : "disabled"));
+ }
+}
+
static struct prog *
prog_lookup_by_pid (pid_t pid)
{
@@ -412,7 +435,10 @@ progman_running_p ()
{
if (IS_COMPONENT (prog) && is_comp_wait (prog->v.p.comp) &&
prog->pid > 0)
- return 1;
+ {
+ debug (1, ("COMP %s still running", prog->tag));
+ return 1;
+ }
}
return 0;
}
@@ -1185,14 +1211,21 @@ prog_start (struct prog *prog)
if (prog->pid > 0 || !IS_COMPONENT (prog))
return;
- if (is_sysvinit (prog->v.p.comp->mode) && !init_process &&
- prog->v.p.status != status_disabled)
+ if (is_sysvinit (prog->v.p.comp))
{
- logmsg (LOG_NOTICE, "disabling sysvinit component %s", prog->tag);
- prog->v.p.status = status_disabled;
- return;
+ if (!init_process)
+ {
+ if (prog->v.p.status != status_disabled)
+ {
+ logmsg (LOG_NOTICE, "disabling sysvinit component %s",
+ prog->tag);
+ prog->v.p.status = status_disabled;
+ }
+ return;
+ }
+ debug (1, ("ok to start %s", prog->v.p.comp->tag));
}
-
+
/* This call returns 1 in two cases: Either prog is marked as disabled,
in which case there's nothing more to do, or one or more of its
prerequisites are in status_stopping. In the latter case either the
@@ -1782,8 +1815,7 @@ progman_start ()
{
if (prog->v.p.comp->mode == pies_comp_inetd)
{
- if ((prog->v.p.comp->flags & CF_DISABLED)
- || !runlevel_match (prog->v.p.comp))
+ if (prog->v.p.comp->flags & CF_DISABLED)
disable_socket (prog->v.p.socket);
else
{
@@ -1791,8 +1823,7 @@ progman_start ()
enable_socket (prog->v.p.socket);
}
}
- else if ((prog->v.p.status == status_enabled && prog->pid == 0
- && runlevel_match (prog->v.p.comp))
+ else if ((prog->v.p.status == status_enabled && prog->pid == 0)
|| prog->v.p.status == status_sleeping)
prog_start (prog);
}
@@ -2459,7 +2490,7 @@ progman_cleanup (int expect_term)
if (listener->v.p.comp->flags & CF_WAIT)
enable_socket (listener->v.p.socket);
}
- else if (is_sysvinit(prog->v.p.comp->mode))
+ else if (prog->v.p.comp->mode >= pies_mark_sysvinit)
{
prog->v.p.status = status_finished;
}

Return to:

Send suggestions and report system problems to the System administrator.