Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions deps/uv/src/unix/fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -460,27 +460,28 @@ static ssize_t uv__preadv_or_pwritev(int fd,
off_t off,
_Atomic uintptr_t* cache,
int is_pread) {
ssize_t (*f)(int, const struct iovec*, uv__iovcnt, off_t);
void* p;
union {
ssize_t (*f)(int, const struct iovec*, uv__iovcnt, off_t);
void* p;
} u;

p = (void*) atomic_load_explicit(cache, memory_order_relaxed);
if (p == NULL) {
u.p = (void*) atomic_load_explicit(cache, memory_order_relaxed);
if (u.p == NULL) {
#ifdef RTLD_DEFAULT
/* Try _LARGEFILE_SOURCE version of preadv/pwritev first,
* then fall back to the plain version, for libcs like musl.
*/
p = dlsym(RTLD_DEFAULT, is_pread ? "preadv64" : "pwritev64");
if (p == NULL)
p = dlsym(RTLD_DEFAULT, is_pread ? "preadv" : "pwritev");
u.p = dlsym(RTLD_DEFAULT, is_pread ? "preadv64" : "pwritev64");
if (u.p == NULL)
u.p = dlsym(RTLD_DEFAULT, is_pread ? "preadv" : "pwritev");
dlerror(); /* Clear errors. */
#endif /* RTLD_DEFAULT */
if (p == NULL)
p = is_pread ? uv__preadv_emul : uv__pwritev_emul;
atomic_store_explicit(cache, (uintptr_t) p, memory_order_relaxed);
if (u.p == NULL)
u.f = is_pread ? uv__preadv_emul : uv__pwritev_emul;
atomic_store_explicit(cache, (uintptr_t) u.p, memory_order_relaxed);
}

f = p;
return f(fd, bufs, nbufs, off);
return u.f(fd, bufs, nbufs, off);
}


Expand Down
2 changes: 1 addition & 1 deletion deps/uv/src/uv-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,7 @@ void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count) {
int i;

for (i = 0; i < count; i++)
uv__free(cpu_infos[i].model);
uv__free((char*) cpu_infos[i].model);

uv__free(cpu_infos);
#endif /* __linux__ */
Expand Down
Loading