diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2015-01-14 00:48:32 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2015-01-14 00:48:32 +0000 |
commit | d73a8330016fbf172f8e3521b879502b9139a970 (patch) | |
tree | 9368926e55d67bf565cc0f2275e203f464cf193a /src/supervision | |
parent | a6395bee8b2b696c0c74ff23a11944a491c83cc1 (diff) | |
download | s6-e3603389c2422bfd783004d53d193c68607cbb5c.tar.xz |
- Parallel build fixv2.0.1.0
- Complete readiness notification via supervise/ready
- Version updated to 2.0.1.0, release candidate
Diffstat (limited to 'src/supervision')
-rw-r--r-- | src/supervision/deps-exe/s6-supervise | 2 | ||||
-rw-r--r-- | src/supervision/deps-exe/s6-svc | 2 | ||||
-rw-r--r-- | src/supervision/deps-exe/s6-svscan | 2 | ||||
-rw-r--r-- | src/supervision/deps-exe/s6-svscanctl | 2 | ||||
-rw-r--r-- | src/supervision/deps-exe/s6-svstat | 2 | ||||
-rw-r--r-- | src/supervision/deps-exe/s6-svwait | 2 | ||||
-rw-r--r-- | src/supervision/s6-supervise.c | 20 | ||||
-rw-r--r-- | src/supervision/s6-svwait.c | 19 |
8 files changed, 36 insertions, 15 deletions
diff --git a/src/supervision/deps-exe/s6-supervise b/src/supervision/deps-exe/s6-supervise index 58a34e0..077e863 100644 --- a/src/supervision/deps-exe/s6-supervise +++ b/src/supervision/deps-exe/s6-supervise @@ -1,3 +1,3 @@ --ls6 +${LIBS6} -lskarnet ${TAINNOW_LIB} diff --git a/src/supervision/deps-exe/s6-svc b/src/supervision/deps-exe/s6-svc index 83cec1e..08815d9 100644 --- a/src/supervision/deps-exe/s6-svc +++ b/src/supervision/deps-exe/s6-svc @@ -1,2 +1,2 @@ --ls6 +${LIBS6} -lskarnet diff --git a/src/supervision/deps-exe/s6-svscan b/src/supervision/deps-exe/s6-svscan index 58a34e0..077e863 100644 --- a/src/supervision/deps-exe/s6-svscan +++ b/src/supervision/deps-exe/s6-svscan @@ -1,3 +1,3 @@ --ls6 +${LIBS6} -lskarnet ${TAINNOW_LIB} diff --git a/src/supervision/deps-exe/s6-svscanctl b/src/supervision/deps-exe/s6-svscanctl index 83cec1e..08815d9 100644 --- a/src/supervision/deps-exe/s6-svscanctl +++ b/src/supervision/deps-exe/s6-svscanctl @@ -1,2 +1,2 @@ --ls6 +${LIBS6} -lskarnet diff --git a/src/supervision/deps-exe/s6-svstat b/src/supervision/deps-exe/s6-svstat index 7065b26..b1e57e4 100644 --- a/src/supervision/deps-exe/s6-svstat +++ b/src/supervision/deps-exe/s6-svstat @@ -1,3 +1,3 @@ --ls6 +${LIBS6} -lskarnet ${SYSCLOCK_LIB} diff --git a/src/supervision/deps-exe/s6-svwait b/src/supervision/deps-exe/s6-svwait index ac0cace..f3a3143 100644 --- a/src/supervision/deps-exe/s6-svwait +++ b/src/supervision/deps-exe/s6-svwait @@ -1,4 +1,4 @@ --ls6 +${LIBS6} -lskarnet ${SOCKET_LIB} ${TAINNOW_LIB} diff --git a/src/supervision/s6-supervise.c b/src/supervision/s6-supervise.c index de9b6ea..65cbd9d 100644 --- a/src/supervision/s6-supervise.c +++ b/src/supervision/s6-supervise.c @@ -161,6 +161,8 @@ static void trystart (void) PROG = "s6-supervise (child)" ; selfpipe_finish() ; fd_close(p[0]) ; + if (unlink(S6_SUPERVISE_READY_FILENAME) < 0 && errno != ENOENT) + strerr_warnwu1sys("unlink " S6_SUPERVISE_READY_FILENAME) ; if (flagsetsid) setsid() ; execve("./run", (char *const *)cargv, (char *const *)environ) ; fd_write(p[1], "", 1) ; @@ -264,14 +266,21 @@ static void uptimeout (void) strerr_warnw1x("can't happen: timeout while the service is up!") ; } -static void up_z (void) +static void uplastup_z (int islast) { int wstat = status.pid ; status.pid = 0 ; tain_copynow(&status.stamp) ; announce() ; ftrigw_notify(S6_SUPERVISE_EVENTDIR, 'd') ; - tryfinish(wstat, 0) ; + if (unlink(S6_SUPERVISE_READY_FILENAME) < 0 && errno != ENOENT) + strerr_warnwu1sys("unlink " S6_SUPERVISE_READY_FILENAME) ; + tryfinish(wstat, islast) ; +} + +static void up_z (void) +{ + uplastup_z(0) ; } static void up_o (void) @@ -346,12 +355,7 @@ static void finish_x (void) static void lastup_z (void) { - int wstat = status.pid ; - status.pid = 0 ; - tain_copynow(&status.stamp) ; - announce() ; - ftrigw_notify(S6_SUPERVISE_EVENTDIR, 'd') ; - tryfinish(wstat, 1) ; + uplastup_z(1) ; } static action_t_ref const actions[5][23] = diff --git a/src/supervision/s6-svwait.c b/src/supervision/s6-svwait.c index 0d7c96c..a6dc410 100644 --- a/src/supervision/s6-svwait.c +++ b/src/supervision/s6-svwait.c @@ -1,5 +1,7 @@ /* ISC license. */ +#include <unistd.h> +#include <errno.h> #include <skalibs/sgetopt.h> #include <skalibs/bytestr.h> #include <skalibs/uint16.h> @@ -77,8 +79,23 @@ int main (int argc, char const *const *argv) for (i = 0 ; i < (unsigned int)argc ; i++) { s6_svstatus_t st = S6_SVSTATUS_ZERO ; + int isup ; if (!s6_svstatus_read(argv[i], &st)) strerr_diefu1sys(111, "s6_svstatus_read") ; - bitarray_poke(states, i, !!st.pid) ; + isup = !!st.pid ; + if (re[0] == 'U' && isup) + { + unsigned int len = str_len(argv[i]) ; + char s[len + 1 + sizeof(S6_SUPERVISE_READY_FILENAME)] ; + byte_copy(s, len, argv[i]) ; + s[len] = '/' ; + byte_copy(s + len + 1, sizeof(S6_SUPERVISE_READY_FILENAME), S6_SUPERVISE_READY_FILENAME) ; + if (access(s, F_OK) < 0) + { + if (errno == ENOENT) isup = 0 ; + else strerr_warnwu2sys("check ", s) ; + } + } + bitarray_poke(states, i, isup) ; } for (;;) |