diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2015-06-25 19:17:43 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2015-06-25 19:17:43 +0000 |
commit | 49f1f9efe1874449303ca8c95a35a7b2bd4e13a0 (patch) | |
tree | 1d938071351c0447e96c250e4e999de0a687ba5b /src/supervision/s6-supervise.c | |
parent | 96d70608d25da81038ac3bfb5273852f33e27504 (diff) | |
download | s6-49f1f9efe1874449303ca8c95a35a7b2bd4e13a0.tar.xz |
- doc fixes (changed mentions of s6-notifywhenup)
- s6-svc -X
- rc for 2.1.6.0
Diffstat (limited to 'src/supervision/s6-supervise.c')
-rw-r--r-- | src/supervision/s6-supervise.c | 48 |
1 files changed, 35 insertions, 13 deletions
diff --git a/src/supervision/s6-supervise.c b/src/supervision/s6-supervise.c index e422da0..5ce718f 100644 --- a/src/supervision/s6-supervise.c +++ b/src/supervision/s6-supervise.c @@ -27,7 +27,7 @@ enum trans_e { V_TIMEOUT, V_CHLD, V_TERM, V_HUP, V_QUIT, V_a, V_b, V_q, V_h, V_k, V_t, V_i, V_1, V_2, V_f, V_F, V_p, V_c, - V_o, V_d, V_u, V_x, V_O + V_o, V_d, V_u, V_x, V_O, V_X } ; typedef enum state_e state_t, *state_t_ref ; @@ -85,6 +85,16 @@ static void bail (void) cont = 0 ; } +static void closethem (void) +{ + fd_close(0) ; + fd_close(1) ; + fd_close(2) ; + open_readb("/dev/null") ; + open_write("/dev/null") ; ndelay_off(1) ; + open_write("/dev/null") ; ndelay_off(2) ; +} + static void killa (void) { kill(status.pid, SIGALRM) ; @@ -376,6 +386,12 @@ static void up_x (void) state = LASTUP ; } +static void up_X (void) +{ + closethem() ; + up_x() ; +} + static void up_term (void) { up_x() ; @@ -409,28 +425,34 @@ static void finish_x (void) state = LASTFINISH ; } +static void finish_X (void) +{ + closethem() ; + finish_x() ; +} + static void lastup_z (void) { uplastup_z(1) ; } -static action_t_ref const actions[5][23] = +static action_t_ref const actions[5][24] = { { &downtimeout, &nop, &bail, &bail, &bail, &nop, &nop, &nop, &nop, &nop, &nop, &nop, &nop, &nop, &nop, &nop, &nop, &nop, - &down_o, &down_d, &down_u, &bail, &down_O }, - { &uptimeout, &up_z, &up_term, &up_x, &up_term, + &down_o, &down_d, &down_u, &bail, &down_O, &bail }, + { &uptimeout, &up_z, &up_term, &up_x, &up_X, &killa, &killb, &killq, &killh, &killk, &killt, &killi, &kill1, &kill2, &nop, &nop, &killp, &killc, - &up_o, &up_d, &up_u, &up_x, &up_o }, - { &finishtimeout, &finish_z, &finish_x, &finish_x, &finish_x, + &up_o, &up_d, &up_u, &up_x, &up_o, &up_X }, + { &finishtimeout, &finish_z, &finish_x, &finish_x, &finish_X, &nop, &nop, &nop, &nop, &nop, &nop, &nop, &nop, &nop, &nop, &nop, &nop, &nop, - &up_o, &down_d, &finish_u, &finish_x, &up_o }, - { &uptimeout, &lastup_z, &up_d, &nop, &up_d, + &up_o, &down_d, &finish_u, &finish_x, &up_o, &finish_X }, + { &uptimeout, &lastup_z, &up_d, &nop, &closethem, &killa, &killb, &killq, &killh, &killk, &killt, &killi, &kill1, &kill2, &nop, &nop, &killp, &killc, - &up_o, &up_d, &nop, &nop, &up_o }, - { &finishtimeout, &bail, &nop, &nop, &nop, + &up_o, &up_d, &nop, &nop, &up_o, &closethem }, + { &finishtimeout, &bail, &nop, &nop, &closethem, &nop, &nop, &nop, &nop, &nop, &nop, &nop, &nop, &nop, &nop, &nop, &nop, &nop, - &nop, &nop, &nop, &nop, &nop } + &nop, &nop, &nop, &nop, &nop, &closethem } } ; @@ -511,8 +533,8 @@ static inline void handle_control (int fd) else if (!r) break ; else { - register unsigned int pos = byte_chr("abqhkti12fFpcoduxO", 18, c) ; - if (pos < 18) (*actions[state][V_a + pos])() ; + register unsigned int pos = byte_chr("abqhkti12fFpcoduxOX", 19, c) ; + if (pos < 19) (*actions[state][V_a + pos])() ; } } } |