summaryrefslogtreecommitdiffabout
path: root/src/comp.c
authorSergey Poznyakoff <gray@gnu.org>2016-02-19 06:41:12 (GMT)
committer Sergey Poznyakoff <gray@gnu.org>2016-02-19 06:41:12 (GMT)
commite6902abfddb4d7b16dc9a4231a3781f354a08cd5 (patch) (unidiff)
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') (more/less context) (ignore whitespace changes)
-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
@@ -360,8 +360,8 @@ prog_is_leftover (struct prog *prog)
360 360
361/* If PROG is a leftover, gracefully stop it and mark as disabled */ 361/* If PROG is a leftover, mark it for termination */
362static int 362static int
363cb_terminate_prog (struct prog *prog, void *data) 363mark_prog (struct prog *prog, void *data)
364{ 364{
365 if (prog_is_leftover (prog)) 365 if (prog_is_leftover (prog))
366 progman_stop_component (&prog); 366 prog->v.p.stop = 1;
367 return 0; 367 return 0;
@@ -369,18 +369,2 @@ cb_terminate_prog (struct prog *prog, void *data)
369 369
370/* If PROG is a leftover, slay it with SIGKILL */
371static int
372cb_kill_prog (struct prog *prog, void *data)
373{
374 if (prog_is_leftover (prog))
375 prog_stop (prog, SIGKILL);
376 return 0;
377}
378
379static int
380list_is_empty (void *p)
381{
382 struct complist *list = p;
383 return list->head == NULL;
384}
385
386static int 370static int
@@ -506,3 +490,3 @@ component_config_commit (void)
506 490
507 /* Terminate orphaned progs */ 491 /* Mark orphaned progs for termination */
508 list = &comp_list[prev]; 492 list = &comp_list[prev];
@@ -510,8 +494,4 @@ component_config_commit (void)
510 { 494 {
511 progman_foreach (cb_terminate_prog, NULL); 495 progman_foreach (mark_prog, NULL);
512 if (progman_wait_until (list_is_empty, list)) 496 pies_schedule_children (PIES_CHLD_GC);
513 {
514 progman_foreach (cb_kill_prog, NULL);
515 progman_wait_until (list_is_empty, list);
516 }
517 } 497 }

Return to:

Send suggestions and report system problems to the System administrator.