From 3457a5ce01d7df3bc4cdc6259736ca210b4d4765 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Thu, 25 May 2023 15:59:58 +0000 Subject: Add s6-svc -s; prepare for 2.11.4.0 Signed-off-by: Laurent Bercot --- INSTALL | 2 +- NEWS | 6 ++++++ doc/index.html | 4 ++-- doc/s6-svc.html | 9 ++++++++- doc/upgrade.html | 7 +++++++ package/info | 2 +- src/supervision/s6-svc.c | 32 ++++++++++++++++++++++++++++++-- 7 files changed, 55 insertions(+), 7 deletions(-) diff --git a/INSTALL b/INSTALL index d32f3cd..f73d32c 100644 --- a/INSTALL +++ b/INSTALL @@ -6,7 +6,7 @@ Build Instructions - A POSIX-compliant C development environment - GNU make version 3.81 or later - - skalibs version 2.13.1.1 or later: https://skarnet.org/software/skalibs/ + - skalibs version 2.13.2.0 or later: https://skarnet.org/software/skalibs/ - execline version 2.9.3.0 or later: https://skarnet.org/software/execline/ (You can disable this requirement at configure time, but will lose some functionality.) diff --git a/NEWS b/NEWS index 117b5a3..12b716d 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,11 @@ Changelog for s6. +In 2.11.4.0 +----------- + + - New option to s6-svc: -s, to specify a signal by name (or number). + + In 2.11.3.2 ----------- diff --git a/doc/index.html b/doc/index.html index 6fc5ea6..fe4cec7 100644 --- a/doc/index.html +++ b/doc/index.html @@ -83,7 +83,7 @@ with s6
  • A POSIX-compliant system with a standard C development environment
  • GNU make, version 3.81 or later
  • skalibs version -2.13.1.1 or later. It's a build-time requirement. It's also a run-time +2.13.2.0 or later. It's a build-time requirement. It's also a run-time requirement if you link against the shared version of the skalibs library.
  • (Optional, but really recommended for full functionality): @@ -115,7 +115,7 @@ want nsswitch-like functionality:

    Download

      -
    • The current released version of s6 is 2.11.3.2.
    • +
    • The current released version of s6 is 2.11.4.0.
    • Alternatively, you can checkout a copy of the s6 git repository: diff --git a/doc/s6-svc.html b/doc/s6-svc.html index 7c2e30a..208ee9c 100644 --- a/doc/s6-svc.html +++ b/doc/s6-svc.html @@ -28,7 +28,7 @@ knowing their PIDs, and without using horrible hacks such as .pid files.

      Interface

      -     s6-svc [ -wu | -wU | -wd | -wD | -wr | -wR ] [ -T timeout ] [ -abqhkti12pcyroduDUxO ] servicedir
      +     s6-svc [ -wu | -wU | -wd | -wD | -wr | -wR ] [ -T timeout ] [ -s signal | -abqhkti12pcy ] [ -roduDUxO ] servicedir
       

      @@ -53,6 +53,13 @@ a command, or 100 if no s6-supervise process is running on servicedir.

    • -p : send a SIGSTOP to the supervised process
    • -c : send a SIGCONT to the supervised process
    • -y : send a SIGWINCH to the supervised process
    • +
    • -s signal : send signal to the +supervised process. signal can be given as its name (case- +insensitive) or its number, but only the signals listed above are +accepted - you cannot, for instance, manually send a SIGSEGV to the +supervised process.
    • +

    +
    • -o : once. Equivalent to "-uO".
    • -d : down. If the supervised process is up, send it a SIGTERM (by default) then a SIGCONT (to make sure even stopped processes diff --git a/doc/upgrade.html b/doc/upgrade.html index 0ab62a9..4307f3e 100644 --- a/doc/upgrade.html +++ b/doc/upgrade.html @@ -18,6 +18,13 @@

      What has changed in s6

      +

      in 2.11.4.0

      + +
        +
      • skalibs +dependency bumped to 2.13.2.0.
      • +
      +

      in 2.11.3.2

        diff --git a/package/info b/package/info index 9796afa..d9cc30e 100644 --- a/package/info +++ b/package/info @@ -1,4 +1,4 @@ package=s6 -version=2.11.3.2 +version=2.11.4.0 category=admin package_macro_name=S6 diff --git a/src/supervision/s6-svc.c b/src/supervision/s6-svc.c index 1586056..acf8e06 100644 --- a/src/supervision/s6-svc.c +++ b/src/supervision/s6-svc.c @@ -1,25 +1,46 @@ /* ISC license. */ +#include + #include #include #include +#include #include #include #include +#include +#include #include #include #include #include -#define USAGE "s6-svc [ -wu | -wU | -wd | -wD | -wr | -wR ] [ -T timeout ] [ -abqhkti12pcyroduDUxOQ ] servicedir" +#define USAGE "s6-svc [ -wu | -wU | -wd | -wD | -wr | -wR ] [ -T timeout ] [ -s signal | -abqhkti12pcy ] [ -roduDUxOQ ] servicedir" #define dieusage() strerr_dieusage(100, USAGE) #define DATASIZE 63 int main (int argc, char const *const *argv) { + static char const cmdsig[NSIG] = + { + 0, + [SIGALRM] = 'a', + [SIGABRT] = 'b', + [SIGQUIT] = 'q', + [SIGHUP] = 'h', + [SIGKILL] = 'k', + [SIGTERM] = 't', + [SIGINT] = 'i', + [SIGUSR1] = '1', + [SIGUSR2] = '2', + [SIGSTOP] = 'p', + [SIGCONT] = 'c', + [SIGWINCH] = 'y' + } ; size_t len ; unsigned int datalen = 1 ; unsigned int timeout = 0 ; @@ -30,10 +51,17 @@ int main (int argc, char const *const *argv) subgetopt l = SUBGETOPT_ZERO ; for (;;) { - int opt = subgetopt_r(argc, argv, "abqhkti12pcyroduDUxOQT:w:", &l) ; + int opt = subgetopt_r(argc, argv, "s:abqhkti12pcyroduDUxOQT:w:", &l) ; if (opt == -1) break ; switch (opt) { + case 's' : + { + int sig ; + if (!sig0_scan(l.arg, &sig)) strerr_dief2x(100, "invalid signal: ", l.arg) ; + if (!cmdsig[sig]) strerr_dief2x(100, l.arg, " is not in the list of user-available signals") ; + opt = cmdsig[sig] ; + } case 'a' : case 'b' : case 'q' : -- cgit 1.4.1