Skip to content

Commit e9cfecf

Browse files
committed
deps: update libuv to 1.49.1
nodejs/node#55114
1 parent 5e450ba commit e9cfecf

2 files changed

Lines changed: 52 additions & 0 deletions

File tree

‎patches/node/.patches‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,4 @@ test_use_static_method_names_in_call_stacks.patch
4242
build_use_third_party_simdutf.patch
4343
fix_remove_fastapitypedarray_usage.patch
4444
test_handle_explicit_resource_management_globals.patch
45+
linux_try_preadv64_pwritev64_before_preadv_pwritev_4683.patch
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: Ben Noordhuis <info@bnoordhuis.nl>
3+
Date: Tue, 28 Jan 2025 09:27:58 +0100
4+
Subject: linux: try preadv64/pwritev64 before preadv/pwritev (#4683)
5+
6+
Fixes: https://github.com/libuv/libuv/issues/4678
7+
Refs: https://github.com/libuv/libuv/issues/4532
8+
9+
diff --git a/deps/uv/src/unix/fs.c b/deps/uv/src/unix/fs.c
10+
index 239ecda16a7eb9b40453502cf0362ae66366cf72..1631d9340bc10c2ac4c3d53a63ed9bc10f3e1c7c 100644
11+
--- a/deps/uv/src/unix/fs.c
12+
+++ b/deps/uv/src/unix/fs.c
13+
@@ -461,12 +461,7 @@ static ssize_t uv__pwritev_emul(int fd,
14+
15+
/* The function pointer cache is an uintptr_t because _Atomic void*
16+
* doesn't work on macos/ios/etc...
17+
- * Disable optimization on armv7 to work around the bug described in
18+
- * https://github.com/libuv/libuv/issues/4532
19+
*/
20+
-#if defined(__arm__) && (__ARM_ARCH == 7)
21+
-__attribute__((optimize("O0")))
22+
-#endif
23+
static ssize_t uv__preadv_or_pwritev(int fd,
24+
const struct iovec* bufs,
25+
size_t nbufs,
26+
@@ -479,7 +474,12 @@ static ssize_t uv__preadv_or_pwritev(int fd,
27+
p = (void*) atomic_load_explicit(cache, memory_order_relaxed);
28+
if (p == NULL) {
29+
#ifdef RTLD_DEFAULT
30+
- p = dlsym(RTLD_DEFAULT, is_pread ? "preadv" : "pwritev");
31+
+ /* Try _LARGEFILE_SOURCE version of preadv/pwritev first,
32+
+ * then fall back to the plain version, for libcs like musl.
33+
+ */
34+
+ p = dlsym(RTLD_DEFAULT, is_pread ? "preadv64" : "pwritev64");
35+
+ if (p == NULL)
36+
+ p = dlsym(RTLD_DEFAULT, is_pread ? "preadv" : "pwritev");
37+
dlerror(); /* Clear errors. */
38+
#endif /* RTLD_DEFAULT */
39+
if (p == NULL)
40+
@@ -487,10 +487,7 @@ static ssize_t uv__preadv_or_pwritev(int fd,
41+
atomic_store_explicit(cache, (uintptr_t) p, memory_order_relaxed);
42+
}
43+
44+
- /* Use memcpy instead of `f = p` to work around a compiler bug,
45+
- * see https://github.com/libuv/libuv/issues/4532
46+
- */
47+
- memcpy(&f, &p, sizeof(p));
48+
+ f = p;
49+
return f(fd, bufs, nbufs, off);
50+
}
51+

0 commit comments

Comments
 (0)