summaryrefslogtreecommitdiff
path: root/src/shutdown
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2019-09-06 11:26:35 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2019-09-06 11:26:35 +0000
commit5276157151d44fe7cf09060b413e81a1420c1b93 (patch)
tree4f65ffacd2e08a294a29ac08ee17fd5edff3d400 /src/shutdown
parent244dddd0ada79388a27f33e73b173764c581fca1 (diff)
downloads6-linux-init-5276157151d44fe7cf09060b413e81a1420c1b93.tar.xz
shutdown protocol now transmits a timeout; move to stopwatch API
Diffstat (limited to 'src/shutdown')
-rw-r--r--src/shutdown/s6-linux-init-hpr.c2
-rw-r--r--src/shutdown/s6-linux-init-shutdown.c1
-rw-r--r--src/shutdown/s6-linux-init-shutdownd.c4
3 files changed, 5 insertions, 2 deletions
diff --git a/src/shutdown/s6-linux-init-hpr.c b/src/shutdown/s6-linux-init-hpr.c
index 6c88b47..265cc30 100644
--- a/src/shutdown/s6-linux-init-hpr.c
+++ b/src/shutdown/s6-linux-init-hpr.c
@@ -114,7 +114,7 @@ int main (int argc, char const *const *argv)
if (dowall) hpr_wall(HPR_WALL_BANNER) ;
if (dowtmp < 2)
{
- if (!hpr_shutdown(what, &STAMP, 0))
+ if (!hpr_shutdown(what, &tain_zero, 0))
strerr_diefu1sys(111, "notify s6-linux-init-shutdownd") ;
}
return 0 ;
diff --git a/src/shutdown/s6-linux-init-shutdown.c b/src/shutdown/s6-linux-init-shutdown.c
index 306bee0..2a85ba9 100644
--- a/src/shutdown/s6-linux-init-shutdown.c
+++ b/src/shutdown/s6-linux-init-shutdown.c
@@ -246,6 +246,7 @@ int main (int argc, char const *const *argv)
}
if (!argc) dieusage() ;
parse_time(&when, argv[0]) ;
+ tain_sub(&when, &when, &STAMP) ;
if (argv[1]) hpr_wall(argv[1]) ;
if (what < 4)
{
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() ;