commit 173d58a10c40f1fd64034690eab82833d4a4770d
parent 4ad28c83818e3b7b351ac328e3753d8dab8b2804
Author: Laurent Bercot <ska-skaware@skarnet.org>
Date: Tue, 18 Feb 2020 12:25:29 +0000
Add SIGPWR and SIGWINCH support to s6-svscan
Diffstat:
4 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/NEWS b/NEWS
@@ -8,6 +8,8 @@ In 2.9.1.0
when execline support is disabled.
- New '?' directive to s6-log, to spawn a processor with /bin/sh.
- New console holder functionality for easier s6-svscan-log support.
+ - On systems that define SIGPWR and SIGWINCH, s6-svscan -s now calls
+a user handler for those signals.
In 2.9.0.1
diff --git a/doc/s6-svscan.html b/doc/s6-svscan.html
@@ -135,6 +135,8 @@ it receives one of the following signals.
<li> SIGINT : fork and execute <tt>.s6-svscan/SIGINT</tt> </li>
<li> SIGUSR1 : fork and execute <tt>.s6-svscan/SIGUSR1</tt> </li>
<li> SIGUSR2 : fork and execute <tt>.s6-svscan/SIGUSR2</tt> </li>
+ <li> SIGPWR (on systems that define it) : fork and execute <tt>.s6-svscan/SIGPWR</tt> </li>
+ <li> SIGWINCH (on systems that define it) : fork and execute <tt>.s6-svscan/SIGWINCH</tt> </li>
</ul>
<p>
diff --git a/doc/upgrade.html b/doc/upgrade.html
@@ -35,6 +35,8 @@ interpreter. </li>
<li> A new <tt>-X</tt> option has been added to <a href="s6-svscan.html>s6-svscan</a>
to better support <a href="//skarnet.org/software/s6-linux-init/">s6-linux-init</a>
installations. </li>
+ <li> <a href="s6-svscan.html>s6-svscan</a> now handles SIGPWR and SIGWINCH, when
+diverted, on systems that define those signals. </li>
</ul>
<h2> in 2.9.0.1 </h2>
diff --git a/src/supervision/s6-svscan.c b/src/supervision/s6-svscan.c
@@ -7,6 +7,7 @@
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
+
#include <skalibs/allreadwrite.h>
#include <skalibs/sgetopt.h>
#include <skalibs/types.h>
@@ -18,6 +19,7 @@
#include <skalibs/sig.h>
#include <skalibs/selfpipe.h>
#include <skalibs/environ.h>
+
#include <s6/config.h>
#include <s6/s6-supervise.h>
@@ -528,6 +530,12 @@ int main (int argc, char const *const *argv)
{
sigaddset(&set, SIGUSR1) ;
sigaddset(&set, SIGUSR2) ;
+#ifdef SIGPWR
+ sigaddset(&set, SIGPWR) ;
+#endif
+#ifdef SIGWINCH
+ sigaddset(&set, SIGWINCH) ;
+#endif
}
if (selfpipe_trapset(&set) < 0) strerr_diefu1sys(111, "trap signals") ;
}