Skip to content

Commit 9bd1fa7

Browse files
committed
Add back fallback for mach_get_times
Fixes notifyd crashing
1 parent 2ec62cd commit 9bd1fa7

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/kernel/libsyscall/wrappers/mach_get_times.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,16 @@ mach_get_times(uint64_t* absolute_time, uint64_t* cont_time, struct timespec *tp
6464
if (__gettimeofday_with_mach(&tv, NULL, &tbr) < 0) {
6565
return KERN_FAILURE;
6666
} else if (tbr == 0) {
67+
#ifdef DARLING
68+
// In the past, Apple had a fallback solution if the tbr is still 0. However,
69+
// they removed this in their recent code. In the long run, it might be a good
70+
// idea to figure out why tbr returns 0 for notifyd.
71+
72+
// Apple's Comment: On an old kernel, likely chroot'ed. (remove next year)
73+
tbr = mach_absolute_time();
74+
#else
6775
__builtin_trap();
76+
#endif
6877
}
6978
}
7079

0 commit comments

Comments
 (0)