From 990aad68c7a8d53ddd350af0ebae346dd27dd2ae Mon Sep 17 00:00:00 2001 From: obarun <eric@obarun.org> Date: Mon, 18 Nov 2019 18:04:09 +1100 Subject: [PATCH] Adapt to new stopwatch API --- src/66/66-hpr.c | 4 ++-- src/66/66-shutdown.c | 11 ++++++++++- src/66/66-shutdownd.c | 4 +++- src/66/deps-exe/66-all | 1 + src/66/deps-exe/66-boot | 2 +- src/66/deps-exe/66-dbctl | 2 ++ src/66/deps-exe/66-hpr | 2 +- src/66/deps-exe/66-inservice | 1 + src/66/deps-exe/66-shutdown | 2 +- src/66/deps-exe/66-shutdownd | 2 +- src/66/deps-exe/66-svctl | 1 + src/66/deps-exe/66-tree | 1 + src/lib66/ssexec_svctl.c | 2 +- src/lib66/svc_init.c | 2 +- 14 files changed, 27 insertions(+), 10 deletions(-) diff --git a/src/66/66-hpr.c b/src/66/66-hpr.c index fa0317dc..5924dc2b 100644 --- a/src/66/66-hpr.c +++ b/src/66/66-hpr.c @@ -120,7 +120,7 @@ int main (int argc, char const *const *argv) reboot(what == 3 ? RB_AUTOBOOT : what == 2 ? RB_POWER_OFF : RB_HALT_SYSTEM) ; strerr_diefu1sys(111, "reboot()") ; } - + if (!tain_now_g()) strerr_warnw1sys("get current time") ; if (dowtmp) { @@ -164,7 +164,7 @@ int main (int argc, char const *const *argv) memcpy(tlive,live,livelen) ; memcpy(tlive + livelen,INITCTL,INITCTL_LEN) ; tlive[livelen + INITCTL_LEN] = 0 ; - if (!hpr_shutdown(tlive,what, &STAMP, 0)) + if (!hpr_shutdown(tlive,what, &tain_zero, 0)) strerr_diefu1sys(111, "notify 66-shutdownd") ; } return 0 ; diff --git a/src/66/66-shutdown.c b/src/66/66-shutdown.c index 38bdb816..fd0b14da 100644 --- a/src/66/66-shutdown.c +++ b/src/66/66-shutdown.c @@ -282,7 +282,16 @@ int main (int argc, char const *const *argv) } if (!argc) strerr_dieusage(100,USAGE) ; parse_time(&when, argv[0]) ; - if (argv[1]) hpr_wall(argv[1]) ; + tain_sub(&when, &when, &STAMP) ; + if (argv[1]) + { + size_t len = strlen(argv[1]) ; + char msg[sizeof(HPR_WALL_BANNER) + 1 + len] ; + memcpy(msg, HPR_WALL_BANNER, sizeof(HPR_WALL_BANNER) - 1) ; + msg[sizeof(HPR_WALL_BANNER) - 1] = '\n' ; + memcpy(msg + sizeof(HPR_WALL_BANNER), argv[1], len + 1) ; + hpr_wall(msg) ; + } if (what < 4) { if (gracetime > 300) diff --git a/src/66/66-shutdownd.c b/src/66/66-shutdownd.c index 7822fd13..45892430 100644 --- a/src/66/66-shutdownd.c +++ b/src/66/66-shutdownd.c @@ -167,6 +167,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 ; } @@ -331,7 +332,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 (;;) @@ -369,6 +370,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() ; diff --git a/src/66/deps-exe/66-all b/src/66/deps-exe/66-all index 306db624..bc799f33 100644 --- a/src/66/deps-exe/66-all +++ b/src/66/deps-exe/66-all @@ -2,3 +2,4 @@ ${LIB66} -ls6 -loblibs -lskarnet +${SPAWN_LIB} diff --git a/src/66/deps-exe/66-boot b/src/66/deps-exe/66-boot index 390fc3b5..bc799f33 100644 --- a/src/66/deps-exe/66-boot +++ b/src/66/deps-exe/66-boot @@ -2,4 +2,4 @@ ${LIB66} -ls6 -loblibs -lskarnet - +${SPAWN_LIB} diff --git a/src/66/deps-exe/66-dbctl b/src/66/deps-exe/66-dbctl index f1e60dad..af2429b4 100644 --- a/src/66/deps-exe/66-dbctl +++ b/src/66/deps-exe/66-dbctl @@ -3,3 +3,5 @@ ${LIB66} -ls6 -loblibs -lskarnet +${SYSCLOCK_LIB} +${SPAWN_LIB} diff --git a/src/66/deps-exe/66-hpr b/src/66/deps-exe/66-hpr index 33e53254..d720e509 100644 --- a/src/66/deps-exe/66-hpr +++ b/src/66/deps-exe/66-hpr @@ -1,6 +1,6 @@ ${LIB66} ${LIBUTMPS} -lskarnet -${TAINNOW_LIB} +${SYSCLOCK_LIB} ${SOCKET_LIB} diff --git a/src/66/deps-exe/66-inservice b/src/66/deps-exe/66-inservice index 306db624..bc799f33 100644 --- a/src/66/deps-exe/66-inservice +++ b/src/66/deps-exe/66-inservice @@ -2,3 +2,4 @@ ${LIB66} -ls6 -loblibs -lskarnet +${SPAWN_LIB} diff --git a/src/66/deps-exe/66-shutdown b/src/66/deps-exe/66-shutdown index f88daf57..aa3691e7 100644 --- a/src/66/deps-exe/66-shutdown +++ b/src/66/deps-exe/66-shutdown @@ -1,5 +1,5 @@ ${LIB66} ${LIBUTMPS} -lskarnet -${TAINNOW_LIB} +${SYSCLOCK_LIB} ${SOCKET_LIB} diff --git a/src/66/deps-exe/66-shutdownd b/src/66/deps-exe/66-shutdownd index ffb45b22..9fcfb24b 100644 --- a/src/66/deps-exe/66-shutdownd +++ b/src/66/deps-exe/66-shutdownd @@ -3,5 +3,5 @@ ${LIB66} -loblibs ${LIBUTMPS} -lskarnet -${TAINNOW_LIB} +${SYSCLOCK_LIB} ${SOCKET_LIB} diff --git a/src/66/deps-exe/66-svctl b/src/66/deps-exe/66-svctl index 306db624..ec930b04 100644 --- a/src/66/deps-exe/66-svctl +++ b/src/66/deps-exe/66-svctl @@ -2,3 +2,4 @@ ${LIB66} -ls6 -loblibs -lskarnet +${SYSCLOCK_LIB} diff --git a/src/66/deps-exe/66-tree b/src/66/deps-exe/66-tree index f1e60dad..c34874a1 100644 --- a/src/66/deps-exe/66-tree +++ b/src/66/deps-exe/66-tree @@ -3,3 +3,4 @@ ${LIB66} -ls6 -loblibs -lskarnet +${SPAWN_LIB} diff --git a/src/lib66/ssexec_svctl.c b/src/lib66/ssexec_svctl.c index 77e8671d..da7474d8 100644 --- a/src/lib66/ssexec_svctl.c +++ b/src/lib66/ssexec_svctl.c @@ -648,7 +648,7 @@ int ssexec_svctl(int argc, char const *const *argv,char const *const *envp,ssexe //ttmain = tain_infinite_relative ; tain_from_millisecs(&ttmain,tsv_g) ; - tain_now_g() ; + tain_now_set_stopwatch_g() ; tain_add_g(&ttmain,&ttmain) ; int spfd = selfpipe_init() ; diff --git a/src/lib66/svc_init.c b/src/lib66/svc_init.c index 31a7447c..752ed173 100644 --- a/src/lib66/svc_init.c +++ b/src/lib66/svc_init.c @@ -51,7 +51,7 @@ int svc_init(ssexec_t *info,char const *src, genalloc *ga) ss_state_t sta = STATE_ZERO ; tain_t deadline ; - tain_now_g() ; + tain_now_set_stopwatch_g() ; tain_addsec(&deadline,&STAMP,2) ; if (!ftrigr_startf(&fifo, &deadline, &STAMP)) -- GitLab