busybox: fix build w/ musl-1.2.2 (time64)

This commit is contained in:
Jürgen Buchmüller 2021-02-09 12:41:30 +01:00
parent a2755b0a58
commit c085deae94

View file

@ -0,0 +1,28 @@
--- coreutils/date.c 2019-06-10 12:50:53.000000000 +0200
+++ coreutils/date.c 2021-02-09 12:39:19.127054192 +0100
@@ -274,7 +274,11 @@
#if ENABLE_FEATURE_DATE_NANO
/* libc has incredibly messy way of doing this,
* typically requiring -lrt. We just skip all this mess */
+#if defined(__NR_clock_gettime32)
+ syscall(__NR_clock_gettime32, CLOCK_REALTIME, &ts);
+#else
syscall(__NR_clock_gettime, CLOCK_REALTIME, &ts);
+#endif
#else
time(&ts.tv_sec);
#endif
--- libbb/time.c 2019-06-10 12:50:53.000000000 +0200
+++ libbb/time.c 2021-02-09 12:35:35.125037118 +0100
@@ -257,7 +257,11 @@
* typically requiring -lrt. We just skip all this mess */
static void get_mono(struct timespec *ts)
{
+#if defined(__NR_clock_gettime32)
+ if (syscall(__NR_clock_gettime32, CLOCK_MONOTONIC, ts))
+#else
if (syscall(__NR_clock_gettime, CLOCK_MONOTONIC, ts))
+#endif
bb_error_msg_and_die("clock_gettime(MONOTONIC) failed");
}
unsigned long long FAST_FUNC monotonic_ns(void)