From 0571723c8cfb1625457e72b08d3436be4af8cdf7 Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Tue, 13 Dec 2022 17:50:59 +0700 Subject: [PATCH 1/3] libuv: fix for older macOS --- src/libuv/src/unix/darwin-proctitle.c | 2 ++ src/libuv/src/unix/fs.c | 4 ++-- src/libuv/src/unix/tty.c | 2 +- src/libuv/src/unix/udp.c | 2 ++ 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/libuv/src/unix/darwin-proctitle.c b/src/libuv/src/unix/darwin-proctitle.c index 5288083..c1aa053 100644 --- a/src/libuv/src/unix/darwin-proctitle.c +++ b/src/libuv/src/unix/darwin-proctitle.c @@ -41,9 +41,11 @@ static int uv__pthread_setname_np(const char* name) { strncpy(namebuf, name, sizeof(namebuf) - 1); namebuf[sizeof(namebuf) - 1] = '\0'; +#if TARGET_OS_IPHONE || (MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) err = pthread_setname_np(namebuf); if (err) return UV__ERR(err); +#endif return 0; } diff --git a/src/libuv/src/unix/fs.c b/src/libuv/src/unix/fs.c index 362c36c..a99af72 100644 --- a/src/libuv/src/unix/fs.c +++ b/src/libuv/src/unix/fs.c @@ -1060,7 +1060,7 @@ static ssize_t uv__fs_sendfile(uv_fs_t* req) { return -1; } -#elif defined(__APPLE__) || \ +#elif (defined(__APPLE__) && (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)) || \ defined(__DragonFly__) || \ defined(__FreeBSD__) || \ defined(__FreeBSD_kernel__) @@ -1427,7 +1427,7 @@ static void uv__to_stat(struct stat* src, uv_stat_t* dst) { 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; diff --git a/src/libuv/src/unix/tty.c b/src/libuv/src/unix/tty.c index 9442cf1..9552f4e 100644 --- a/src/libuv/src/unix/tty.c +++ b/src/libuv/src/unix/tty.c @@ -72,7 +72,7 @@ static int uv__tty_is_slave(const int fd) { 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; diff --git a/src/libuv/src/unix/udp.c b/src/libuv/src/unix/udp.c index aee8d63..a7735e5 100644 --- a/src/libuv/src/unix/udp.c +++ b/src/libuv/src/unix/udp.c @@ -927,6 +927,7 @@ static int uv__udp_set_membership6(uv_udp_t* handle, !defined(__NetBSD__) && \ !defined(__ANDROID__) && \ !defined(__DragonFly__) && \ + (!defined(__APPLE__) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1070)) && \ !defined(__QNX__) static int uv__udp_set_source_membership4(uv_udp_t* handle, const struct sockaddr_in* multicast_addr, @@ -1119,6 +1120,7 @@ int uv_udp_set_source_membership(uv_udp_t* handle, !defined(__NetBSD__) && \ !defined(__ANDROID__) && \ !defined(__DragonFly__) && \ + (!defined(__APPLE__) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1070)) && \ !defined(__QNX__) int err; union uv__sockaddr mcast_addr; -- 2.37.3