about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--INSTALL2
-rw-r--r--NEWS10
-rw-r--r--doc/index.html4
-rw-r--r--doc/servicedir.html9
-rw-r--r--doc/upgrade.html6
-rw-r--r--package/info2
-rw-r--r--src/supervision/s6-supervise.c23
7 files changed, 46 insertions, 10 deletions
diff --git a/INSTALL b/INSTALL
index c9928a8..b171d44 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.5.0.1 or later: http://skarnet.org/software/skalibs/
+  - skalibs version 2.5.1.0 or later: http://skarnet.org/software/skalibs/
   - execline version 2.3.0.1 or later: http://skarnet.org/software/execline/
 
  This software will run on any operating system that implements
diff --git a/NEWS b/NEWS
index cc6cc59..e12b1e3 100644
--- a/NEWS
+++ b/NEWS
@@ -1,12 +1,17 @@
 Changelog for s6.
 
-In 2.5.0.1
+In 2.5.1.0
 ----------
 
  - Bugfix release.
  - s6-ftrig-listen1 now prints to stdout the last event (the last
 byte) it received and made it match the regexp it was given.
-This is a bugfix. :)
+ - s6-supervise now recognizes the "timeout-kill" file in a service
+directory. If this file exists and contains a nonzero integer t,
+the behaviour of a "s6-svc -d" command is changed from
+"send a SIGTERM and a SIGCONT" to "send a SIGTERM and a SIGCONT,
+then if the service is still not dead after t milliseconds, send
+a SIGKILL".
 
 
 In 2.5.0.0
@@ -28,4 +33,3 @@ no such file, it's run in a new session (same behaviour as before).
 stream.
  - s6-log's individual file size limit bumped to 256 MB.
  - Various bugfixes. (thanks jjk!)
-
diff --git a/doc/index.html b/doc/index.html
index 2a30cf2..dd78b1d 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -83,7 +83,7 @@ with s6</a> </li>
  <li> A POSIX-compliant system with a standard C development environment </li>
  <li> GNU make, version 3.81 or later </li>
  <li> <a href="http://skarnet.org/software/skalibs/">skalibs</a> version
-2.5.0.1 or later. It's a build-time requirement. It's also a run-time
+2.5.1.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. </li>
  <li> <a href="http://skarnet.org/software/execline/">execline</a> version
@@ -100,7 +100,7 @@ library. </li>
 <h3> Download </h3>
 
 <ul>
- <li> The current released version of s6 is <a href="s6-2.5.0.1.tar.gz">2.5.0.1</a>. </li>
+ <li> The current released version of s6 is <a href="s6-2.5.1.0.tar.gz">2.5.1.0</a>. </li>
  <li> Alternatively, you can checkout a copy of the
 <a href="http://git.skarnet.org/cgi-bin/cgit.cgi/s6/">s6
 git repository</a>:
diff --git a/doc/servicedir.html b/doc/servicedir.html
index a0d98f0..839e4d5 100644
--- a/doc/servicedir.html
+++ b/doc/servicedir.html
@@ -128,6 +128,15 @@ notification from the service and broadcast readiness, i.e. any
 <a href="s6-svlisten1.html">s6-svlisten1 -U</a> or
 <a href="s6-svlisten.html">s6-svlisten -U</a> processes will be
 triggered. </li>
+ <li> An optional regular file named <tt>timeout-kill</tt>. If such a file
+exists, it must only contain an unsigned integer <em>t</em>. If <em>t</em>
+is nonzero, then on receipt of a <a href="s6-svc.html">s6-svc -d</a> command,
+which sends a SIGTERM and a SIGCONT to the service, a timeout of <em>t</em>
+milliseconds is set; and if the service is still not dead after <em>t</em>
+milliseconds, then it is sent a SIGKILL. If <tt>timeout-kill</tt> does not
+exist, or contains 0 or an invalid value, then the service is never
+forcibly killed (unless, of course, a <a href="s6-svc.html">s6-svc -k</a>
+command is sent). </li>
  <li> An optional regular file named <tt>timeout-finish</tt>. If such a file
 exists, it must only contain an unsigned integer, which is the number of
 milliseconds after which the <tt>./finish</tt> script, if it exists, will
diff --git a/doc/upgrade.html b/doc/upgrade.html
index cf10f2b..da4e5d8 100644
--- a/doc/upgrade.html
+++ b/doc/upgrade.html
@@ -18,13 +18,17 @@
 
 <h1> What has changed in s6 </h1>
 
-<h2> in 2.5.0.1 </h2>
+<h2> in 2.5.1.0 </h2>
 
 <ul>
  <li> skalibs dependency bumped to 2.5.0.1. </li>
  <li> execline dependency bumped to 2.3.0.1. </li>
  <li> <a href="s6-ftrig-listen1.html">s6-ftrig-listen1</a> prints the last event
 it received to stdout. </li>
+ <li> The <tt>timeout-kill</tt> file is now recognized in a
+<a href="servicedir.html">service directory</a> and allows
+<a href="s6-svc.html">s6-svc -d</a> to send a SIGKILL after a timeout if the
+process is still not dead after the initial SIGTERM and SIGCONT. </li>
 </ul>
 
 <h2> in 2.5.0.0 </h2>
diff --git a/package/info b/package/info
index 0991920..a1967af 100644
--- a/package/info
+++ b/package/info
@@ -1,4 +1,4 @@
 package=s6
-version=2.5.0.1
+version=2.5.1.0
 category=admin
 package_macro_name=S6
diff --git a/src/supervision/s6-supervise.c b/src/supervision/s6-supervise.c
index a1a52f8..7527668 100644
--- a/src/supervision/s6-supervise.c
+++ b/src/supervision/s6-supervise.c
@@ -51,6 +51,7 @@ static tain_t deadline ;
 static tain_t dontrespawnbefore = TAIN_EPOCH ;
 static s6_svstatus_t status = S6_SVSTATUS_ZERO ;
 static state_t state = DOWN ;
+static int flagdying = 0 ;
 static int cont = 1 ;
 static int notifyfd = -1 ;
 
@@ -331,6 +332,7 @@ static int uplastup_z (void)
   status.wstat = (int)status.pid ;
   status.flagpaused = 0 ;
   status.flagready = 0 ;
+  flagdying = 0 ;
   tain_copynow(&status.stamp) ;
   if (notifyfd >= 0)
   {
@@ -383,8 +385,16 @@ static void lastup_z (void)
 
 static void uptimeout (void)
 {
-  settimeout_infinite() ;
-  strerr_warnw1x("can't happen: timeout while the service is up!") ;
+  if (flagdying)
+  {
+    killk() ;
+    settimeout(5) ;
+  }
+  else
+  {
+    settimeout_infinite() ;
+    strerr_warnw1x("can't happen: timeout while the service is up!") ;
+  }
 }
 
 static void up_o (void)
@@ -395,9 +405,18 @@ static void up_o (void)
 
 static void up_d (void)
 {
+  tain_t tto ;
+  unsigned int timeout ;
   status.flagwantup = 0 ;
   killt() ;
   killc() ;
+  if (!read_uint("timeout-kill", &timeout)) timeout = 0 ;
+  if (timeout && tain_from_millisecs(&tto, timeout))
+  {
+    tain_add_g(&deadline, &tto) ;
+    flagdying = 1 ;
+  }
+  else settimeout_infinite() ;
 }
 
 static void up_u (void)