diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2019-09-06 11:26:35 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2019-09-06 11:26:35 +0000 |
commit | 5276157151d44fe7cf09060b413e81a1420c1b93 (patch) | |
tree | 4f65ffacd2e08a294a29ac08ee17fd5edff3d400 /src/shutdown/s6-linux-init-shutdownd.c | |
parent | 244dddd0ada79388a27f33e73b173764c581fca1 (diff) | |
download | s6-linux-init-5276157151d44fe7cf09060b413e81a1420c1b93.tar.xz |
shutdown protocol now transmits a timeout; move to stopwatch API
Diffstat (limited to 'src/shutdown/s6-linux-init-shutdownd.c')
-rw-r--r-- | src/shutdown/s6-linux-init-shutdownd.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/shutdown/s6-linux-init-shutdownd.c b/src/shutdown/s6-linux-init-shutdownd.c index 9707ade..f5c436c 100644 --- a/src/shutdown/s6-linux-init-shutdownd.c +++ b/src/shutdown/s6-linux-init-shutdownd.c @@ -103,6 +103,7 @@ static inline void prepare_shutdown (buffer *b, tain_t *deadline, unsigned int * if (r == -1) strerr_diefu1sys(111, "read from pipe") ; if (r < TAIN_PACK + 4) strerr_dief1x(101, "bad shutdown protocol") ; tain_unpack(pack, deadline) ; + tain_add_g(deadline, deadline) ; uint32_unpack_big(pack + TAIN_PACK, &u) ; if (u && u <= 300000) *grace_time = u ; } @@ -262,7 +263,7 @@ int main (int argc, char const *const *argv, char const *const *envp) if (sig_ignore(SIGPIPE) == -1) strerr_diefu1sys(111, "sig_ignore SIGPIPE") ; buffer_init(&b, &buffer_read, fdr, buf, 64) ; - tain_now_g() ; + tain_now_set_stopwatch_g() ; tain_add_g(&deadline, &tain_infinite_relative) ; for (;;) @@ -300,6 +301,7 @@ int main (int argc, char const *const *argv, char const *const *envp) kill(-1, SIGTERM) ; kill(-1, SIGCONT) ; tain_from_millisecs(&deadline, grace_time) ; + tain_now_g() ; tain_add_g(&deadline, &deadline) ; deepsleepuntil_g(&deadline) ; sync() ; |