summaryrefslogtreecommitdiff
path: root/src/supervision/s6-svscan.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2015-06-17 10:38:04 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2015-06-17 10:38:04 +0000
commite2f01f98672c501b6ec4b445956b48041267138f (patch)
tree0b9fd74a8511bd5fd73aa0e88a69bcc0b5ae36dc /src/supervision/s6-svscan.c
parentdf194e5564f5b32aaf0e107b97095a1dd5bdbe35 (diff)
downloads6-e2f01f98672c501b6ec4b445956b48041267138f.tar.xz
- Add support for SIGUSR1 for poweroff in s6-svscan
- Optimize respawn delay in s6-supervise
Diffstat (limited to 'src/supervision/s6-svscan.c')
-rw-r--r--src/supervision/s6-svscan.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/supervision/s6-svscan.c b/src/supervision/s6-svscan.c
index e07ff35..7ab959c 100644
--- a/src/supervision/s6-svscan.c
+++ b/src/supervision/s6-svscan.c
@@ -109,6 +109,12 @@ static void intr (void)
term() ;
}
+static void usr1 (void)
+{
+ finish_arg = "poweroff" ;
+ term() ;
+}
+
static void handle_signals (void)
{
for (;;)
@@ -124,6 +130,7 @@ static void handle_signals (void)
case SIGQUIT : quit() ; break ;
case SIGABRT : cont = 0 ; break ;
case SIGINT : intr() ; break ;
+ case SIGUSR1 : usr1() ; break ;
}
}
}
@@ -152,7 +159,7 @@ static void handle_control (int fd)
case 'i' : intr() ; return ;
case 'q' : quit() ; return ;
case '0' : finish_arg = "halt" ; term() ; return ;
- case '7' : finish_arg = "poweroff" ; term() ; return ;
+ case '7' : usr1() ; return ;
case '8' : finish_arg = "other" ; term() ; return ;
default :
{
@@ -446,6 +453,7 @@ int main (int argc, char const *const *argv)
sigaddset(&set, SIGQUIT) ;
sigaddset(&set, SIGABRT) ;
sigaddset(&set, SIGINT) ;
+ sigaddset(&set, SIGUSR1) ;
if (selfpipe_trapset(&set) < 0) strerr_diefu1sys(111, "trap signals") ;
}