Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: upgrade to libuv 1.40.0 #35333

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions deps/uv/AUTHORS
Expand Up @@ -443,3 +443,8 @@ escherstair <ernestviga@gmail.com>
Evan Lucas <evanlucas@me.com>
tjarlama <59913901+tjarlama@users.noreply.github.com>
司徒玟琅 <sanjusss@qq.com>
YuMeiJie <yumeijie@huawei.com>
Aleksej Lebedev <root@zta.lk>
Nikolay Mitev <github@hmel.org>
Ulrik Strid <ulrik.strid@outlook.com>
Elad Lahav <elahav@qnx.com>
29 changes: 27 additions & 2 deletions deps/uv/CMakeLists.txt
Expand Up @@ -146,7 +146,7 @@ if(WIN32)
list(APPEND uv_test_sources src/win/snprintf.c test/runner-win.c)
else()
list(APPEND uv_defines _FILE_OFFSET_BITS=64 _LARGEFILE_SOURCE)
if(NOT CMAKE_SYSTEM_NAME MATCHES "Android|OS390")
if(NOT CMAKE_SYSTEM_NAME MATCHES "Android|OS390|QNX")
# TODO: This should be replaced with find_package(Threads) if possible
# Android has pthread as part of its c library, not as a separate
# libpthread.so.
Expand Down Expand Up @@ -298,6 +298,30 @@ if(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
list(APPEND uv_sources src/unix/no-proctitle.c src/unix/sunos.c)
endif()

if(CMAKE_SYSTEM_NAME STREQUAL "Haiku")
list(APPEND uv_defines _BSD_SOURCE)
list(APPEND uv_libraries bsd network)
list(APPEND uv_sources
src/unix/haiku.c
src/unix/bsd-ifaddrs.c
src/unix/no-fsevents.c
src/unix/no-proctitle.c
src/unix/posix-hrtime.c
src/unix/posix-poll.c)
endif()

if(CMAKE_SYSTEM_NAME STREQUAL "QNX")
list(APPEND uv_sources
src/unix/posix-hrtime.c
src/unix/posix-poll.c
src/unix/qnx.c
src/unix/bsd-ifaddrs.c
src/unix/no-proctitle.c
src/unix/no-fsevents.c)
list(APPEND uv_cflags -fno-strict-aliasing)
list(APPEND uv_libraries socket)
endif()

if(APPLE OR CMAKE_SYSTEM_NAME MATCHES "DragonFly|FreeBSD|Linux|NetBSD|OpenBSD")
list(APPEND uv_test_libraries util)
endif()
Expand Down Expand Up @@ -568,10 +592,11 @@ if(UNIX OR MINGW)
set(libdir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
set(prefix ${CMAKE_INSTALL_PREFIX})
configure_file(libuv.pc.in libuv.pc @ONLY)
configure_file(libuv-static.pc.in libuv-static.pc @ONLY)

install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(FILES LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR})
install(FILES ${PROJECT_BINARY_DIR}/libuv.pc
install(FILES ${PROJECT_BINARY_DIR}/libuv.pc ${PROJECT_BINARY_DIR}/libuv-static.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
install(TARGETS uv LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(TARGETS uv_a ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
Expand Down
35 changes: 35 additions & 0 deletions deps/uv/ChangeLog
@@ -1,3 +1,38 @@
2020.09.26, Version 1.40.0 (Stable), 4e69e333252693bd82d6338d6124f0416538dbfc

Changes since version 1.39.0:

* udp: add UV_UDP_MMSG_FREE recv_cb flag (Ryan Liptak)

* include: re-map UV__EPROTO from 4046 to -4046 (YuMeiJie)

* doc: correct UV_UDP_MMSG_FREE version added (cjihrig)

* doc: add uv_metrics_idle_time() version metadata (Ryan Liptak)

* win,tty: pass through utf-16 surrogate pairs (Mustafa M)

* unix: fix DragonFly BSD build (Aleksej Lebedev)

* win,udp: fix error code returned by connect() (Santiago Gimeno)

* src: suppress user_timeout maybe-uninitialized (Daniel Bevenius)

* test: fix compiler warning (Vladimír Čunát)

* build: fix the Haiku cmake build (David Carlier)

* linux: fix i386 sendmmsg/recvmmsg support (Ben Noordhuis)

* build: add libuv-static pkg-config file (Nikolay Mitev)

* unix,win: add uv_timer_get_due_in() (Ulrik Strid)

* build,unix: add QNX support (Elad Lahav)

* include: remove incorrect UV__ERR() for EPROTO (cjihrig)


2020.08.26, Version 1.39.0 (Stable), 25f4b8b8a3c0f934158cd37a37b0525d75ca488e

Changes since version 1.38.1:
Expand Down
2 changes: 1 addition & 1 deletion deps/uv/configure.ac
Expand Up @@ -13,7 +13,7 @@
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

AC_PREREQ(2.57)
AC_INIT([libuv], [1.39.0], [https://github.com/libuv/libuv/issues])
AC_INIT([libuv], [1.40.0], [https://github.com/libuv/libuv/issues])
AC_CONFIG_MACRO_DIR([m4])
m4_include([m4/libuv-extra-automake-flags.m4])
m4_include([m4/as_case.m4])
Expand Down
2 changes: 2 additions & 0 deletions deps/uv/docs/src/loop.rst
Expand Up @@ -73,6 +73,8 @@ API

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

.. versionchanged:: 1.39.0 added the UV_METRICS_IDLE_TIME option.

.. c:function:: int uv_loop_close(uv_loop_t* loop)

Releases all internal loop resources. Call this function only when the loop
Expand Down
2 changes: 2 additions & 0 deletions deps/uv/docs/src/metrics.rst
Expand Up @@ -23,3 +23,5 @@ API
The event loop will not begin accumulating the event provider's idle
time until calling :c:type:`uv_loop_configure` with
:c:type:`UV_METRICS_IDLE_TIME`.

.. versionadded:: 1.39.0
7 changes: 7 additions & 0 deletions deps/uv/docs/src/timer.rst
Expand Up @@ -78,4 +78,11 @@ API

Get the timer repeat value.

.. c:function:: uint64_t uv_timer_get_due_in(const uv_timer_t* handle)

Get the timer due value or 0 if it has expired. The time is relative to
:c:func:`uv_now()`.

.. versionadded:: 1.40.0

.. seealso:: The :c:type:`uv_handle_t` API functions also apply.
14 changes: 11 additions & 3 deletions deps/uv/docs/src/udp.rst
Expand Up @@ -47,6 +47,12 @@ Data types
* must not be freed by the recv_cb callback.
*/
UV_UDP_MMSG_CHUNK = 8,
/*
* Indicates that the buffer provided has been fully utilized by recvmmsg and
* that it should now be freed by the recv_cb callback. When this flag is set
* in uv_udp_recv_cb, nread will always be 0 and addr will always be NULL.
*/
UV_UDP_MMSG_FREE = 16,
/*
* Indicates that recvmmsg should be used, if available.
*/
Expand Down Expand Up @@ -80,8 +86,10 @@ Data types
When using :man:`recvmmsg(2)`, chunks will have the `UV_UDP_MMSG_CHUNK` flag set,
those must not be freed. There will be a final callback with `nread` set to 0,
`addr` set to NULL and the buffer pointing at the initially allocated data with
the `UV_UDP_MMSG_CHUNK` flag cleared. This is a good chance for the callee to
free the provided buffer.
the `UV_UDP_MMSG_CHUNK` flag cleared and the `UV_UDP_MMSG_FREE` flag set.
The callee can now safely free the provided buffer.

.. versionchanged:: 1.40.0 added the `UV_UDP_MMSG_FREE` flag.

.. note::
The receive callback will be called with `nread` == 0 and `addr` == NULL when there is
Expand Down Expand Up @@ -392,7 +400,7 @@ API
it must be explicitly requested by passing the `UV_UDP_RECVMMSG` flag to
:c:func:`uv_udp_init_ex`.
.. versionchanged:: 1.39.0 :c:func:`uv_udp_using_recvmmsg` can be used in `alloc_cb` to
determine if a buffer sized for use with :man:`recvmmsg(2)` should be
determine if a buffer sized for use with :man:`recvmmsg(2)` should be
allocated for the current handle/platform.

.. c:function:: int uv_udp_using_recvmmsg(uv_udp_t* handle)
Expand Down
7 changes: 7 additions & 0 deletions deps/uv/include/uv.h
Expand Up @@ -614,6 +614,12 @@ enum uv_udp_flags {
* must not be freed by the recv_cb callback.
*/
UV_UDP_MMSG_CHUNK = 8,
/*
* Indicates that the buffer provided has been fully utilized by recvmmsg and
* that it should now be freed by the recv_cb callback. When this flag is set
* in uv_udp_recv_cb, nread will always be 0 and addr will always be NULL.
*/
UV_UDP_MMSG_FREE = 16,

/*
* Indicates that recvmmsg should be used, if available.
Expand Down Expand Up @@ -865,6 +871,7 @@ UV_EXTERN int uv_timer_stop(uv_timer_t* handle);
UV_EXTERN int uv_timer_again(uv_timer_t* handle);
UV_EXTERN void uv_timer_set_repeat(uv_timer_t* handle, uint64_t repeat);
UV_EXTERN uint64_t uv_timer_get_repeat(const uv_timer_t* handle);
UV_EXTERN uint64_t uv_timer_get_due_in(const uv_timer_t* handle);


/*
Expand Down
2 changes: 1 addition & 1 deletion deps/uv/include/uv/errno.h
Expand Up @@ -317,7 +317,7 @@
#if defined(EPROTO) && !defined(_WIN32)
# define UV__EPROTO UV__ERR(EPROTO)
#else
# define UV__EPROTO UV__ERR(4046)
# define UV__EPROTO (-4046)
#endif

#if defined(EPROTONOSUPPORT) && !defined(_WIN32)
Expand Down
2 changes: 2 additions & 0 deletions deps/uv/include/uv/unix.h
Expand Up @@ -69,6 +69,8 @@
# include "uv/posix.h"
#elif defined(__HAIKU__)
# include "uv/posix.h"
#elif defined(__QNX__)
# include "uv/posix.h"
#endif

#ifndef NI_MAXHOST
Expand Down
2 changes: 1 addition & 1 deletion deps/uv/include/uv/version.h
Expand Up @@ -31,7 +31,7 @@
*/

#define UV_VERSION_MAJOR 1
#define UV_VERSION_MINOR 39
#define UV_VERSION_MINOR 40
#define UV_VERSION_PATCH 0
#define UV_VERSION_IS_RELEASE 1
#define UV_VERSION_SUFFIX ""
Expand Down
12 changes: 12 additions & 0 deletions deps/uv/libuv-static.pc.in
@@ -0,0 +1,12 @@
prefix=@prefix@
exec_prefix=${prefix}
libdir=@libdir@
includedir=@includedir@

Name: libuv-static
Version: @PACKAGE_VERSION@
Description: multi-platform support library with a focus on asynchronous I/O.
URL: http://libuv.org/

Libs: -L${libdir} -luv_a @LIBS@
Cflags: -I${includedir}
2 changes: 1 addition & 1 deletion deps/uv/src/random.c
Expand Up @@ -33,7 +33,7 @@ static int uv__random(void* buf, size_t buflen) {

#if defined(__PASE__)
rc = uv__random_readpath("/dev/urandom", buf, buflen);
#elif defined(_AIX)
#elif defined(_AIX) || defined(__QNX__)
rc = uv__random_readpath("/dev/random", buf, buflen);
#elif defined(__APPLE__) || defined(__OpenBSD__) || \
(defined(__ANDROID_API__) && __ANDROID_API__ >= 28)
Expand Down
8 changes: 8 additions & 0 deletions deps/uv/src/timer.c
Expand Up @@ -130,6 +130,14 @@ uint64_t uv_timer_get_repeat(const uv_timer_t* handle) {
}


uint64_t uv_timer_get_due_in(const uv_timer_t* handle) {
if (handle->loop->time >= handle->timeout)
return 0;

return handle->timeout - handle->loop->time;
}


int uv__next_timeout(const uv_loop_t* loop) {
const struct heap_node* heap_node;
const uv_timer_t* handle;
Expand Down
4 changes: 3 additions & 1 deletion deps/uv/src/unix/bsd-ifaddrs.c
Expand Up @@ -113,7 +113,9 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
address->address.address4 = *((struct sockaddr_in*) ent->ifa_addr);
}

if (ent->ifa_netmask->sa_family == AF_INET6) {
if (ent->ifa_netmask == NULL) {
memset(&address->netmask, 0, sizeof(address->netmask));
} else if (ent->ifa_netmask->sa_family == AF_INET6) {
address->netmask.netmask6 = *((struct sockaddr_in6*) ent->ifa_netmask);
} else {
address->netmask.netmask4 = *((struct sockaddr_in*) ent->ifa_netmask);
Expand Down
41 changes: 4 additions & 37 deletions deps/uv/src/unix/freebsd.c
Expand Up @@ -56,31 +56,6 @@ int uv__platform_loop_init(uv_loop_t* loop) {
void uv__platform_loop_delete(uv_loop_t* loop) {
}


#ifdef __DragonFly__
int uv_exepath(char* buffer, size_t* size) {
char abspath[PATH_MAX * 2 + 1];
ssize_t abspath_size;

if (buffer == NULL || size == NULL || *size == 0)
return UV_EINVAL;

abspath_size = readlink("/proc/curproc/file", abspath, sizeof(abspath));
if (abspath_size < 0)
return UV__ERR(errno);

assert(abspath_size > 0);
*size -= 1;

if (*size > abspath_size)
*size = abspath_size;

memcpy(buffer, abspath, *size);
buffer[*size] = '\0';

return 0;
}
#else
int uv_exepath(char* buffer, size_t* size) {
char abspath[PATH_MAX * 2 + 1];
int mib[4];
Expand Down Expand Up @@ -110,7 +85,6 @@ int uv_exepath(char* buffer, size_t* size) {

return 0;
}
#endif

uint64_t uv_get_free_memory(void) {
int freecount;
Expand Down Expand Up @@ -290,25 +264,18 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
}


int uv__sendmmsg(int fd,
struct uv__mmsghdr* mmsg,
unsigned int vlen,
unsigned int flags) {
int uv__sendmmsg(int fd, struct uv__mmsghdr* mmsg, unsigned int vlen) {
#if __FreeBSD__ >= 11
return sendmmsg(fd, mmsg, vlen, flags);
return sendmmsg(fd, mmsg, vlen, /* flags */ 0);
#else
return errno = ENOSYS, -1;
#endif
}


int uv__recvmmsg(int fd,
struct uv__mmsghdr* mmsg,
unsigned int vlen,
unsigned int flags,
struct timespec* timeout) {
int uv__recvmmsg(int fd, struct uv__mmsghdr* mmsg, unsigned int vlen) {
#if __FreeBSD__ >= 11
return recvmmsg(fd, mmsg, vlen, flags, timeout);
return recvmmsg(fd, mmsg, vlen, 0 /* flags */, NULL /* timeout */);
#else
return errno = ENOSYS, -1;
#endif
Expand Down
19 changes: 16 additions & 3 deletions deps/uv/src/unix/fs.c
Expand Up @@ -79,7 +79,11 @@
defined(__NetBSD__)
# include <sys/param.h>
# include <sys/mount.h>
#elif defined(__sun) || defined(__MVS__) || defined(__NetBSD__) || defined(__HAIKU__)
#elif defined(__sun) || \
defined(__MVS__) || \
defined(__NetBSD__) || \
defined(__HAIKU__) || \
defined(__QNX__)
# include <sys/statvfs.h>
#else
# include <sys/statfs.h>
Expand Down Expand Up @@ -629,7 +633,11 @@ static int uv__fs_closedir(uv_fs_t* req) {

static int uv__fs_statfs(uv_fs_t* req) {
uv_statfs_t* stat_fs;
#if defined(__sun) || defined(__MVS__) || defined(__NetBSD__) || defined(__HAIKU__)
#if defined(__sun) || \
defined(__MVS__) || \
defined(__NetBSD__) || \
defined(__HAIKU__) || \
defined(__QNX__)
struct statvfs buf;

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

#if defined(__sun) || defined(__MVS__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__)
#if defined(__sun) || \
defined(__MVS__) || \
defined(__OpenBSD__) || \
defined(__NetBSD__) || \
defined(__HAIKU__) || \
defined(__QNX__)
stat_fs->f_type = 0; /* f_type is not supported. */
#else
stat_fs->f_type = buf.f_type;
Expand Down
11 changes: 2 additions & 9 deletions deps/uv/src/unix/internal.h
Expand Up @@ -334,15 +334,8 @@ struct uv__mmsghdr {
unsigned int msg_len;
};

int uv__recvmmsg(int fd,
struct uv__mmsghdr* mmsg,
unsigned int vlen,
unsigned int flags,
struct timespec* timeout);
int uv__sendmmsg(int fd,
struct uv__mmsghdr* mmsg,
unsigned int vlen,
unsigned int flags);
int uv__recvmmsg(int fd, struct uv__mmsghdr* mmsg, unsigned int vlen);
int uv__sendmmsg(int fd, struct uv__mmsghdr* mmsg, unsigned int vlen);
#else
#define HAVE_MMSG 0
#endif
Expand Down