Skip to content

Commit

Permalink
squash! libuv-devel: update to 1.50.0
Browse files Browse the repository at this point in the history
Convert patch set to be compatible with `git am`. Set produced with
`git format-patch`
  • Loading branch information
casr committed Feb 16, 2025
1 parent d586f7d commit 0320657
Show file tree
Hide file tree
Showing 6 changed files with 227 additions and 175 deletions.
9 changes: 5 additions & 4 deletions devel/libuv/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,12 @@ if {${subport} eq ${name}} {
conflicts libuv-devel
} else {
# DEVEL
patch.pre_args-replace \
-p0 -p1
patchfiles-append \
patch-libuv-unix-core-close-nocancel-devel.diff \
patch-libuv-legacy-devel.diff \
patch-libuv-revert-darwin-simplify-uv_hrtime.diff \
patch-libuv-fix-darwin-add-udp-mmsg-support.diff
0001-Revert-darwin-simplify-uv_hrtime.patch \
0002-prevent-pragmas-causing-issues-on-older-gcc-versions.patch \
0003-support-legacy-macos-pre-v11.patch

conflicts libuv

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
Revert "darwin: simplify uv_hrtime"
From c737e4d9756308e1f848af394285d9d3151bf8f9 Mon Sep 17 00:00:00 2001
From: Sergey Fedorov <[email protected]>
Date: Fri, 3 Jan 2025 14:40:05 +0800
Subject: [PATCH 1/3] Revert "darwin: simplify uv_hrtime"

This reverts commit c0a61c3bb323724532fa9c1ac190afb36e4ae264.

Required for support on MacOS <10.15
---
src/unix/darwin.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

--- src/unix/darwin.c.orig
+++ src/unix/darwin.c
diff --git a/src/unix/darwin.c b/src/unix/darwin.c
index 009efbef..5e764a65 100644
--- a/src/unix/darwin.c
+++ b/src/unix/darwin.c
@@ -25,6 +25,7 @@
#include <stdint.h>
#include <errno.h>
Expand Down Expand Up @@ -40,3 +48,6 @@ Required for support on MacOS <10.15
}


--
2.48.0

Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
--- src/unix/core.c.orig
+++ src/unix/core.c
@@ -597,18 +597,31 @@
From 7e212e1327bbc6b1a795f4a76dc8e88a6f8f27a8 Mon Sep 17 00:00:00 2001
From: Ken Cunningham <[email protected]>
Date: Tue, 21 May 2019 21:00:49 -0700
Subject: [PATCH 2/3] prevent pragmas causing issues on older gcc versions

See: https://github.com/macports/macports-ports/pull/4433

Co-authored-by: Michael Dickens <[email protected]>
---
src/unix/core.c | 27 ++++++++++++++++++++-------
1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/src/unix/core.c b/src/unix/core.c
index 61cbc0d0..0b22a395 100644
--- a/src/unix/core.c
+++ b/src/unix/core.c
@@ -597,18 +597,31 @@ int uv__accept(int sockfd) {
* will unwind the thread when it's in the cancel state. Work around that
* by making the system call directly. Musl libc is unaffected.
*/
Expand Down Expand Up @@ -39,3 +53,6 @@
#elif defined(__linux__) && defined(__SANITIZE_THREAD__) && defined(__clang__)
long rc;
__sanitizer_syscall_pre_close(fd);
--
2.48.0

188 changes: 188 additions & 0 deletions devel/libuv/files/0003-support-legacy-macos-pre-v11.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
From 82408606d468ff4be3f9699cc0f8f800a28744f1 Mon Sep 17 00:00:00 2001
From: Ken Cunningham <[email protected]>
Date: Mon, 12 Nov 2018 14:40:24 -0800
Subject: [PATCH 3/3] support legacy macos (pre v11)

Co-authored-by: Michael Dickens <[email protected]>
Co-authored-by: Sergey Fedorov <[email protected]>
Co-authored-by: Evan Miller <[email protected]>
---
src/unix/fs.c | 4 ++--
src/unix/process.c | 8 ++++++--
src/unix/tty.c | 2 +-
src/unix/udp.c | 14 ++++++++------
test/test-fs.c | 4 ++--
5 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/src/unix/fs.c b/src/unix/fs.c
index 239ecda1..424729e3 100644
--- a/src/unix/fs.c
+++ b/src/unix/fs.c
@@ -1079,7 +1079,7 @@ static ssize_t uv__fs_sendfile(uv_fs_t* req) {
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__)
{
@@ -1458,7 +1458,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/unix/process.c b/src/unix/process.c
index f2038f2c..a3f885d4 100644
--- a/src/unix/process.c
+++ b/src/unix/process.c
@@ -36,7 +36,9 @@
#include <poll.h>

#if defined(__APPLE__)
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
# include <spawn.h>
+#endif
# include <paths.h>
# include <sys/kauth.h>
# include <sys/types.h>
@@ -404,7 +406,7 @@ static void uv__process_child_init(const uv_process_options_t* options,
}


-#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 *);
@@ -605,9 +607,11 @@ static int uv__spawn_set_posix_spawn_file_actions(
}
}

+#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)
@@ -856,7 +860,7 @@ static int uv__spawn_and_init_child(
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
diff --git a/src/unix/tty.c b/src/unix/tty.c
index 793054ba..228b543d 100644
--- a/src/unix/tty.c
+++ b/src/unix/tty.c
@@ -85,7 +85,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/unix/udp.c b/src/unix/udp.c
index 67c01f7d..754690ed 100644
--- a/src/unix/udp.c
+++ b/src/unix/udp.c
@@ -152,7 +152,7 @@ static void uv__udp_io(uv_loop_t* loop, uv__io_t* w, unsigned int revents) {
}

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 @@ static int uv__udp_recvmmsg(uv_udp_t* handle, uv_buf_t* buf) {
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) {
@@ -754,6 +754,7 @@ static int uv__udp_set_membership6(uv_udp_t* handle,
!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,
@@ -877,7 +878,7 @@ int uv__udp_init_ex(uv_loop_t* loop,


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
@@ -945,6 +946,7 @@ int uv_udp_set_source_membership(uv_udp_t* handle,
!defined(__ANDROID__) && \
!defined(__DragonFly__) && \
!defined(__QNX__) && \
+ (!defined(__APPLE__) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1070)) && \
!defined(__GNU__)
int err;
union uv__sockaddr mcast_addr;
@@ -1298,7 +1300,7 @@ static int uv__udp_sendmsgv(int fd,
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))
if (count > 1) {
for (i = 0; i < count; /*empty*/) {
struct mmsghdr m[20];
@@ -1325,7 +1327,7 @@ static int uv__udp_sendmsgv(int fd,

goto exit;
}
-#endif /* defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__) */
+#endif /* defined(__linux__) || defined(__FreeBSD__) || (defined(__APPLE__) && (MAC_OS_X_VERSION_MIN_REQUIRED >= 1070)) */

for (i = 0; i < count; i++, nsent++)
if ((r = uv__udp_sendmsg1(fd, bufs[i], nbufs[i], addrs[i])))
diff --git a/test/test-fs.c b/test/test-fs.c
index 423d72dd..36bb2df0 100644
--- a/test/test-fs.c
+++ b/test/test-fs.c
@@ -1477,7 +1477,7 @@ TEST_IMPL(fs_fstat) {
ASSERT_OK(uv_fs_fstat(NULL, &req, file, NULL));
ASSERT_OK(req.result);
s = req.ptr;
-# if defined(__APPLE__)
+# if defined(__APPLE__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050)
ASSERT_EQ(s->st_birthtim.tv_sec, t.st_birthtimespec.tv_sec);
ASSERT_EQ(s->st_birthtim.tv_nsec, t.st_birthtimespec.tv_nsec);
# elif defined(__linux__)
@@ -1518,7 +1518,7 @@ TEST_IMPL(fs_fstat) {
ASSERT_EQ(s->st_size, (uint64_t) t.st_size);
ASSERT_EQ(s->st_blksize, (uint64_t) t.st_blksize);
ASSERT_EQ(s->st_blocks, (uint64_t) t.st_blocks);
-#if defined(__APPLE__)
+# if defined(__APPLE__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050)
ASSERT_EQ(s->st_atim.tv_sec, t.st_atimespec.tv_sec);
ASSERT_EQ(s->st_atim.tv_nsec, t.st_atimespec.tv_nsec);
ASSERT_EQ(s->st_mtim.tv_sec, t.st_mtimespec.tv_sec);
--
2.48.0

54 changes: 0 additions & 54 deletions devel/libuv/files/patch-libuv-fix-darwin-add-udp-mmsg-support.diff

This file was deleted.

Loading

0 comments on commit 0320657

Please sign in to comment.