s6

Mirror/fork of https://skarnet.org/software/s6/
git clone https://ccx.te2000.cz/git/s6
Log | Files | Refs | README | LICENSE

commit 3b8083f63e774b30963948778e01553d85cfea29
parent 26c5fee82736e56cff3d114ff9d6e3969d1ce061
Author: Laurent Bercot <ska-skaware@skarnet.org>
Date:   Tue, 20 Mar 2018 15:18:27 +0000

 Add throttling support to s6-svstat

Diffstat:
Mdoc/s6-svstat.html | 4+++-
Msrc/supervision/s6-svstat.c | 4+++-
2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/doc/s6-svstat.html b/doc/s6-svstat.html @@ -75,7 +75,9 @@ are as follows. <em>fields</em> is a list of comma-separated field names. The valid field names are the following: <ul> - <li> <tt>up</tt>: print <tt>true</tt> if the service is up and <tt>false</tt> if it is down. </li> + <li> <tt>up</tt>: print <tt>true</tt> if the service is up and <tt>false</tt> if it is down. +If the service is being throttled (i.e. technically up, but sleeping for a certain +amount of time before it is really launched), it prints <tt>throttled</tt> instead of <tt>true</tt>. </li> <li> <tt>wantedup</tt>: print <tt>true</tt> if <a href="s6-supervise.html">s6-supervise</a> is currently instructed to (re)start the service when it is down, and <tt>false</tt> if <a href="s6-supervise.html">s6-supervise</a> is currently instructed to leave the service alone. </li> diff --git a/src/supervision/s6-svstat.c b/src/supervision/s6-svstat.c @@ -35,7 +35,7 @@ struct funcmap_s static void pr_up (buffer *b, s6_svstatus_t const *st) { - buffer_putsnoflush(b, st->pid && !st->flagfinishing ? "true" : "false") ; + buffer_putsnoflush(b, st->pid && !st->flagfinishing ? st->flagthrottled ? "throttled" : "true" : "false") ; } static void pr_wantedup (buffer *b, s6_svstatus_t const *st) @@ -210,6 +210,8 @@ static void legacy (s6_svstatus_t *st, int flagnum) buffer_putnoflush(buffer_1small, fmt, uint64_fmt(fmt, status.stamp.sec.x)) ; buffer_putnoflush(buffer_1small, " seconds", 8) ; + if (isup && status.flagthrottled) + buffer_putnoflush(buffer_1small, ", throttled", 11) ; if (isup && !normallyup) buffer_putnoflush(buffer_1small, ", normally down", 15) ; if (!isup && normallyup)