From 1bda33a4e8c8da4deb872548309458cc1d22937b Mon Sep 17 00:00:00 2001 From: Andrew Hyatt Date: Tue, 17 Mar 2020 22:31:05 -0400 Subject: [PATCH] Fix clock_gettime monotonic (#230) Prevents ssh from hanging. Now it asks for password then segfaults. darlinghq/darling#303 --- src/kernel/libsyscall/wrappers/mach_boottime.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/kernel/libsyscall/wrappers/mach_boottime.c b/src/kernel/libsyscall/wrappers/mach_boottime.c index 23b22f93b..698f77325 100644 --- a/src/kernel/libsyscall/wrappers/mach_boottime.c +++ b/src/kernel/libsyscall/wrappers/mach_boottime.c @@ -21,9 +21,16 @@ * @APPLE_LICENSE_HEADER_END@ */ #include +#include +#include "../../emulation/linux/base.h" +#include "../../emulation/linux/linux-syscalls/linux.h" uint64_t mach_boottime_usec(void) { - return *(uint64_t*)_COMM_PAGE_BOOTTIME_USEC; + struct timespec ts; + LINUX_SYSCALL(__NR_clock_gettime, CLOCK_MONOTONIC, &ts); + return ((ts.tv_sec*1000*1000*1000)+ts.tv_nsec)/1000; + /* We don't have this working, so make Linux syscall */ + /* return *(uint64_t*)_COMM_PAGE_BOOTTIME_USEC; */ } -- 2.51.2