--- deps/libuv/src/unix/darwin.c +++ deps/libuv/src/unix/darwin.c @@ -25,6 +25,7 @@ #include #include +#include #include #include #include /* _NSGetExecutablePath */ @@ -33,6 +34,7 @@ #include /* sysconf */ static uv_once_t once = UV_ONCE_INIT; +static uint64_t (*time_func)(void); static mach_timebase_info_data_t timebase; @@ -54,12 +56,16 @@ static void uv__hrtime_init_once(void) { if (KERN_SUCCESS != mach_timebase_info(&timebase)) abort(); + + time_func = (uint64_t (*)(void)) dlsym(RTLD_DEFAULT, "mach_continuous_time"); + if (time_func == NULL) + time_func = mach_absolute_time; } uint64_t uv__hrtime(uv_clocktype_t type) { uv_once(&once, uv__hrtime_init_once); - return mach_continuous_time() * timebase.numer / timebase.denom; + return time_func() * timebase.numer / timebase.denom; } --- deps/libuv/src/unix/udp.c +++ deps/libuv/src/unix/udp.c @@ -152,7 +152,7 @@ } static int uv__udp_recvmmsg(uv_udp_t* handle, uv_buf_t* buf) { -#if defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__) +#if defined(__linux__) || defined(__FreeBSD__) || (defined(__APPLE__) && (MAC_OS_X_VERSION_MIN_REQUIRED >= 1070)) struct sockaddr_in6 peers[20]; struct iovec iov[ARRAY_SIZE(peers)]; struct mmsghdr msgs[ARRAY_SIZE(peers)]; @@ -215,9 +215,9 @@ handle->recv_cb(handle, 0, buf, NULL, UV_UDP_MMSG_FREE); } return nread; -#else /* __linux__ || ____FreeBSD__ || __APPLE__ */ +#else /* __linux__ || __FreeBSD__ || (defined(__APPLE__) && (MAC_OS_X_VERSION_MIN_REQUIRED >= 1070)) */ return UV_ENOSYS; -#endif /* __linux__ || ____FreeBSD__ || __APPLE__ */ +#endif /* __linux__ || __FreeBSD__ || (defined(__APPLE__) && (MAC_OS_X_VERSION_MIN_REQUIRED >= 1070)) */ } static void uv__udp_recvmsg(uv_udp_t* handle) { @@ -890,7 +890,7 @@ int uv_udp_using_recvmmsg(const uv_udp_t* handle) { -#if defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__) +#if defined(__linux__) || defined(__FreeBSD__) || (defined(__APPLE__) && (MAC_OS_X_VERSION_MIN_REQUIRED >= 1070)) if (handle->flags & UV_HANDLE_UDP_RECVMMSG) return 1; #endif @@ -1311,7 +1311,7 @@ r = 0; nsent = 0; -#if defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__) || \ +#if defined(__linux__) || defined(__FreeBSD__) || (defined(__APPLE__) && (MAC_OS_X_VERSION_MIN_REQUIRED >= 1070)) || \ (defined(__sun__) && defined(MSG_WAITFORONE)) if (count > 1) { for (i = 0; i < count; /*empty*/) { @@ -1339,7 +1339,7 @@ goto exit; } -#endif /* defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__) || +#endif /* defined(__linux__) || defined(__FreeBSD__) || (defined(__APPLE__) && (MAC_OS_X_VERSION_MIN_REQUIRED >= 1070)) || * (defined(__sun__) && defined(MSG_WAITFORONE)) */ --- deps/libuv/src/unix/fs.c +++ deps/libuv/src/unix/fs.c @@ -26,6 +26,10 @@ * getting the errno to the right place (req->result or as the return value.) */ +#ifdef __APPLE__ +#define _MACPORTS_LEGACY_COMPATIBLE_SCANDIR 1 +#endif + #include "uv.h" #include "internal.h" @@ -1073,7 +1077,7 @@ return -1; } /* sendfile() on iOS(arm64) will throw SIGSYS signal cause crash. */ -#elif (defined(__APPLE__) && !TARGET_OS_IPHONE) \ +#elif (defined(__APPLE__) && (!TARGET_OS_IPHONE || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050))) \ || defined(__DragonFly__) \ || defined(__FreeBSD__) { @@ -1442,7 +1446,7 @@ dst->st_blksize = src->st_blksize; dst->st_blocks = src->st_blocks; -#if defined(__APPLE__) +#if defined(__APPLE__) && (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) dst->st_atim.tv_sec = src->st_atimespec.tv_sec; dst->st_atim.tv_nsec = src->st_atimespec.tv_nsec; dst->st_mtim.tv_sec = src->st_mtimespec.tv_sec; --- deps/libuv/src/unix/process.c +++ deps/libuv/src/unix/process.c @@ -36,7 +36,9 @@ #include #if defined(__APPLE__) +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 # include +#endif # include # include # include @@ -387,7 +389,7 @@ #endif -#if defined(__APPLE__) +#if defined(__APPLE__) && (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) typedef struct uv__posix_spawn_fncs_tag { struct { int (*addchdir_np)(const posix_spawn_file_actions_t *, const char *); @@ -588,9 +590,11 @@ } } +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 if (fd == use_fd) err = posix_spawn_file_actions_addinherit_np(actions, fd); else +#endif err = posix_spawn_file_actions_adddup2(actions, use_fd, fd); assert(err != ENOSYS); if (err != 0) @@ -839,7 +843,7 @@ int exec_errorno; ssize_t r; -#if defined(__APPLE__) +#if defined(__APPLE__) && (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) uv_once(&posix_spawn_init_once, uv__spawn_init_posix_spawn); /* Special child process spawn case for macOS Big Sur (11.0) onwards --- deps/libuv/src/unix/tty.c +++ deps/libuv/src/unix/tty.c @@ -85,7 +85,7 @@ int dummy; result = ioctl(fd, TIOCGPTN, &dummy) != 0; -#elif defined(__APPLE__) +#elif defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 char dummy[256]; result = ioctl(fd, TIOCPTYGNAME, &dummy) != 0; --- deps/libuv/src/unix/udp.c +++ deps/libuv/src/unix/udp.c @@ -938,6 +938,7 @@ !defined(__ANDROID__) && \ !defined(__DragonFly__) && \ !defined(__QNX__) && \ + (!defined(__APPLE__) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1070)) && \ !defined(__GNU__) static int uv__udp_set_source_membership4(uv_udp_t* handle, const struct sockaddr_in* multicast_addr, @@ -1131,6 +1132,7 @@ !defined(__ANDROID__) && \ !defined(__DragonFly__) && \ !defined(__QNX__) && \ + (!defined(__APPLE__) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1070)) && \ !defined(__GNU__) int err; union uv__sockaddr mcast_addr;