diff options
-rw-r--r-- | src/comp.c | 23 | ||||
-rw-r--r-- | src/ctl.c | 2 | ||||
-rw-r--r-- | src/piesctl.c | 2 | ||||
-rw-r--r-- | src/prog.h | 2 | ||||
-rw-r--r-- | src/progman.c | 19 |
5 files changed, 15 insertions, 33 deletions
@@ -26,7 +26,2 @@ struct complist -/* 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]; @@ -542,12 +537,3 @@ component_config_commit (void) /* 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++) { @@ -565,8 +551,3 @@ component_config_commit (void) comp->arridx = i; - i++; } - comp = next; - } - /* Adjust comp_count */ - comp_count = i; @@ -587,4 +568,2 @@ component_config_commit (void) register_prog (comp); - - loaded = 1; } @@ -1456,2 +1456,4 @@ static char * const pies_comp_mode_str[] = { [pies_comp_pass_fd] = "pass_fd", + [pies_comp_startup] = "startup", + [pies_comp_shutdown] = "shutdown", [pies_comp_wait] = "wait", diff --git a/src/piesctl.c b/src/piesctl.c index f2e774b..0cd2736 100644 --- a/src/piesctl.c +++ b/src/piesctl.c @@ -1055,2 +1055,4 @@ struct kwtrans mode_trans[] = { { "pass_fd", 'P' }, + { "startup", 'S' }, + { "shutdown", 'E' }, { "wait", 'W' }, @@ -31,3 +31,3 @@ enum prog_status status_stopping, /* Component is being stopped */ - status_finished, /* A "once" component has finished */ + status_finished, /* A "once" or "startup" component has finished */ }; diff --git a/src/progman.c b/src/progman.c index 5bc4eb3..a625885 100644 --- a/src/progman.c +++ b/src/progman.c @@ -326,3 +326,4 @@ progman_startup_phase (void) { - 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; @@ -340,3 +341,3 @@ progman_waiting_p (void) if (IS_COMPONENT (prog) - && prog->pid > 0 + && prog->v.p.status == status_running && (prog->wait || prog->v.p.comp->mode == pies_comp_startup)) @@ -2358,10 +2359,2 @@ progman_cleanup (int expect_term) } - 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 @@ -2381,2 +2374,8 @@ progman_cleanup (int expect_term) } + 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 |