diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2016-02-13 23:55:47 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2016-02-14 00:05:33 +0200 |
commit | 0a5eb4f65a20d37f2051dce8816485dd219fb735 (patch) | |
tree | eadff6490ebf734431c354ac1ba40a4a8537fcb0 /src/progman.c | |
parent | c9581808b72ff25623c87cf49c471ce7f017985d (diff) | |
download | pies-0a5eb4f65a20d37f2051dce8816485dd219fb735.tar.gz pies-0a5eb4f65a20d37f2051dce8816485dd219fb735.tar.bz2 |
Fix handling of wait components
* src/pies.h (PIES_COMP_WAIT): Remove.
(PIES_COMP_MASK): Save one bit.
(PIES_CHLD_NONE, PIES_CHLD_CLEANUP)
(PIES_CHLD_WAKEUP): New constants.
(pies_schedule_children): New proto.
(sysvinit_runlevel_setup): Change signature.
* src/pies.c (children_cleanup, got_alarm): Merge into
single static variable children_op. All uses updated.
(pies_schedule_children): New function.
(sig_handler): Update
(main): Don't call ctl_open for init process. It is done
by inittrans after transition from boot to normal state.
Update to use pies_schedule_children.
* src/prog.h (IS_ACTIVE_COMPONENT): New macro.
* src/progman.c (prog_start): Don't modify prog->v.p.wait.
(progman_wake_sleeping): Start usual components only after
all "wait" components have terminated.
(progman_cleanup): If a "wait" component has terminated,
request PIES_CHLD_WAKEUP.
* src/sysvinit.c (enstate) <wait>: Remove.
(enablecomp): Update.
(runlevel_setup_prog): Set prog->v.p.wait.
(sysvinit_runlevel_setup): Take only one parameter.
(inittrans): Remove "wait" and the related mess.
Call ctl_open after transition boot -> normal.
Diffstat (limited to 'src/progman.c')
-rw-r--r-- | src/progman.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/progman.c b/src/progman.c index 29b5331..8a5187c 100644 --- a/src/progman.c +++ b/src/progman.c @@ -1050,7 +1050,6 @@ prog_start (struct prog *prog) } return; } - prog->v.p.wait = is_comp_wait (prog->v.p.comp); } /* This call returns 1 in two cases: Either prog is marked as disabled, @@ -1541,14 +1540,20 @@ progman_wake_sleeping (int onalrm) struct prog *prog; time_t now = time (NULL); - if (progman_waiting_p ()) - /* Noting to do if there are processes left in the previous runlevel */ - return; + debug (1, (_("checking for components to start"))); - debug (1, (_("managing sleeping/stopping components"))); + for (prog = proghead; prog; prog = prog->next) + { + if (IS_ACTIVE_COMPONENT (prog) && prog->v.p.wait) + { + if (prog->v.p.status != status_running) + prog_start (prog); + return; + } + } for (prog = proghead; prog; prog = prog->next) - if (IS_COMPONENT (prog)) + if (IS_ACTIVE_COMPONENT (prog)) { switch (prog->v.p.status) { @@ -2256,7 +2261,6 @@ react (struct prog *prog, int status, pid_t pid) prog_start (prog); } - void progman_cleanup (int expect_term) { @@ -2316,6 +2320,8 @@ progman_cleanup (int expect_term) sysvinit_acct (SYSV_ACCT_PROC_STOP, "", prog_tag (prog), pid, ""); prog->v.p.status = status_finished; + if (prog->v.p.wait) + pies_schedule_children (PIES_CHLD_WAKEUP); prog->v.p.wait = 0; } else |