Signed-off-by: Olivier Brunel <j...@jjacky.com> --- src/supervision/s6-svstat.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
diff --git a/src/supervision/s6-svstat.c b/src/supervision/s6-svstat.c index c986b8d..bc27c32 100644 --- a/src/supervision/s6-svstat.c +++ b/src/supervision/s6-svstat.c @@ -44,8 +44,20 @@ int main (int argc, char const *const *argv) isup = status.pid && !status.flagfinishing ; if (isup) { + struct stat st ; + unsigned int dirlen = str_len(*argv) ; + char fn[dirlen + 1 + sizeof(S6_SUPERVISE_READY_FILENAME)] ; + int ready ; + byte_copy(fn, dirlen, *argv) ; + byte_copy(fn + dirlen, 1, "/") ; + byte_copy(fn + dirlen + 1, sizeof(S6_SUPERVISE_READY_FILENAME), S6_SUPERVISE_READY_FILENAME) ; + if (stat(fn, &st) == -1) + if (errno != ENOENT) strerr_diefu2sys(111, "stat ", fn) ; + else ready = 0 ; + else ready = 1 ; buffer_putnoflush(buffer_1small,"up (pid ", 8) ; buffer_putnoflush(buffer_1small, fmt, uint_fmt(fmt, status.pid)) ; + if (ready) buffer_putnoflush(buffer_1small,"; ready", 7) ; buffer_putnoflush(buffer_1small, ") ", 2) ; } else buffer_putnoflush(buffer_1small, "down ", 5) ; -- 2.2.2