aboutsummaryrefslogtreecommitdiff
path: root/src/comp.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2016-02-19 08:41:12 +0200
committerSergey Poznyakoff <gray@gnu.org>2016-02-19 08:41:12 +0200
commite6902abfddb4d7b16dc9a4231a3781f354a08cd5 (patch)
treec634621af2ae765460e010ce83c8492ed4e859bc /src/comp.c
parent51a797445a4bfc34ad1ae7ea91e12486d823abda (diff)
downloadpies-e6902abfddb4d7b16dc9a4231a3781f354a08cd5.tar.gz
pies-e6902abfddb4d7b16dc9a4231a3781f354a08cd5.tar.bz2
Revamp program termination after reconfiguring.
* src/pies.h (PIES_CHLD_GC): New op. (progman_stop_tag): Remove proto. * src/pies.c (main): Handle PIES_CHLD_GC: stop all programs marked for termination. * src/comp.c (component_config_commit): Mark leftover components for termination, instead of waiting for them to terminate. * src/sysvinit.c (runlevel_setup_prog): Skip prog if its active status didn't change. Mark inactivated progs for termination. (sysvinit_runlevel_setup): Schedule PIES_CHLD_GC. (inittrans): Don't wait for programs to terminate. That will be done in the main loop. * src/prog.h (prog)<stop>: New boolean member. * src/progman.c (progman_cleanup) (progman_stop_component): Clear the stop flag. (progman_gc): New function. (progman_stop_tag): Remove.
Diffstat (limited to 'src/comp.c')
-rw-r--r--src/comp.c32
1 files changed, 6 insertions, 26 deletions
diff --git a/src/comp.c b/src/comp.c
index 6a0e4ba..b340abe 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -359,29 +359,13 @@ prog_is_leftover (struct prog *prog)
}
-/* If PROG is a leftover, gracefully stop it and mark as disabled */
+/* If PROG is a leftover, mark it for termination */
static int
-cb_terminate_prog (struct prog *prog, void *data)
+mark_prog (struct prog *prog, void *data)
{
if (prog_is_leftover (prog))
- progman_stop_component (&prog);
+ prog->v.p.stop = 1;
return 0;
}
-/* If PROG is a leftover, slay it with SIGKILL */
-static int
-cb_kill_prog (struct prog *prog, void *data)
-{
- if (prog_is_leftover (prog))
- prog_stop (prog, SIGKILL);
- return 0;
-}
-
-static int
-list_is_empty (void *p)
-{
- struct complist *list = p;
- return list->head == NULL;
-}
-
static int
list_str_cmp (const void *a, const void *b)
@@ -505,14 +489,10 @@ component_config_commit (void)
}
- /* Terminate orphaned progs */
+ /* Mark orphaned progs for termination */
list = &comp_list[prev];
if (list->head)
{
- progman_foreach (cb_terminate_prog, NULL);
- if (progman_wait_until (list_is_empty, list))
- {
- progman_foreach (cb_kill_prog, NULL);
- progman_wait_until (list_is_empty, list);
- }
+ progman_foreach (mark_prog, NULL);
+ pies_schedule_children (PIES_CHLD_GC);
}

Return to:

Send suggestions and report system problems to the System administrator.