Add sysctlbyname() for MacOS

This commit is contained in:
Justine Tunney 2024-05-02 23:21:43 -07:00
parent 5c6877b02b
commit 181cd4cbe8
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
21 changed files with 193 additions and 35 deletions

View file

@ -67,7 +67,7 @@ int sys_clock_gettime_xnu(int clock, struct timespec *ts) {
struct timeval x;
size_t n = sizeof(x);
int mib[] = {CTL_KERN, KERN_BOOTTIME};
if (sys_sysctl(mib, ARRAYLEN(mib), &x, &n, 0, 0) == -1)
if (sysctl(mib, ARRAYLEN(mib), &x, &n, 0, 0) == -1)
return -1;
if (ts)
*ts = timeval_totimespec(timeval_sub(timeval_real(), x));