aboutsummaryrefslogtreecommitdiff
path: root/runit
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2021-01-14 13:28:49 +0000
committerRon Yorston <rmy@pobox.com>2021-01-14 13:28:49 +0000
commit89963b524d211e1aec12b72b3725be05ee95c8cf (patch)
tree48590aef62b7ee7686b7898256f29def8d9c50b9 /runit
parent9aa5a829070392c2ac6494d0c4e674c0c2bc7dab (diff)
parent2b7c1aa92c68524559a2067609d09309d5c09adc (diff)
downloadbusybox-w32-89963b524d211e1aec12b72b3725be05ee95c8cf.tar.gz
busybox-w32-89963b524d211e1aec12b72b3725be05ee95c8cf.tar.bz2
busybox-w32-89963b524d211e1aec12b72b3725be05ee95c8cf.zip
Merge branch 'busybox' into merge
Diffstat (limited to 'runit')
-rw-r--r--runit/runsv.c22
-rw-r--r--runit/svlogd.c6
2 files changed, 18 insertions, 10 deletions
diff --git a/runit/runsv.c b/runit/runsv.c
index 36d85101e..ecab8cdf5 100644
--- a/runit/runsv.c
+++ b/runit/runsv.c
@@ -58,11 +58,19 @@ static void gettimeofday_ns(struct timespec *ts)
58#else 58#else
59static void gettimeofday_ns(struct timespec *ts) 59static void gettimeofday_ns(struct timespec *ts)
60{ 60{
61 BUILD_BUG_ON(sizeof(struct timeval) != sizeof(struct timespec)); 61 if (sizeof(struct timeval) == sizeof(struct timespec)
62 BUILD_BUG_ON(sizeof(((struct timeval*)ts)->tv_usec) != sizeof(ts->tv_nsec)); 62 && sizeof(((struct timeval*)ts)->tv_usec) == sizeof(ts->tv_nsec)
63 /* Cheat */ 63 ) {
64 gettimeofday((void*)ts, NULL); 64 /* Cheat */
65 ts->tv_nsec *= 1000; 65 xgettimeofday((void*)ts);
66 ts->tv_nsec *= 1000;
67 } else {
68 /* For example, musl has "incompatible" layouts */
69 struct timeval tv;
70 xgettimeofday(&tv);
71 ts->tv_sec = tv.tv_sec;
72 ts->tv_nsec = tv.tv_usec * 1000;
73 }
66} 74}
67#endif 75#endif
68 76
@@ -651,7 +659,7 @@ int runsv_main(int argc UNUSED_PARAM, char **argv)
651 gettimeofday_ns(&svd[0].start); 659 gettimeofday_ns(&svd[0].start);
652 update_status(&svd[0]); 660 update_status(&svd[0]);
653 if (LESS(svd[0].start.tv_sec, deadline)) 661 if (LESS(svd[0].start.tv_sec, deadline))
654 sleep(1); 662 sleep1();
655 } 663 }
656 if (haslog) { 664 if (haslog) {
657 if (child == svd[1].pid) { 665 if (child == svd[1].pid) {
@@ -664,7 +672,7 @@ int runsv_main(int argc UNUSED_PARAM, char **argv)
664 gettimeofday_ns(&svd[1].start); 672 gettimeofday_ns(&svd[1].start);
665 update_status(&svd[1]); 673 update_status(&svd[1]);
666 if (LESS(svd[1].start.tv_sec, deadline)) 674 if (LESS(svd[1].start.tv_sec, deadline))
667 sleep(1); 675 sleep1();
668 } 676 }
669 } 677 }
670 } /* for (;;) */ 678 } /* for (;;) */
diff --git a/runit/svlogd.c b/runit/svlogd.c
index a250058a1..294e31aca 100644
--- a/runit/svlogd.c
+++ b/runit/svlogd.c
@@ -351,7 +351,7 @@ static void fmt_time_human_30nul(char *s, char dt_delim)
351 struct tm *ptm; 351 struct tm *ptm;
352 struct timeval tv; 352 struct timeval tv;
353 353
354 gettimeofday(&tv, NULL); 354 xgettimeofday(&tv);
355 ptm = gmtime_r(&tv.tv_sec, &tm); 355 ptm = gmtime_r(&tv.tv_sec, &tm);
356 /* ^^^ using gmtime_r() instead of gmtime() to not use static data */ 356 /* ^^^ using gmtime_r() instead of gmtime() to not use static data */
357 sprintf(s, "%04u-%02u-%02u%c%02u:%02u:%02u.%06u000", 357 sprintf(s, "%04u-%02u-%02u%c%02u:%02u:%02u.%06u000",
@@ -376,7 +376,7 @@ static void fmt_time_bernstein_25(char *s)
376 struct timeval tv; 376 struct timeval tv;
377 unsigned sec_hi; 377 unsigned sec_hi;
378 378
379 gettimeofday(&tv, NULL); 379 xgettimeofday(&tv);
380 sec_hi = (0x400000000000000aULL + tv.tv_sec) >> 32; 380 sec_hi = (0x400000000000000aULL + tv.tv_sec) >> 32;
381 tv.tv_sec = (time_t)(0x400000000000000aULL) + tv.tv_sec; 381 tv.tv_sec = (time_t)(0x400000000000000aULL) + tv.tv_sec;
382 tv.tv_usec *= 1000; 382 tv.tv_usec *= 1000;
@@ -775,7 +775,7 @@ static NOINLINE unsigned logdir_open(struct logdir *ld, const char *fn)
775 ld->nmin = xatoi_positive(&s[1]); 775 ld->nmin = xatoi_positive(&s[1]);
776 break; 776 break;
777 case 't': { 777 case 't': {
778 static const struct suffix_mult mh_suffixes[] = { 778 static const struct suffix_mult mh_suffixes[] ALIGN_SUFFIX = {
779 { "m", 60 }, 779 { "m", 60 },
780 { "h", 60*60 }, 780 { "h", 60*60 },
781 /*{ "d", 24*60*60 },*/ 781 /*{ "d", 24*60*60 },*/