summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2018-03-20 18:21:19 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2018-03-20 18:21:19 +0000
commit01c12e7ac7bd0c95099dbe299f049c59081e35bc (patch)
tree6f6a784dd3c1730fda2072f7af97e23e37f44335
parent3b8083f63e774b30963948778e01553d85cfea29 (diff)
downloads6-01c12e7ac7bd0c95099dbe299f049c59081e35bc.tar.xz
Add s6-svdt, change default max tally to 100, add doc, prepare for 2.7.1.0
-rw-r--r--NEWS3
-rw-r--r--doc/index.html3
-rw-r--r--doc/s6-svdt.html70
-rw-r--r--doc/servicedir.html2
-rw-r--r--doc/upgrade.html3
-rw-r--r--package/deps.mak3
-rw-r--r--package/info2
-rw-r--r--package/modes1
-rw-r--r--package/targets.mak1
-rw-r--r--src/supervision/deps-exe/s6-svdt2
-rw-r--r--src/supervision/s6-supervise.c2
-rw-r--r--src/supervision/s6-svdt.c74
12 files changed, 160 insertions, 6 deletions
diff --git a/NEWS b/NEWS
index 1570e9b..0e1aa75 100644
--- a/NEWS
+++ b/NEWS
@@ -1,10 +1,11 @@
Changelog for s6.
-In 2.7.0.1
+In 2.7.1.0
----------
- Bugfixes.
- s6-svwait et al. now exit 102 instead of hanging if s6-supervise dies.
+ - New command: s6-svdt
In 2.7.0.0
diff --git a/doc/index.html b/doc/index.html
index cbc24ed..733e3ee 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -100,7 +100,7 @@ library. </li>
<h3> Download </h3>
<ul>
- <li> The current released version of s6 is <a href="s6-2.7.0.1.tar.gz">2.7.0.1</a>. </li>
+ <li> The current released version of s6 is <a href="s6-2.7.1.0.tar.gz">2.7.1.0</a>. </li>
<li> Alternatively, you can checkout a copy of the
<a href="//git.skarnet.org/cgi-bin/cgit.cgi/s6/">s6
git repository</a>:
@@ -156,6 +156,7 @@ a user interface to control those processes and monitor service states.
<li><a href="s6-svlisten1.html">The <tt>s6-svlisten1</tt> program</a></li>
<li><a href="s6-svlisten.html">The <tt>s6-svlisten</tt> program</a></li>
<li><a href="s6-notifyoncheck.html">The <tt>s6-notifyoncheck</tt> program</a></li>
+<li><a href="s6-svdt.html">The <tt>s6-svdt</tt> program</a></li>
</ul>
<h4> Daemontools-like utilities </h4>
diff --git a/doc/s6-svdt.html b/doc/s6-svdt.html
new file mode 100644
index 0000000..bb78061
--- /dev/null
+++ b/doc/s6-svdt.html
@@ -0,0 +1,70 @@
+<html>
+ <head>
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <meta http-equiv="Content-Language" content="en" />
+ <title>s6: the s6-svdt program</title>
+ <meta name="Description" content="s6: the s6-svdt program" />
+ <meta name="Keywords" content="s6 command s6-svdt servicedir death tally process supervision s6-supervise" />
+ <!-- <link rel="stylesheet" type="text/css" href="//skarnet.org/default.css" /> -->
+ </head>
+<body>
+
+<p>
+<a href="index.html">s6</a><br />
+<a href="//skarnet.org/software/">Software</a><br />
+<a href="//skarnet.org/">skarnet.org</a>
+</p>
+
+<h1> The s6-svdt program </h1>
+
+<p>
+s6-svstat prints the recorded death tally of a service, i.e. a list of the times
+the process died, with the cause of death.
+</p>
+
+<h2> Interface </h2>
+
+<pre>
+ s6-svdt [ -S | -s ] [ -n <em>maxlines</em> ] <em>servicedir</em>
+</pre>
+
+<p>
+ s6-svdt prints the contents of the recorded death tally of the service being
+currently supervised at the <em>servicedir</em>
+<a href="servicedir.html">service directory</a>, then exits 0.
+</p>
+
+<p>
+ For each recorded death, s6-svdt prints one line. This line contains the
+following fields, separated with spaces:
+</p>
+
+<ul>
+ <li> A <a href="https://cr.yp.to/daemontools/tai64n.html">TAI64N</a>
+timestamp .</li>
+ <li> The word "signal" if the death was caused by a signal, or the word
+"exitcode" if the death was a normal exit. </li>
+ <li> The name of the signal that caused the death, or the exit code
+of the process. </li>
+
+<h2> Options </h2>
+
+<ul>
+ <li> <tt>-S</tt>&nbsp;: print signal names. This is the default. </li>
+ <li> <tt>-s</tt>&nbsp;: print signal numbers. The numerical value of the signal
+will be printed instead of the signal name. </li>
+ <li> <tt>-n&nbsp;<em>maxlines</em></tt>&nbsp;: limit the output to at most
+the latest <em>maxlines</em> deaths. </li>
+</ul>
+
+<h2> Exit codes </h2>
+
+<ul>
+ <li> 0: success </li>
+ <li> 100: wrong usage </li>
+ <li> 111: system call failed </li>
+</ul>
+
+</body>
+</html>
diff --git a/doc/servicedir.html b/doc/servicedir.html
index cad2cb4..29236e7 100644
--- a/doc/servicedir.html
+++ b/doc/servicedir.html
@@ -148,7 +148,7 @@ exists, it must only contain an unsigned integer, which is the maximum number of
service death events that s6-supervise will keep track of. If the service dies
more than this number of times, the oldest events will be forgotten. Tracking
death events is useful, for instance, when throttling service restarts. The
-value cannot be greater than 4096. If the file does not exist, a default of 20
+value cannot be greater than 4096. If the file does not exist, a default of 100
is used. </li>
<li> A <a href="fifodir.html">fifodir</a> named <tt>event</tt>. It is automatically
created by <a href="s6-supervise.html">s6-supervise</a> if it does not exist.
diff --git a/doc/upgrade.html b/doc/upgrade.html
index c37ad15..10f139b 100644
--- a/doc/upgrade.html
+++ b/doc/upgrade.html
@@ -18,10 +18,11 @@
<h1> What has changed in s6 </h1>
-<h2> in 2.7.0.1 </h2>
+<h2> in 2.7.1.0 </h2>
<ul>
<li> skalibs dependency bumped to 2.6.4.0. </li>
+ <li> New command: <a href="s6-svdt.html">s6-svdt</a>. </li>
</ul>
<h2> in 2.7.0.0 </h2>
diff --git a/package/deps.mak b/package/deps.mak
index ef1cb47..f74fc71 100644
--- a/package/deps.mak
+++ b/package/deps.mak
@@ -127,6 +127,7 @@ src/pipe-tools/s6-mkfifodir.o src/pipe-tools/s6-mkfifodir.lo: src/pipe-tools/s6-
src/supervision/s6-notifyoncheck.o src/supervision/s6-notifyoncheck.lo: src/supervision/s6-notifyoncheck.c src/include/s6/ftrigr.h src/include/s6/s6-supervise.h
src/supervision/s6-supervise.o src/supervision/s6-supervise.lo: src/supervision/s6-supervise.c src/include/s6/ftrigw.h src/include/s6/s6-supervise.h
src/supervision/s6-svc.o src/supervision/s6-svc.lo: src/supervision/s6-svc.c src/include/s6/config.h src/include/s6/s6-supervise.h
+src/supervision/s6-svdt.o src/supervision/s6-svdt.lo: src/supervision/s6-svdt.c src/include/s6/s6-supervise.h
src/supervision/s6-svlisten.o src/supervision/s6-svlisten.lo: src/supervision/s6-svlisten.c src/supervision/s6-svlisten.h
src/supervision/s6-svlisten1.o src/supervision/s6-svlisten1.lo: src/supervision/s6-svlisten1.c src/supervision/s6-svlisten.h
src/supervision/s6-svok.o src/supervision/s6-svok.lo: src/supervision/s6-svok.c src/include/s6/s6-supervise.h
@@ -248,6 +249,8 @@ s6-supervise: EXTRA_LIBS := ${TAINNOW_LIB}
s6-supervise: src/supervision/s6-supervise.o ${LIBS6} -lskarnet
s6-svc: EXTRA_LIBS :=
s6-svc: src/supervision/s6-svc.o ${LIBS6} -lskarnet
+s6-svdt: EXTRA_LIBS :=
+s6-svdt: src/supervision/s6-svdt.o ${LIBS6} -lskarnet
s6-svlisten: EXTRA_LIBS := ${SOCKET_LIB} ${TAINNOW_LIB} ${SPAWN_LIB}
s6-svlisten: src/supervision/s6-svlisten.o src/supervision/s6_svlisten_signal_handler.o src/supervision/s6_svlisten_loop.o ${LIBS6} -lexecline -lskarnet
s6-svlisten1: EXTRA_LIBS := ${SOCKET_LIB} ${TAINNOW_LIB} ${SPAWN_LIB}
diff --git a/package/info b/package/info
index debd421..76c50e3 100644
--- a/package/info
+++ b/package/info
@@ -1,4 +1,4 @@
package=s6
-version=2.7.0.1
+version=2.7.1.0
category=admin
package_macro_name=S6
diff --git a/package/modes b/package/modes
index 830708c..9c3939c 100644
--- a/package/modes
+++ b/package/modes
@@ -14,6 +14,7 @@ s6-svc 0755
s6-svscanctl 0755
s6-svok 0755
s6-svstat 0755
+s6-svdt 0755
s6-svwait 0755
s6-svlisten1 0755
s6-svlisten 0755
diff --git a/package/targets.mak b/package/targets.mak
index 74f34ca..50445bd 100644
--- a/package/targets.mak
+++ b/package/targets.mak
@@ -14,6 +14,7 @@ s6-svc \
s6-svscanctl \
s6-svok \
s6-svstat \
+s6-svdt \
s6-svwait \
s6-svlisten1 \
s6-svlisten \
diff --git a/src/supervision/deps-exe/s6-svdt b/src/supervision/deps-exe/s6-svdt
new file mode 100644
index 0000000..08815d9
--- /dev/null
+++ b/src/supervision/deps-exe/s6-svdt
@@ -0,0 +1,2 @@
+${LIBS6}
+-lskarnet
diff --git a/src/supervision/s6-supervise.c b/src/supervision/s6-supervise.c
index 00c2358..4696004 100644
--- a/src/supervision/s6-supervise.c
+++ b/src/supervision/s6-supervise.c
@@ -343,7 +343,7 @@ static int uplastup_z (void)
{
unsigned int n ;
- if (!read_uint("max-death-tally", &n)) n = 20 ;
+ if (!read_uint("max-death-tally", &n)) n = 100 ;
if (n > S6_MAX_DEATH_TALLY) n = S6_MAX_DEATH_TALLY ;
if (n)
{
diff --git a/src/supervision/s6-svdt.c b/src/supervision/s6-svdt.c
new file mode 100644
index 0000000..b204934
--- /dev/null
+++ b/src/supervision/s6-svdt.c
@@ -0,0 +1,74 @@
+/* ISC license. */
+
+#include <sys/types.h>
+#include <skalibs/types.h>
+#include <skalibs/buffer.h>
+#include <skalibs/strerr2.h>
+#include <skalibs/sgetopt.h>
+#include <skalibs/sig.h>
+#include <s6/s6-supervise.h>
+
+#define USAGE "s6-svdt [ -S | -s ] [ -n maxentries ] servicedir"
+#define dieusage() strerr_dieusage(100, USAGE)
+#define die1() strerr_diefu1sys(111, "write to stdout")
+
+int main (int argc, char const *const *argv)
+{
+ unsigned int n = S6_MAX_DEATH_TALLY ;
+ int num = 0 ;
+ PROG = "s6-svdt" ;
+ {
+ subgetopt_t l = SUBGETOPT_ZERO ;
+ for (;;)
+ {
+ int opt = subgetopt_r(argc, argv, "Ssn:", &l) ;
+ if (opt == -1) break ;
+ switch (opt)
+ {
+ case 'S' : num = 0 ; break ;
+ case 's' : num = 1 ; break ;
+ case 'n' : if (!uint0_scan(l.arg, &n)) dieusage() ; break ;
+ default : dieusage() ;
+ }
+ }
+ argc -= l.ind ; argv += l.ind ;
+ }
+ if (!argc) dieusage() ;
+ if (n > S6_MAX_DEATH_TALLY) n = S6_MAX_DEATH_TALLY ;
+ if (!n) return 0 ;
+ {
+ s6_dtally_t tab[n] ;
+ ssize_t r = s6_dtally_read(argv[0], tab, n) ;
+ if (r < 0) strerr_diefu2sys(111, "read death tally for service ", argv[0]) ;
+ for (size_t i = 0 ; i < r ; i++)
+ {
+ char fmt[TIMESTAMP + 1] ;
+ timestamp_fmt(fmt, &tab[i].stamp) ;
+ fmt[TIMESTAMP] = ' ' ;
+ if (buffer_put(buffer_1, fmt, TIMESTAMP + 1) < 0) die1() ;
+ if (tab[i].sig)
+ {
+ if (buffer_puts(buffer_1, "signal ") < 0) die1() ;
+ if (num)
+ {
+ char fmt[3] ;
+ if (buffer_put(buffer_1, fmt, uint_fmt(fmt, tab[i].sig)) < 0) die1() ;
+ }
+ else
+ {
+ if (buffer_puts(buffer_1, "SIG") < 0) die1() ;
+ if (buffer_puts(buffer_1, sig_name(tab[i].sig)) < 0) die1() ;
+ }
+ }
+ else
+ {
+ char fmt[3] ;
+ if (buffer_puts(buffer_1, "exitcode ") < 0) die1() ;
+ if (buffer_put(buffer_1, fmt, uint_fmt(fmt, tab[i].exitcode)) < 0) die1() ;
+ }
+ if (buffer_put(buffer_1, "\n", 1) < 0) die1() ;
+ }
+ }
+ if (!buffer_flush(buffer_1)) die1() ;
+ return 0 ;
+}