Skip to content
Snippets Groups Projects
Commit 990aad68 authored by Eric Vidal's avatar Eric Vidal :speech_balloon:
Browse files

Adapt to new stopwatch API

parent d8d4c5c7
No related branches found
No related tags found
No related merge requests found
...@@ -120,7 +120,7 @@ int main (int argc, char const *const *argv) ...@@ -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) ; reboot(what == 3 ? RB_AUTOBOOT : what == 2 ? RB_POWER_OFF : RB_HALT_SYSTEM) ;
strerr_diefu1sys(111, "reboot()") ; strerr_diefu1sys(111, "reboot()") ;
} }
if (!tain_now_g()) strerr_warnw1sys("get current time") ; if (!tain_now_g()) strerr_warnw1sys("get current time") ;
if (dowtmp) if (dowtmp)
{ {
...@@ -164,7 +164,7 @@ int main (int argc, char const *const *argv) ...@@ -164,7 +164,7 @@ int main (int argc, char const *const *argv)
memcpy(tlive,live,livelen) ; memcpy(tlive,live,livelen) ;
memcpy(tlive + livelen,INITCTL,INITCTL_LEN) ; memcpy(tlive + livelen,INITCTL,INITCTL_LEN) ;
tlive[livelen + INITCTL_LEN] = 0 ; 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") ; strerr_diefu1sys(111, "notify 66-shutdownd") ;
} }
return 0 ; return 0 ;
......
...@@ -282,7 +282,16 @@ int main (int argc, char const *const *argv) ...@@ -282,7 +282,16 @@ int main (int argc, char const *const *argv)
} }
if (!argc) strerr_dieusage(100,USAGE) ; if (!argc) strerr_dieusage(100,USAGE) ;
parse_time(&when, argv[0]) ; 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 (what < 4)
{ {
if (gracetime > 300) if (gracetime > 300)
......
...@@ -167,6 +167,7 @@ static inline void prepare_shutdown (buffer *b, tain_t *deadline, unsigned int * ...@@ -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 == -1) strerr_diefu1sys(111, "read from pipe") ;
if (r < TAIN_PACK + 4) strerr_dief1x(101, "bad shutdown protocol") ; if (r < TAIN_PACK + 4) strerr_dief1x(101, "bad shutdown protocol") ;
tain_unpack(pack, deadline) ; tain_unpack(pack, deadline) ;
tain_add_g(deadline,deadline) ;
uint32_unpack_big(pack + TAIN_PACK, &u) ; uint32_unpack_big(pack + TAIN_PACK, &u) ;
if (u && u <= 300000) *grace_time = u ; if (u && u <= 300000) *grace_time = u ;
} }
...@@ -331,7 +332,7 @@ int main (int argc, char const *const *argv, char const *const *envp) ...@@ -331,7 +332,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
if (sig_ignore(SIGPIPE) == -1) if (sig_ignore(SIGPIPE) == -1)
strerr_diefu1sys(111, "sig_ignore SIGPIPE") ; strerr_diefu1sys(111, "sig_ignore SIGPIPE") ;
buffer_init(&b, &buffer_read, fdr, buf, 64) ; buffer_init(&b, &buffer_read, fdr, buf, 64) ;
tain_now_g() ; tain_now_set_stopwatch_g() ;
tain_add_g(&deadline, &tain_infinite_relative) ; tain_add_g(&deadline, &tain_infinite_relative) ;
for (;;) for (;;)
...@@ -369,6 +370,7 @@ int main (int argc, char const *const *argv, char const *const *envp) ...@@ -369,6 +370,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
kill(-1, SIGTERM) ; kill(-1, SIGTERM) ;
kill(-1, SIGCONT) ; kill(-1, SIGCONT) ;
tain_from_millisecs(&deadline, grace_time) ; tain_from_millisecs(&deadline, grace_time) ;
tain_now_g() ;
tain_add_g(&deadline, &deadline) ; tain_add_g(&deadline, &deadline) ;
deepsleepuntil_g(&deadline) ; deepsleepuntil_g(&deadline) ;
sync() ; sync() ;
......
...@@ -2,3 +2,4 @@ ${LIB66} ...@@ -2,3 +2,4 @@ ${LIB66}
-ls6 -ls6
-loblibs -loblibs
-lskarnet -lskarnet
${SPAWN_LIB}
...@@ -2,4 +2,4 @@ ${LIB66} ...@@ -2,4 +2,4 @@ ${LIB66}
-ls6 -ls6
-loblibs -loblibs
-lskarnet -lskarnet
${SPAWN_LIB}
...@@ -3,3 +3,5 @@ ${LIB66} ...@@ -3,3 +3,5 @@ ${LIB66}
-ls6 -ls6
-loblibs -loblibs
-lskarnet -lskarnet
${SYSCLOCK_LIB}
${SPAWN_LIB}
${LIB66} ${LIB66}
${LIBUTMPS} ${LIBUTMPS}
-lskarnet -lskarnet
${TAINNOW_LIB} ${SYSCLOCK_LIB}
${SOCKET_LIB} ${SOCKET_LIB}
...@@ -2,3 +2,4 @@ ${LIB66} ...@@ -2,3 +2,4 @@ ${LIB66}
-ls6 -ls6
-loblibs -loblibs
-lskarnet -lskarnet
${SPAWN_LIB}
${LIB66} ${LIB66}
${LIBUTMPS} ${LIBUTMPS}
-lskarnet -lskarnet
${TAINNOW_LIB} ${SYSCLOCK_LIB}
${SOCKET_LIB} ${SOCKET_LIB}
...@@ -3,5 +3,5 @@ ${LIB66} ...@@ -3,5 +3,5 @@ ${LIB66}
-loblibs -loblibs
${LIBUTMPS} ${LIBUTMPS}
-lskarnet -lskarnet
${TAINNOW_LIB} ${SYSCLOCK_LIB}
${SOCKET_LIB} ${SOCKET_LIB}
...@@ -2,3 +2,4 @@ ${LIB66} ...@@ -2,3 +2,4 @@ ${LIB66}
-ls6 -ls6
-loblibs -loblibs
-lskarnet -lskarnet
${SYSCLOCK_LIB}
...@@ -3,3 +3,4 @@ ${LIB66} ...@@ -3,3 +3,4 @@ ${LIB66}
-ls6 -ls6
-loblibs -loblibs
-lskarnet -lskarnet
${SPAWN_LIB}
...@@ -648,7 +648,7 @@ int ssexec_svctl(int argc, char const *const *argv,char const *const *envp,ssexe ...@@ -648,7 +648,7 @@ int ssexec_svctl(int argc, char const *const *argv,char const *const *envp,ssexe
//ttmain = tain_infinite_relative ; //ttmain = tain_infinite_relative ;
tain_from_millisecs(&ttmain,tsv_g) ; tain_from_millisecs(&ttmain,tsv_g) ;
tain_now_g() ; tain_now_set_stopwatch_g() ;
tain_add_g(&ttmain,&ttmain) ; tain_add_g(&ttmain,&ttmain) ;
int spfd = selfpipe_init() ; int spfd = selfpipe_init() ;
......
...@@ -51,7 +51,7 @@ int svc_init(ssexec_t *info,char const *src, genalloc *ga) ...@@ -51,7 +51,7 @@ int svc_init(ssexec_t *info,char const *src, genalloc *ga)
ss_state_t sta = STATE_ZERO ; ss_state_t sta = STATE_ZERO ;
tain_t deadline ; tain_t deadline ;
tain_now_g() ; tain_now_set_stopwatch_g() ;
tain_addsec(&deadline,&STAMP,2) ; tain_addsec(&deadline,&STAMP,2) ;
if (!ftrigr_startf(&fifo, &deadline, &STAMP)) if (!ftrigr_startf(&fifo, &deadline, &STAMP))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment