summaryrefslogtreecommitdiff
path: root/src/supervision
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2023-02-06 17:05:58 +0000
committerLaurent Bercot <ska@appnovation.com>2023-02-06 17:05:58 +0000
commit569d62e332c5d49c07fe4db4723a54591f6f7c58 (patch)
treea5b2b9315e9d80ac616537df6754c4a2d803b8e6 /src/supervision
parent92124defa008812c37a92c700eee67f04e259111 (diff)
downloads6-569d62e332c5d49c07fe4db4723a54591f6f7c58.tar.xz
Add s6-svc -Q
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/supervision')
-rw-r--r--src/supervision/s6-supervise.c46
-rw-r--r--src/supervision/s6-svc.c5
2 files changed, 26 insertions, 25 deletions
diff --git a/src/supervision/s6-supervise.c b/src/supervision/s6-supervise.c
index fa96a02..5611b98 100644
--- a/src/supervision/s6-supervise.c
+++ b/src/supervision/s6-supervise.c
@@ -40,7 +40,7 @@ enum trans_e
{
V_TIMEOUT, V_CHLD, V_TERM, V_HUP, V_QUIT, V_INT,
V_a, V_b, V_q, V_h, V_k, V_t, V_i, V_1, V_2, V_p, V_c, V_y, V_r,
- V_o, V_d, V_u, V_D, V_U, V_x, V_O
+ V_o, V_d, V_u, V_D, V_U, V_x, V_O, V_Q
} ;
typedef enum state_e state_t, *state_t_ref ;
@@ -416,6 +416,18 @@ static void wantup (void)
announce() ;
}
+static void wantDOWN (void)
+{
+ adddown() ;
+ wantdown() ;
+}
+
+static void wantUP (void)
+{
+ deldown() ;
+ wantup() ;
+}
+
static void downtimeout (void)
{
if (status.flagwantup) trystart() ;
@@ -434,16 +446,10 @@ static void down_u (void)
trystart() ;
}
-static void down_D (void)
-{
- adddown() ;
- wantdown() ;
-}
-
static void down_U (void)
{
- deldown() ;
- down_u() ;
+ wantUP() ;
+ trystart() ;
}
static int uplastup_z (void)
@@ -559,12 +565,6 @@ static void up_D (void)
up_d() ;
}
-static void up_U (void)
-{
- deldown() ;
- wantup() ;
-}
-
static void up_x (void)
{
state = LASTUP ;
@@ -607,23 +607,23 @@ static void lastfinish_z (void)
bail() ;
}
-static action_t_ref const actions[5][26] =
+static action_t_ref const actions[5][27] =
{
{ &downtimeout, &nop, &bail, &bail, &bail, &bail,
&nop, &nop, &nop, &nop, &nop, &nop, &nop, &nop, &nop, &nop, &nop, &nop, &nop,
- &down_o, &wantdown, &down_u, &down_D, &down_U, &bail, &wantdown },
+ &down_o, &wantdown, &down_u, &wantDOWN, &down_U, &bail, &wantdown, &wantDOWN },
{ &uptimeout, &up_z, &up_term, &up_x, &bail, &sigint,
&killa, &killb, &killq, &killh, &killk, &killt, &killi, &kill1, &kill2, &killp, &killc, &killy, &killr,
- &wantdown, &up_d, &wantup, &up_D, &up_U, &up_x, &wantdown },
+ &wantdown, &up_d, &wantup, &up_D, &wantUP, &up_x, &wantdown, &wantDOWN },
{ &finishtimeout, &finish_z, &finish_x, &finish_x, &bail, &sigint,
&nop, &nop, &nop, &nop, &nop, &nop, &nop, &nop, &nop, &nop, &nop, &nop, &nop,
- &wantdown, &wantdown, &wantup, &down_D, &up_U, &finish_x, &wantdown },
+ &wantdown, &wantdown, &wantup, &wantDOWN, &wantUP, &finish_x, &wantdown, &wantDOWN },
{ &uptimeout, &lastup_z, &up_d, &closethem, &bail, &sigint,
&killa, &killb, &killq, &killh, &killk, &killt, &killi, &kill1, &kill2, &killp, &killc, &killy, &killr,
- &wantdown, &up_d, &wantup, &up_D, &up_U, &closethem, &wantdown },
+ &wantdown, &up_d, &wantup, &up_D, &wantUP, &closethem, &wantdown, &wantDOWN },
{ &finishtimeout, &lastfinish_z, &nop, &closethem, &bail, &sigint,
&nop, &nop, &nop, &nop, &nop, &nop, &nop, &nop, &nop, &nop, &nop, &nop, &nop,
- &wantdown, &wantdown, &wantup, &down_D, &up_U, &closethem, &wantdown }
+ &wantdown, &wantdown, &wantup, &wantDOWN, &wantUP, &closethem, &wantdown, &wantDOWN }
} ;
@@ -706,8 +706,8 @@ static inline void handle_control (int fd)
else if (!r) break ;
else
{
- size_t pos = byte_chr("abqhkti12pcyroduDUxO", 20, c) ;
- if (pos < 20) (*actions[state][V_a + pos])() ;
+ size_t pos = byte_chr("abqhkti12pcyroduDUxOQ", 21, c) ;
+ if (pos < 21) (*actions[state][V_a + pos])() ;
}
}
}
diff --git a/src/supervision/s6-svc.c b/src/supervision/s6-svc.c
index 4485248..1586056 100644
--- a/src/supervision/s6-svc.c
+++ b/src/supervision/s6-svc.c
@@ -13,7 +13,7 @@
#include <s6/config.h>
#include <s6/supervise.h>
-#define USAGE "s6-svc [ -wu | -wU | -wd | -wD | -wr | -wR ] [ -T timeout ] [ -abqhkti12pcyroduDUxO ] servicedir"
+#define USAGE "s6-svc [ -wu | -wU | -wd | -wD | -wr | -wR ] [ -T timeout ] [ -abqhkti12pcyroduDUxOQ ] servicedir"
#define dieusage() strerr_dieusage(100, USAGE)
#define DATASIZE 63
@@ -30,7 +30,7 @@ int main (int argc, char const *const *argv)
subgetopt l = SUBGETOPT_ZERO ;
for (;;)
{
- int opt = subgetopt_r(argc, argv, "abqhkti12pcyroduDUxOT:w:", &l) ;
+ int opt = subgetopt_r(argc, argv, "abqhkti12pcyroduDUxOQT:w:", &l) ;
if (opt == -1) break ;
switch (opt)
{
@@ -54,6 +54,7 @@ int main (int argc, char const *const *argv)
case 'U' :
case 'x' :
case 'O' :
+ case 'Q' :
{
if (datalen >= DATASIZE) strerr_dief1x(100, "too many commands") ;
data[datalen++] = opt ;