aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/comp.c23
-rw-r--r--src/ctl.c2
-rw-r--r--src/piesctl.c2
-rw-r--r--src/prog.h2
-rw-r--r--src/progman.c19
5 files changed, 15 insertions, 33 deletions
diff --git a/src/comp.c b/src/comp.c
index 2346306..25f2657 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -24,11 +24,6 @@ struct complist
struct component *tail;
};
-/* 0 on the first load, and 1 on all subsequent reloads. Tells the
- component_config_commit whether we're starting from scratch or just
- updating an already loaded configuration */
-static int loaded;
-
static struct complist comp_list[2];
static int cur;
@@ -540,16 +535,7 @@ component_config_commit (void)
comp_count = i;
/* Rearrange components, registering entries for the new ones */
- for (comp = list->head, i = 0; comp; )
- {
- struct component *next = comp->next;
- if (loaded && comp->mode == pies_comp_startup)
- {
- /* Ignore startup components */
- component_unlink (comp);
- component_free (comp);
- }
- else
+ for (comp = list->head, i = 0; comp; comp = comp->next, i++)
{
match = complist_find_match (prev, comp);
if (match)
@@ -563,12 +549,7 @@ component_config_commit (void)
}
comp_array[i] = comp;
comp->arridx = i;
- i++;
}
- comp = next;
- }
- /* Adjust comp_count */
- comp_count = i;
/* Mark orphaned progs for termination */
list = &comp_list[prev];
@@ -585,8 +566,6 @@ component_config_commit (void)
for (comp = comp_list[cur].head; comp; comp = comp->next)
if (!comp->prog)
register_prog (comp);
-
- loaded = 1;
}
static int
diff --git a/src/ctl.c b/src/ctl.c
index a78cdbf..d9a8998 100644
--- a/src/ctl.c
+++ b/src/ctl.c
@@ -1454,6 +1454,8 @@ static char * const pies_comp_mode_str[] = {
[pies_comp_accept] = "accept",
[pies_comp_inetd] = "inetd",
[pies_comp_pass_fd] = "pass_fd",
+ [pies_comp_startup] = "startup",
+ [pies_comp_shutdown] = "shutdown",
[pies_comp_wait] = "wait",
[pies_comp_once] = "once",
[pies_comp_boot] = "boot",
diff --git a/src/piesctl.c b/src/piesctl.c
index f2e774b..0cd2736 100644
--- a/src/piesctl.c
+++ b/src/piesctl.c
@@ -1053,6 +1053,8 @@ struct kwtrans mode_trans[] = {
{ "accept", 'A' },
{ "inetd", 'I' },
{ "pass_fd", 'P' },
+ { "startup", 'S' },
+ { "shutdown", 'E' },
{ "wait", 'W' },
{ "once", 'c' },
{ "boot", 'B' },
diff --git a/src/prog.h b/src/prog.h
index 9a3960f..04cf3d0 100644
--- a/src/prog.h
+++ b/src/prog.h
@@ -29,7 +29,7 @@ enum prog_status
status_sleeping, /* Component is sleeping. An attempt to start it will
be made at prog->v.p.timestamp + SLEEPTIME */
status_stopping, /* Component is being stopped */
- status_finished, /* A "once" component has finished */
+ status_finished, /* A "once" or "startup" component has finished */
};
struct conn_class
diff --git a/src/progman.c b/src/progman.c
index 5bc4eb3..a625885 100644
--- a/src/progman.c
+++ b/src/progman.c
@@ -324,7 +324,8 @@ progman_startup_phase (void)
for (prog = proghead; prog; prog = prog->next)
{
- if (IS_COMPONENT (prog) && prog->v.p.comp->mode == pies_comp_startup)
+ if (IS_COMPONENT (prog) && prog->v.p.comp->mode == pies_comp_startup
+ && prog->v.p.status == status_running)
return 1;
}
return 0;
@@ -338,7 +339,7 @@ progman_waiting_p (void)
for (prog = proghead; prog; prog = prog->next)
{
if (IS_COMPONENT (prog)
- && prog->pid > 0
+ && prog->v.p.status == status_running
&& (prog->wait || prog->v.p.comp->mode == pies_comp_startup))
{
debug (3, ("%s: waiting for %s (%lu)",
@@ -2356,14 +2357,6 @@ progman_cleanup (int expect_term)
}
destroy_prog (&prog);
}
- else if (prog->v.p.comp->mode == pies_comp_startup)
- {
- debug (1, (_("removing startup component %s, pid=%lu"),
- prog_tag (prog), (unsigned long)pid));
- destroy_prog (&prog);
- if (!progman_startup_phase ())
- pies_schedule_children (PIES_CHLD_WAKEUP);
- }
else
{
if (prog->v.p.comp->mode >= pies_mark_sysvinit
@@ -2379,6 +2372,12 @@ progman_cleanup (int expect_term)
prog->wait = 0;
}
}
+ else if (prog->v.p.comp->mode == pies_comp_startup)
+ {
+ prog->v.p.status = status_finished;
+ if (!progman_startup_phase ())
+ pies_schedule_children (PIES_CHLD_WAKEUP);
+ }
else
{
if (is_sysvinit (prog->v.p.comp))

Return to:

Send suggestions and report system problems to the System administrator.