diff options
Diffstat (limited to 'src/pies.c')
-rw-r--r-- | src/pies.c | 54 |
1 files changed, 25 insertions, 29 deletions
@@ -1536,7 +1536,7 @@ pies_reload (void) { component_config_commit (); if (init_process) - sysvinit_runlevel_setup (PIES_COMP_DEFAULT, NULL); + sysvinit_runlevel_setup (PIES_COMP_DEFAULT); progman_create_sockets (); progman_start (); } @@ -1549,9 +1549,8 @@ static struct config_syntax *current_syntax = &config_syntax_tab[CONF_PIES]; #include "cmdline.h" -int action = ACTION_CONT; -int children_cleanup = 0; -int got_alarm = 0; +static int action = ACTION_CONT; +static int children_op = PIES_CHLD_NONE; void pies_schedule_action (int act) @@ -1559,6 +1558,12 @@ pies_schedule_action (int act) action = act; } +void +pies_schedule_children (int op) +{ + children_op |= op; +} + RETSIGTYPE sig_handler (int sig) { @@ -1567,7 +1572,7 @@ sig_handler (int sig) switch (sig) { case SIGCHLD: - children_cleanup = 1; + pies_schedule_children (PIES_CHLD_CLEANUP); break; case SIGINT: @@ -1588,7 +1593,7 @@ sig_handler (int sig) break; case SIGALRM: - got_alarm = 1; + pies_schedule_children (PIES_CHLD_WAKEUP); break; } } @@ -2150,9 +2155,7 @@ main (int argc, char **argv) diag_setup (DIAG_TO_SYSLOG); } - if (init_process) - ctl_open (); - else + if (!init_process) { if (ctl_open ()) exit (EX_UNAVAILABLE); @@ -2173,10 +2176,10 @@ main (int argc, char **argv) { if (init_process && inittrans ()) { - got_alarm = 1; + pies_schedule_children (PIES_CHLD_WAKEUP); action = ACTION_CONT; } - else if (!children_cleanup) + else if (children_op == PIES_CHLD_NONE) pies_pause (); switch (action) { @@ -2190,7 +2193,7 @@ main (int argc, char **argv) case ACTION_RELOAD: pies_reload (); - got_alarm = 1; + pies_schedule_children (PIES_CHLD_WAKEUP); action = ACTION_CONT; break; @@ -2204,38 +2207,31 @@ main (int argc, char **argv) case ACTION_CTRLALTDEL: debug (1, ("ctrl-alt-del")); - sysvinit_runlevel_setup (PIES_COMP_MASK (pies_comp_ctrlaltdel), - NULL); - got_alarm = 1; + sysvinit_runlevel_setup (PIES_COMP_MASK (pies_comp_ctrlaltdel)); + pies_schedule_children (PIES_CHLD_WAKEUP); action = ACTION_CONT; break; case ACTION_KBREQUEST: debug (1, ("kbrequest")); - sysvinit_runlevel_setup (PIES_COMP_MASK (pies_comp_kbrequest), - NULL); - got_alarm = 1; + sysvinit_runlevel_setup (PIES_COMP_MASK (pies_comp_kbrequest)); + pies_schedule_children (PIES_CHLD_WAKEUP); action = ACTION_CONT; break; case ACTION_POWER: debug (1, ("SIGPWR")); sysvinit_power (); - got_alarm = 1; + pies_schedule_children (PIES_CHLD_WAKEUP); action = ACTION_CONT; } if (action == ACTION_CONT) { - if (children_cleanup) - { - children_cleanup = 0; - progman_cleanup (0); - } - if (got_alarm) - { - progman_wake_sleeping (1); - got_alarm = 0; - } + if (children_op & PIES_CHLD_CLEANUP) + progman_cleanup (0); + if (children_op & PIES_CHLD_WAKEUP) + progman_wake_sleeping (1); + children_op = PIES_CHLD_NONE; } } while (init_process || action == ACTION_CONT); |