Skip to content

Commit af92317

Browse files
cjihrignodejs-github-bot
authored andcommittedSep 27, 2020
deps: upgrade to libuv 1.40.0
Notable changes: - The UV_UDP_MMSG_FREE flag has been added. - UV__EPROTO has been remapped from 4046 to -4046 for consistency with other error codes. - On Windows, UTF-16 surrogate pairs are no longer replaced with the Unicode replacement character. - uv_timer_get_due_in() has been added. PR-URL: nodejs#35333 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Jiawen Geng <[email protected]>
1 parent b15ed65 commit af92317

31 files changed

+390
-114
lines changed
 

‎deps/uv/AUTHORS

+5
Original file line numberDiff line numberDiff line change
@@ -443,3 +443,8 @@ escherstair <ernestviga@gmail.com>
443443
Evan Lucas <evanlucas@me.com>
444444
tjarlama <59913901+tjarlama@users.noreply.github.com>
445445
司徒玟琅 <sanjusss@qq.com>
446+
YuMeiJie <yumeijie@huawei.com>
447+
Aleksej Lebedev <root@zta.lk>
448+
Nikolay Mitev <github@hmel.org>
449+
Ulrik Strid <ulrik.strid@outlook.com>
450+
Elad Lahav <elahav@qnx.com>

‎deps/uv/CMakeLists.txt

+27-2
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ if(WIN32)
146146
list(APPEND uv_test_sources src/win/snprintf.c test/runner-win.c)
147147
else()
148148
list(APPEND uv_defines _FILE_OFFSET_BITS=64 _LARGEFILE_SOURCE)
149-
if(NOT CMAKE_SYSTEM_NAME MATCHES "Android|OS390")
149+
if(NOT CMAKE_SYSTEM_NAME MATCHES "Android|OS390|QNX")
150150
# TODO: This should be replaced with find_package(Threads) if possible
151151
# Android has pthread as part of its c library, not as a separate
152152
# libpthread.so.
@@ -298,6 +298,30 @@ if(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
298298
list(APPEND uv_sources src/unix/no-proctitle.c src/unix/sunos.c)
299299
endif()
300300

301+
if(CMAKE_SYSTEM_NAME STREQUAL "Haiku")
302+
list(APPEND uv_defines _BSD_SOURCE)
303+
list(APPEND uv_libraries bsd network)
304+
list(APPEND uv_sources
305+
src/unix/haiku.c
306+
src/unix/bsd-ifaddrs.c
307+
src/unix/no-fsevents.c
308+
src/unix/no-proctitle.c
309+
src/unix/posix-hrtime.c
310+
src/unix/posix-poll.c)
311+
endif()
312+
313+
if(CMAKE_SYSTEM_NAME STREQUAL "QNX")
314+
list(APPEND uv_sources
315+
src/unix/posix-hrtime.c
316+
src/unix/posix-poll.c
317+
src/unix/qnx.c
318+
src/unix/bsd-ifaddrs.c
319+
src/unix/no-proctitle.c
320+
src/unix/no-fsevents.c)
321+
list(APPEND uv_cflags -fno-strict-aliasing)
322+
list(APPEND uv_libraries socket)
323+
endif()
324+
301325
if(APPLE OR CMAKE_SYSTEM_NAME MATCHES "DragonFly|FreeBSD|Linux|NetBSD|OpenBSD")
302326
list(APPEND uv_test_libraries util)
303327
endif()
@@ -568,10 +592,11 @@ if(UNIX OR MINGW)
568592
set(libdir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
569593
set(prefix ${CMAKE_INSTALL_PREFIX})
570594
configure_file(libuv.pc.in libuv.pc @ONLY)
595+
configure_file(libuv-static.pc.in libuv-static.pc @ONLY)
571596

572597
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
573598
install(FILES LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR})
574-
install(FILES ${PROJECT_BINARY_DIR}/libuv.pc
599+
install(FILES ${PROJECT_BINARY_DIR}/libuv.pc ${PROJECT_BINARY_DIR}/libuv-static.pc
575600
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
576601
install(TARGETS uv LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
577602
install(TARGETS uv_a ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})

‎deps/uv/ChangeLog

+35
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,38 @@
1+
2020.09.26, Version 1.40.0 (Stable), 4e69e333252693bd82d6338d6124f0416538dbfc
2+
3+
Changes since version 1.39.0:
4+
5+
* udp: add UV_UDP_MMSG_FREE recv_cb flag (Ryan Liptak)
6+
7+
* include: re-map UV__EPROTO from 4046 to -4046 (YuMeiJie)
8+
9+
* doc: correct UV_UDP_MMSG_FREE version added (cjihrig)
10+
11+
* doc: add uv_metrics_idle_time() version metadata (Ryan Liptak)
12+
13+
* win,tty: pass through utf-16 surrogate pairs (Mustafa M)
14+
15+
* unix: fix DragonFly BSD build (Aleksej Lebedev)
16+
17+
* win,udp: fix error code returned by connect() (Santiago Gimeno)
18+
19+
* src: suppress user_timeout maybe-uninitialized (Daniel Bevenius)
20+
21+
* test: fix compiler warning (Vladimír Čunát)
22+
23+
* build: fix the Haiku cmake build (David Carlier)
24+
25+
* linux: fix i386 sendmmsg/recvmmsg support (Ben Noordhuis)
26+
27+
* build: add libuv-static pkg-config file (Nikolay Mitev)
28+
29+
* unix,win: add uv_timer_get_due_in() (Ulrik Strid)
30+
31+
* build,unix: add QNX support (Elad Lahav)
32+
33+
* include: remove incorrect UV__ERR() for EPROTO (cjihrig)
34+
35+
136
2020.08.26, Version 1.39.0 (Stable), 25f4b8b8a3c0f934158cd37a37b0525d75ca488e
237

338
Changes since version 1.38.1:

‎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.39.0], [https://github.com/libuv/libuv/issues])
16+
AC_INIT([libuv], [1.40.0], [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/docs/src/loop.rst

+2
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ API
7373

7474
This option is necessary to use :c:func:`uv_metrics_idle_time`.
7575

76+
.. versionchanged:: 1.39.0 added the UV_METRICS_IDLE_TIME option.
77+
7678
.. c:function:: int uv_loop_close(uv_loop_t* loop)
7779
7880
Releases all internal loop resources. Call this function only when the loop

‎deps/uv/docs/src/metrics.rst

+2
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,5 @@ API
2323
The event loop will not begin accumulating the event provider's idle
2424
time until calling :c:type:`uv_loop_configure` with
2525
:c:type:`UV_METRICS_IDLE_TIME`.
26+
27+
.. versionadded:: 1.39.0

‎deps/uv/docs/src/timer.rst

+7
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,11 @@ API
7878
7979
Get the timer repeat value.
8080
81+
.. c:function:: uint64_t uv_timer_get_due_in(const uv_timer_t* handle)
82+
83+
Get the timer due value or 0 if it has expired. The time is relative to
84+
:c:func:`uv_now()`.
85+
86+
.. versionadded:: 1.40.0
87+
8188
.. seealso:: The :c:type:`uv_handle_t` API functions also apply.

‎deps/uv/docs/src/udp.rst

+11-3
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ Data types
4747
* must not be freed by the recv_cb callback.
4848
*/
4949
UV_UDP_MMSG_CHUNK = 8,
50+
/*
51+
* Indicates that the buffer provided has been fully utilized by recvmmsg and
52+
* that it should now be freed by the recv_cb callback. When this flag is set
53+
* in uv_udp_recv_cb, nread will always be 0 and addr will always be NULL.
54+
*/
55+
UV_UDP_MMSG_FREE = 16,
5056
/*
5157
* Indicates that recvmmsg should be used, if available.
5258
*/
@@ -80,8 +86,10 @@ Data types
8086
When using :man:`recvmmsg(2)`, chunks will have the `UV_UDP_MMSG_CHUNK` flag set,
8187
those must not be freed. There will be a final callback with `nread` set to 0,
8288
`addr` set to NULL and the buffer pointing at the initially allocated data with
83-
the `UV_UDP_MMSG_CHUNK` flag cleared. This is a good chance for the callee to
84-
free the provided buffer.
89+
the `UV_UDP_MMSG_CHUNK` flag cleared and the `UV_UDP_MMSG_FREE` flag set.
90+
The callee can now safely free the provided buffer.
91+
92+
.. versionchanged:: 1.40.0 added the `UV_UDP_MMSG_FREE` flag.
8593

8694
.. note::
8795
The receive callback will be called with `nread` == 0 and `addr` == NULL when there is
@@ -392,7 +400,7 @@ API
392400
it must be explicitly requested by passing the `UV_UDP_RECVMMSG` flag to
393401
:c:func:`uv_udp_init_ex`.
394402
.. versionchanged:: 1.39.0 :c:func:`uv_udp_using_recvmmsg` can be used in `alloc_cb` to
395-
determine if a buffer sized for use with :man:`recvmmsg(2)` should be
403+
determine if a buffer sized for use with :man:`recvmmsg(2)` should be
396404
allocated for the current handle/platform.
397405
398406
.. c:function:: int uv_udp_using_recvmmsg(uv_udp_t* handle)

‎deps/uv/include/uv.h

+7
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,12 @@ enum uv_udp_flags {
614614
* must not be freed by the recv_cb callback.
615615
*/
616616
UV_UDP_MMSG_CHUNK = 8,
617+
/*
618+
* Indicates that the buffer provided has been fully utilized by recvmmsg and
619+
* that it should now be freed by the recv_cb callback. When this flag is set
620+
* in uv_udp_recv_cb, nread will always be 0 and addr will always be NULL.
621+
*/
622+
UV_UDP_MMSG_FREE = 16,
617623

618624
/*
619625
* Indicates that recvmmsg should be used, if available.
@@ -865,6 +871,7 @@ UV_EXTERN int uv_timer_stop(uv_timer_t* handle);
865871
UV_EXTERN int uv_timer_again(uv_timer_t* handle);
866872
UV_EXTERN void uv_timer_set_repeat(uv_timer_t* handle, uint64_t repeat);
867873
UV_EXTERN uint64_t uv_timer_get_repeat(const uv_timer_t* handle);
874+
UV_EXTERN uint64_t uv_timer_get_due_in(const uv_timer_t* handle);
868875

869876

870877
/*

‎deps/uv/include/uv/errno.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@
317317
#if defined(EPROTO) && !defined(_WIN32)
318318
# define UV__EPROTO UV__ERR(EPROTO)
319319
#else
320-
# define UV__EPROTO UV__ERR(4046)
320+
# define UV__EPROTO (-4046)
321321
#endif
322322

323323
#if defined(EPROTONOSUPPORT) && !defined(_WIN32)

‎deps/uv/include/uv/unix.h

+2
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@
6969
# include "uv/posix.h"
7070
#elif defined(__HAIKU__)
7171
# include "uv/posix.h"
72+
#elif defined(__QNX__)
73+
# include "uv/posix.h"
7274
#endif
7375

7476
#ifndef NI_MAXHOST

‎deps/uv/include/uv/version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
*/
3232

3333
#define UV_VERSION_MAJOR 1
34-
#define UV_VERSION_MINOR 39
34+
#define UV_VERSION_MINOR 40
3535
#define UV_VERSION_PATCH 0
3636
#define UV_VERSION_IS_RELEASE 1
3737
#define UV_VERSION_SUFFIX ""

‎deps/uv/libuv-static.pc.in

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
prefix=@prefix@
2+
exec_prefix=${prefix}
3+
libdir=@libdir@
4+
includedir=@includedir@
5+
6+
Name: libuv-static
7+
Version: @PACKAGE_VERSION@
8+
Description: multi-platform support library with a focus on asynchronous I/O.
9+
URL: http://libuv.org/
10+
11+
Libs: -L${libdir} -luv_a @LIBS@
12+
Cflags: -I${includedir}

‎deps/uv/src/random.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ static int uv__random(void* buf, size_t buflen) {
3333

3434
#if defined(__PASE__)
3535
rc = uv__random_readpath("/dev/urandom", buf, buflen);
36-
#elif defined(_AIX)
36+
#elif defined(_AIX) || defined(__QNX__)
3737
rc = uv__random_readpath("/dev/random", buf, buflen);
3838
#elif defined(__APPLE__) || defined(__OpenBSD__) || \
3939
(defined(__ANDROID_API__) && __ANDROID_API__ >= 28)

‎deps/uv/src/timer.c

+8
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,14 @@ uint64_t uv_timer_get_repeat(const uv_timer_t* handle) {
130130
}
131131

132132

133+
uint64_t uv_timer_get_due_in(const uv_timer_t* handle) {
134+
if (handle->loop->time >= handle->timeout)
135+
return 0;
136+
137+
return handle->timeout - handle->loop->time;
138+
}
139+
140+
133141
int uv__next_timeout(const uv_loop_t* loop) {
134142
const struct heap_node* heap_node;
135143
const uv_timer_t* handle;

‎deps/uv/src/unix/bsd-ifaddrs.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,9 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
113113
address->address.address4 = *((struct sockaddr_in*) ent->ifa_addr);
114114
}
115115

116-
if (ent->ifa_netmask->sa_family == AF_INET6) {
116+
if (ent->ifa_netmask == NULL) {
117+
memset(&address->netmask, 0, sizeof(address->netmask));
118+
} else if (ent->ifa_netmask->sa_family == AF_INET6) {
117119
address->netmask.netmask6 = *((struct sockaddr_in6*) ent->ifa_netmask);
118120
} else {
119121
address->netmask.netmask4 = *((struct sockaddr_in*) ent->ifa_netmask);

‎deps/uv/src/unix/freebsd.c

+4-37
Original file line numberDiff line numberDiff line change
@@ -56,31 +56,6 @@ int uv__platform_loop_init(uv_loop_t* loop) {
5656
void uv__platform_loop_delete(uv_loop_t* loop) {
5757
}
5858

59-
60-
#ifdef __DragonFly__
61-
int uv_exepath(char* buffer, size_t* size) {
62-
char abspath[PATH_MAX * 2 + 1];
63-
ssize_t abspath_size;
64-
65-
if (buffer == NULL || size == NULL || *size == 0)
66-
return UV_EINVAL;
67-
68-
abspath_size = readlink("/proc/curproc/file", abspath, sizeof(abspath));
69-
if (abspath_size < 0)
70-
return UV__ERR(errno);
71-
72-
assert(abspath_size > 0);
73-
*size -= 1;
74-
75-
if (*size > abspath_size)
76-
*size = abspath_size;
77-
78-
memcpy(buffer, abspath, *size);
79-
buffer[*size] = '\0';
80-
81-
return 0;
82-
}
83-
#else
8459
int uv_exepath(char* buffer, size_t* size) {
8560
char abspath[PATH_MAX * 2 + 1];
8661
int mib[4];
@@ -110,7 +85,6 @@ int uv_exepath(char* buffer, size_t* size) {
11085

11186
return 0;
11287
}
113-
#endif
11488

11589
uint64_t uv_get_free_memory(void) {
11690
int freecount;
@@ -290,25 +264,18 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
290264
}
291265

292266

293-
int uv__sendmmsg(int fd,
294-
struct uv__mmsghdr* mmsg,
295-
unsigned int vlen,
296-
unsigned int flags) {
267+
int uv__sendmmsg(int fd, struct uv__mmsghdr* mmsg, unsigned int vlen) {
297268
#if __FreeBSD__ >= 11
298-
return sendmmsg(fd, mmsg, vlen, flags);
269+
return sendmmsg(fd, mmsg, vlen, /* flags */ 0);
299270
#else
300271
return errno = ENOSYS, -1;
301272
#endif
302273
}
303274

304275

305-
int uv__recvmmsg(int fd,
306-
struct uv__mmsghdr* mmsg,
307-
unsigned int vlen,
308-
unsigned int flags,
309-
struct timespec* timeout) {
276+
int uv__recvmmsg(int fd, struct uv__mmsghdr* mmsg, unsigned int vlen) {
310277
#if __FreeBSD__ >= 11
311-
return recvmmsg(fd, mmsg, vlen, flags, timeout);
278+
return recvmmsg(fd, mmsg, vlen, 0 /* flags */, NULL /* timeout */);
312279
#else
313280
return errno = ENOSYS, -1;
314281
#endif

‎deps/uv/src/unix/fs.c

+16-3
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,11 @@
7979
defined(__NetBSD__)
8080
# include <sys/param.h>
8181
# include <sys/mount.h>
82-
#elif defined(__sun) || defined(__MVS__) || defined(__NetBSD__) || defined(__HAIKU__)
82+
#elif defined(__sun) || \
83+
defined(__MVS__) || \
84+
defined(__NetBSD__) || \
85+
defined(__HAIKU__) || \
86+
defined(__QNX__)
8387
# include <sys/statvfs.h>
8488
#else
8589
# include <sys/statfs.h>
@@ -629,7 +633,11 @@ static int uv__fs_closedir(uv_fs_t* req) {
629633

630634
static int uv__fs_statfs(uv_fs_t* req) {
631635
uv_statfs_t* stat_fs;
632-
#if defined(__sun) || defined(__MVS__) || defined(__NetBSD__) || defined(__HAIKU__)
636+
#if defined(__sun) || \
637+
defined(__MVS__) || \
638+
defined(__NetBSD__) || \
639+
defined(__HAIKU__) || \
640+
defined(__QNX__)
633641
struct statvfs buf;
634642

635643
if (0 != statvfs(req->path, &buf))
@@ -646,7 +654,12 @@ static int uv__fs_statfs(uv_fs_t* req) {
646654
return -1;
647655
}
648656

649-
#if defined(__sun) || defined(__MVS__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__)
657+
#if defined(__sun) || \
658+
defined(__MVS__) || \
659+
defined(__OpenBSD__) || \
660+
defined(__NetBSD__) || \
661+
defined(__HAIKU__) || \
662+
defined(__QNX__)
650663
stat_fs->f_type = 0; /* f_type is not supported. */
651664
#else
652665
stat_fs->f_type = buf.f_type;

‎deps/uv/src/unix/internal.h

+2-9
Original file line numberDiff line numberDiff line change
@@ -334,15 +334,8 @@ struct uv__mmsghdr {
334334
unsigned int msg_len;
335335
};
336336

337-
int uv__recvmmsg(int fd,
338-
struct uv__mmsghdr* mmsg,
339-
unsigned int vlen,
340-
unsigned int flags,
341-
struct timespec* timeout);
342-
int uv__sendmmsg(int fd,
343-
struct uv__mmsghdr* mmsg,
344-
unsigned int vlen,
345-
unsigned int flags);
337+
int uv__recvmmsg(int fd, struct uv__mmsghdr* mmsg, unsigned int vlen);
338+
int uv__sendmmsg(int fd, struct uv__mmsghdr* mmsg, unsigned int vlen);
346339
#else
347340
#define HAVE_MMSG 0
348341
#endif

0 commit comments

Comments
 (0)
Please sign in to comment.