Skip to content

Commit f327d47

Browse files
lpincaruyadorno
authored andcommitted
deps: update libuv to 1.49.2
Fixes: #56137 Refs: #56223 PR-URL: #56224 Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com>
1 parent 3fec5e3 commit f327d47

15 files changed

+69
-176
lines changed

deps/uv/AUTHORS

+2
Original file line numberDiff line numberDiff line change
@@ -588,3 +588,5 @@ Raihaan Shouhell <raihaanhimself@gmail.com>
588588
Rialbat <miha-wead@mail.ru>
589589
Adam <adam@NetBSD.org>
590590
Poul T Lomholt <ptlomholt@users.noreply.github.com>
591+
dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
592+
Thad House <ThadHouse@users.noreply.github.com>

deps/uv/ChangeLog

+19-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,22 @@
1-
2024.10.11, Version 1.49.1 (Stable)
1+
2024.10.18, Version 1.49.2 (Stable)
2+
3+
Changes since version 1.49.1:
4+
5+
* win,fs: remove trailing slash in junctions (Hüseyin Açacak)
6+
7+
* Revert "linux: eliminate a read on eventfd per wakeup" (Ben Noordhuis)
8+
9+
* win: Fix linked list logic in getaddrinfo (Thad House)
10+
11+
* win: fix compilation against Windows 24H2 SDK (Thad House)
12+
13+
* win: remap ERROR_NOACCESS and ERROR_BUFFER_OVERFLOW (Jameson Nash)
14+
15+
* win,fs: match trailing slash presence in junctions to user input (Jameson
16+
Nash)
17+
18+
19+
2024.10.11, Version 1.49.1 (Stable), 8be336f4ee296d20e1c071a44d6adf279e202236
220

321
Changes since version 1.49.0:
422

deps/uv/configure.ac

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1414

1515
AC_PREREQ(2.57)
16-
AC_INIT([libuv], [1.49.1], [https://github.com/libuv/libuv/issues])
16+
AC_INIT([libuv], [1.49.2], [https://github.com/libuv/libuv/issues])
1717
AC_CONFIG_MACRO_DIR([m4])
1818
m4_include([m4/libuv-extra-automake-flags.m4])
1919
m4_include([m4/as_case.m4])

deps/uv/include/uv/version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
#define UV_VERSION_MAJOR 1
3434
#define UV_VERSION_MINOR 49
35-
#define UV_VERSION_PATCH 1
35+
#define UV_VERSION_PATCH 2
3636
#define UV_VERSION_IS_RELEASE 1
3737
#define UV_VERSION_SUFFIX ""
3838

deps/uv/src/unix/async.c

+16-116
Original file line numberDiff line numberDiff line change
@@ -38,34 +38,6 @@
3838
#include <sys/eventfd.h>
3939
#endif
4040

41-
#if UV__KQUEUE_EVFILT_USER
42-
static uv_once_t kqueue_runtime_detection_guard = UV_ONCE_INIT;
43-
static int kqueue_evfilt_user_support = 1;
44-
45-
46-
static void uv__kqueue_runtime_detection(void) {
47-
int kq;
48-
struct kevent ev[2];
49-
struct timespec timeout = {0, 0};
50-
51-
/* Perform the runtime detection to ensure that kqueue with
52-
* EVFILT_USER actually works. */
53-
kq = kqueue();
54-
EV_SET(ev, UV__KQUEUE_EVFILT_USER_IDENT, EVFILT_USER,
55-
EV_ADD | EV_CLEAR, 0, 0, 0);
56-
EV_SET(ev + 1, UV__KQUEUE_EVFILT_USER_IDENT, EVFILT_USER,
57-
0, NOTE_TRIGGER, 0, 0);
58-
if (kevent(kq, ev, 2, ev, 1, &timeout) < 1 ||
59-
ev[0].filter != EVFILT_USER ||
60-
ev[0].ident != UV__KQUEUE_EVFILT_USER_IDENT ||
61-
ev[0].flags & EV_ERROR)
62-
/* If we wind up here, we can assume that EVFILT_USER is defined but
63-
* broken on the current system. */
64-
kqueue_evfilt_user_support = 0;
65-
uv__close(kq);
66-
}
67-
#endif
68-
6941
static void uv__async_send(uv_loop_t* loop);
7042
static int uv__async_start(uv_loop_t* loop);
7143
static void uv__cpu_relax(void);
@@ -158,23 +130,16 @@ void uv__async_close(uv_async_t* handle) {
158130

159131

160132
static void uv__async_io(uv_loop_t* loop, uv__io_t* w, unsigned int events) {
161-
#ifndef __linux__
162133
char buf[1024];
163134
ssize_t r;
164-
#endif
165135
struct uv__queue queue;
166136
struct uv__queue* q;
167137
uv_async_t* h;
168138
_Atomic int *pending;
169139

170140
assert(w == &loop->async_io_watcher);
171141

172-
#ifndef __linux__
173-
#if UV__KQUEUE_EVFILT_USER
174-
for (;!kqueue_evfilt_user_support;) {
175-
#else
176142
for (;;) {
177-
#endif
178143
r = read(w->fd, buf, sizeof(buf));
179144

180145
if (r == sizeof(buf))
@@ -191,7 +156,6 @@ static void uv__async_io(uv_loop_t* loop, uv__io_t* w, unsigned int events) {
191156

192157
abort();
193158
}
194-
#endif /* !__linux__ */
195159

196160
uv__queue_move(&loop->async_handles, &queue);
197161
while (!uv__queue_empty(&queue)) {
@@ -215,58 +179,34 @@ static void uv__async_io(uv_loop_t* loop, uv__io_t* w, unsigned int events) {
215179

216180

217181
static void uv__async_send(uv_loop_t* loop) {
182+
const void* buf;
183+
ssize_t len;
218184
int fd;
219-
ssize_t r;
220-
#ifdef __linux__
221-
uint64_t val;
222-
223-
fd = loop->async_io_watcher.fd; /* eventfd */
224-
for (val = 1; /* empty */; val = 1) {
225-
r = write(fd, &val, sizeof(uint64_t));
226-
if (r < 0) {
227-
/* When EAGAIN occurs, the eventfd counter hits the maximum value of the unsigned 64-bit.
228-
* We need to first drain the eventfd and then write again.
229-
*
230-
* Check out https://man7.org/linux/man-pages/man2/eventfd.2.html for details.
231-
*/
232-
if (errno == EAGAIN) {
233-
/* It's ready to retry. */
234-
if (read(fd, &val, sizeof(uint64_t)) > 0 || errno == EAGAIN) {
235-
continue;
236-
}
237-
}
238-
/* Unknown error occurs. */
239-
break;
240-
}
241-
return;
242-
}
243-
#else
244-
#if UV__KQUEUE_EVFILT_USER
245-
struct kevent ev;
246-
247-
if (kqueue_evfilt_user_support) {
248-
fd = loop->async_io_watcher.fd; /* magic number for EVFILT_USER */
249-
EV_SET(&ev, fd, EVFILT_USER, 0, NOTE_TRIGGER, 0, 0);
250-
r = kevent(loop->backend_fd, &ev, 1, NULL, 0, NULL);
251-
if (r == 0)
252-
return;
253-
else
254-
abort();
185+
int r;
186+
187+
buf = "";
188+
len = 1;
189+
fd = loop->async_wfd;
190+
191+
#if defined(__linux__)
192+
if (fd == -1) {
193+
static const uint64_t val = 1;
194+
buf = &val;
195+
len = sizeof(val);
196+
fd = loop->async_io_watcher.fd; /* eventfd */
255197
}
256198
#endif
257199

258-
fd = loop->async_wfd; /* write end of the pipe */
259200
do
260-
r = write(fd, "x", 1);
201+
r = write(fd, buf, len);
261202
while (r == -1 && errno == EINTR);
262203

263-
if (r == 1)
204+
if (r == len)
264205
return;
265206

266207
if (r == -1)
267208
if (errno == EAGAIN || errno == EWOULDBLOCK)
268209
return;
269-
#endif
270210

271211
abort();
272212
}
@@ -275,9 +215,6 @@ static void uv__async_send(uv_loop_t* loop) {
275215
static int uv__async_start(uv_loop_t* loop) {
276216
int pipefd[2];
277217
int err;
278-
#if UV__KQUEUE_EVFILT_USER
279-
struct kevent ev;
280-
#endif
281218

282219
if (loop->async_io_watcher.fd != -1)
283220
return 0;
@@ -289,36 +226,6 @@ static int uv__async_start(uv_loop_t* loop) {
289226

290227
pipefd[0] = err;
291228
pipefd[1] = -1;
292-
#elif UV__KQUEUE_EVFILT_USER
293-
uv_once(&kqueue_runtime_detection_guard, uv__kqueue_runtime_detection);
294-
if (kqueue_evfilt_user_support) {
295-
/* In order not to break the generic pattern of I/O polling, a valid
296-
* file descriptor is required to take up a room in loop->watchers,
297-
* thus we create one for that, but this fd will not be actually used,
298-
* it's just a placeholder and magic number which is going to be closed
299-
* during the cleanup, as other FDs. */
300-
err = uv__open_cloexec("/dev/null", O_RDONLY);
301-
if (err < 0)
302-
return err;
303-
304-
pipefd[0] = err;
305-
pipefd[1] = -1;
306-
307-
/* When using EVFILT_USER event to wake up the kqueue, this event must be
308-
* registered beforehand. Otherwise, calling kevent() to issue an
309-
* unregistered EVFILT_USER event will get an ENOENT.
310-
* Since uv__async_send() may happen before uv__io_poll() with multi-threads,
311-
* we can't defer this registration of EVFILT_USER event as we did for other
312-
* events, but must perform it right away. */
313-
EV_SET(&ev, err, EVFILT_USER, EV_ADD | EV_CLEAR, 0, 0, 0);
314-
err = kevent(loop->backend_fd, &ev, 1, NULL, 0, NULL);
315-
if (err < 0)
316-
return UV__ERR(errno);
317-
} else {
318-
err = uv__make_pipe(pipefd, UV_NONBLOCK_PIPE);
319-
if (err < 0)
320-
return err;
321-
}
322229
#else
323230
err = uv__make_pipe(pipefd, UV_NONBLOCK_PIPE);
324231
if (err < 0)
@@ -329,13 +236,6 @@ static int uv__async_start(uv_loop_t* loop) {
329236
uv__io_start(loop, &loop->async_io_watcher, POLLIN);
330237
loop->async_wfd = pipefd[1];
331238

332-
#if UV__KQUEUE_EVFILT_USER
333-
/* Prevent the EVFILT_USER event from being added to kqueue redundantly
334-
* and mistakenly later in uv__io_poll(). */
335-
if (kqueue_evfilt_user_support)
336-
loop->async_io_watcher.events = loop->async_io_watcher.pevents;
337-
#endif
338-
339239
return 0;
340240
}
341241

deps/uv/src/unix/internal.h

-22
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@
3535
#include <sys/socket.h>
3636
#include <sys/stat.h>
3737
#include <sys/types.h>
38-
#if defined(__APPLE__) || defined(__DragonFly__) || \
39-
defined(__FreeBSD__) || defined(__NetBSD__)
40-
#include <sys/event.h>
41-
#endif
4238

4339
#define uv__msan_unpoison(p, n) \
4440
do { \
@@ -508,22 +504,4 @@ int uv__get_constrained_cpu(uv__cpu_constraint* constraint);
508504
#endif
509505
#endif
510506

511-
#if defined(EVFILT_USER) && defined(NOTE_TRIGGER)
512-
/* EVFILT_USER is available since OS X 10.6, DragonFlyBSD 4.0,
513-
* FreeBSD 8.1, and NetBSD 10.0.
514-
*
515-
* Note that even though EVFILT_USER is defined on the current system,
516-
* it may still fail to work at runtime somehow. In that case, we fall
517-
* back to pipe-based signaling.
518-
*/
519-
#define UV__KQUEUE_EVFILT_USER 1
520-
/* Magic number of identifier used for EVFILT_USER during runtime detection.
521-
* There are no Google hits for this number when I create it. That way,
522-
* people will be directed here if this number gets printed due to some
523-
* kqueue error and they google for help. */
524-
#define UV__KQUEUE_EVFILT_USER_IDENT 0x1e7e7711
525-
#else
526-
#define UV__KQUEUE_EVFILT_USER 0
527-
#endif
528-
529507
#endif /* UV_UNIX_INTERNAL_H_ */

deps/uv/src/unix/kqueue.c

-11
Original file line numberDiff line numberDiff line change
@@ -367,17 +367,6 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
367367
continue;
368368
}
369369

370-
#if UV__KQUEUE_EVFILT_USER
371-
if (ev->filter == EVFILT_USER) {
372-
w = &loop->async_io_watcher;
373-
assert(fd == w->fd);
374-
uv__metrics_update_idle_time(loop);
375-
w->cb(loop, w, w->events);
376-
nevents++;
377-
continue;
378-
}
379-
#endif
380-
381370
if (ev->filter == EVFILT_VNODE) {
382371
assert(w->events == POLLIN);
383372
assert(w->pevents == POLLIN);

deps/uv/src/unix/linux.c

-6
Original file line numberDiff line numberDiff line change
@@ -1414,12 +1414,6 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
14141414

14151415
w->events = w->pevents;
14161416
e.events = w->pevents;
1417-
if (w == &loop->async_io_watcher)
1418-
/* Enable edge-triggered mode on async_io_watcher(eventfd),
1419-
* so that we're able to eliminate the overhead of reading
1420-
* the eventfd via system call on each event loop wakeup.
1421-
*/
1422-
e.events |= EPOLLET;
14231417
e.data.fd = w->fd;
14241418
fd = w->fd;
14251419

deps/uv/src/win/error.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ int uv_translate_sys_error(int sys_errno) {
6969
}
7070

7171
switch (sys_errno) {
72-
case ERROR_NOACCESS: return UV_EACCES;
7372
case WSAEACCES: return UV_EACCES;
7473
case ERROR_ELEVATION_REQUIRED: return UV_EACCES;
7574
case ERROR_CANT_ACCESS_FILE: return UV_EACCES;
@@ -96,7 +95,7 @@ int uv_translate_sys_error(int sys_errno) {
9695
case WSAECONNRESET: return UV_ECONNRESET;
9796
case ERROR_ALREADY_EXISTS: return UV_EEXIST;
9897
case ERROR_FILE_EXISTS: return UV_EEXIST;
99-
case ERROR_BUFFER_OVERFLOW: return UV_EFAULT;
98+
case ERROR_NOACCESS: return UV_EFAULT;
10099
case WSAEFAULT: return UV_EFAULT;
101100
case ERROR_HOST_UNREACHABLE: return UV_EHOSTUNREACH;
102101
case WSAEHOSTUNREACH: return UV_EHOSTUNREACH;
@@ -127,6 +126,7 @@ int uv_translate_sys_error(int sys_errno) {
127126
case ERROR_TOO_MANY_OPEN_FILES: return UV_EMFILE;
128127
case WSAEMFILE: return UV_EMFILE;
129128
case WSAEMSGSIZE: return UV_EMSGSIZE;
129+
case ERROR_BUFFER_OVERFLOW: return UV_ENAMETOOLONG;
130130
case ERROR_FILENAME_EXCED_RANGE: return UV_ENAMETOOLONG;
131131
case ERROR_NETWORK_UNREACHABLE: return UV_ENETUNREACH;
132132
case WSAENETUNREACH: return UV_ENETUNREACH;

deps/uv/src/win/fs.c

+9-8
Original file line numberDiff line numberDiff line change
@@ -2566,16 +2566,17 @@ static void fs__create_junction(uv_fs_t* req, const WCHAR* path,
25662566

25672567
path_buf[path_buf_len++] = path[i];
25682568
}
2569-
path_buf[path_buf_len++] = L'\\';
2569+
if (add_slash)
2570+
path_buf[path_buf_len++] = L'\\';
25702571
len = path_buf_len - start;
25712572

2573+
/* Insert null terminator */
2574+
path_buf[path_buf_len++] = L'\0';
2575+
25722576
/* Set the info about the substitute name */
25732577
buffer->MountPointReparseBuffer.SubstituteNameOffset = start * sizeof(WCHAR);
25742578
buffer->MountPointReparseBuffer.SubstituteNameLength = len * sizeof(WCHAR);
25752579

2576-
/* Insert null terminator */
2577-
path_buf[path_buf_len++] = L'\0';
2578-
25792580
/* Copy the print name of the target path */
25802581
start = path_buf_len;
25812582
add_slash = 0;
@@ -2593,18 +2594,18 @@ static void fs__create_junction(uv_fs_t* req, const WCHAR* path,
25932594
path_buf[path_buf_len++] = path[i];
25942595
}
25952596
len = path_buf_len - start;
2596-
if (len == 2) {
2597+
if (len == 2 || add_slash) {
25972598
path_buf[path_buf_len++] = L'\\';
25982599
len++;
25992600
}
26002601

2602+
/* Insert another null terminator */
2603+
path_buf[path_buf_len++] = L'\0';
2604+
26012605
/* Set the info about the print name */
26022606
buffer->MountPointReparseBuffer.PrintNameOffset = start * sizeof(WCHAR);
26032607
buffer->MountPointReparseBuffer.PrintNameLength = len * sizeof(WCHAR);
26042608

2605-
/* Insert another null terminator */
2606-
path_buf[path_buf_len++] = L'\0';
2607-
26082609
/* Calculate how much buffer space was actually used */
26092610
used_buf_size = FIELD_OFFSET(REPARSE_DATA_BUFFER, MountPointReparseBuffer.PathBuffer) +
26102611
path_buf_len * sizeof(WCHAR);

deps/uv/src/win/getaddrinfo.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,9 @@ static void uv__getaddrinfo_done(struct uv__work* w, int status) {
191191
if (addrinfow_ptr == NULL)
192192
break;
193193
cur_off = align_offset(cur_off, sizeof(void *));
194-
addrinfo_ptr = (struct addrinfo *)(alloc_ptr + cur_off);
195-
addrinfo_ptr->ai_next = addrinfo_ptr;
194+
struct addrinfo *next_addrinfo_ptr = (struct addrinfo *)(alloc_ptr + cur_off);
195+
addrinfo_ptr->ai_next = next_addrinfo_ptr;
196+
addrinfo_ptr = next_addrinfo_ptr;
196197
}
197198
req->addrinfo = (struct addrinfo*)alloc_ptr;
198199
} else {

0 commit comments

Comments
 (0)