Skip to content

Commit

Permalink
deps: upgrade to libuv 1.30.0
Browse files Browse the repository at this point in the history
Notable changes:

- Support for the Haiku platform has been added.
- The maximum UV_THREADPOOL_SIZE has been increased from
  128 to 1024.
- uv_fs_copyfile() now works properly when the source and
  destination files are the same.

PR-URL: #28449
Backport-PR-URL: #31969
Fixes: #27746
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Jiawen Geng <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
  • Loading branch information
cjihrig authored and BethGriggs committed Mar 2, 2020
1 parent b53ce6e commit 7cde563
Show file tree
Hide file tree
Showing 28 changed files with 644 additions and 63 deletions.
1 change: 1 addition & 0 deletions deps/uv/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test/fixtures/lorem_ipsum.txt text eol=lf
7 changes: 7 additions & 0 deletions deps/uv/AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -382,3 +382,10 @@ George Zhao <[email protected]>
Kyle Edwards <[email protected]>
ken-cunningham-webuse <[email protected]>
Kelvin Jin <[email protected]>
Leorize <[email protected]>
Vlad A <[email protected]>
Niels Lohmann <[email protected]>
Jenil Christo <[email protected]>
Evgeny Ermakov <[email protected]>
gengjiawen <[email protected]>
Leo Chung <[email protected]>
9 changes: 6 additions & 3 deletions deps/uv/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# TODO: determine CMAKE_SYSTEM_NAME on OS/390. Currently assumes "OS/390".
cmake_minimum_required(VERSION 3.0)
project(libuv)
enable_testing()

if(MSVC)
list(APPEND uv_cflags /W4)
Expand Down Expand Up @@ -137,6 +136,7 @@ set(uv_test_sources
test/test-tcp-read-stop.c
test/test-tcp-shutdown-after-write.c
test/test-tcp-try-write.c
test/test-tcp-try-write-error.c
test/test-tcp-unexpected-read.c
test/test-tcp-write-after-connect.c
test/test-tcp-write-fail.c
Expand Down Expand Up @@ -350,8 +350,11 @@ target_compile_options(uv_a PRIVATE ${uv_cflags})
target_include_directories(uv_a PRIVATE include src)
target_link_libraries(uv_a ${uv_libraries})

if(BUILD_TESTING)
include(CTest)
option(libuv_buildtests "Build the unit tests when BUILD_TESTING is enabled." ON)

include(CTest)
if(BUILD_TESTING AND libuv_buildtests)
enable_testing()
add_executable(uv_run_tests ${uv_test_sources})
target_compile_definitions(uv_run_tests
PRIVATE ${uv_defines} USING_UV_SHARED=1)
Expand Down
37 changes: 37 additions & 0 deletions deps/uv/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,40 @@
2019.06.28, Version 1.30.0 (Stable), 365b6f2a0eacda1ff52be8e57ab9381cfddc5dbb

Changes since version 1.29.1:

* darwin: fall back to F_BARRIERFSYNC (Ben Noordhuis)

* darwin: add 32 bit close$NOCANCEL implementation (ken-cunningham-webuse)

* build, core, unix: add support for Haiku (Leorize)

* darwin,linux: more conservative minimum stack size (Ben Noordhuis)

* threadpool: increase UV_THREADPOOL_SIZE limit (Vlad A)

* unix: return actual error from `uv_try_write()` (Anna Henningsen)

* darwin: fix build error with macos 10.10 (Ben Noordhuis)

* unix: make uv_cwd() report UV_ENOBUFS (Ben Noordhuis)

* unix: make uv_fs_read() fill all buffers (Ben Noordhuis)

* test: give hrtime test a custom 10s timeout (Ben Noordhuis)

* fs: fix uv_fs_copyfile if same src and dst (Santiago Gimeno)

* build: add cmake option to skip building tests (Niels Lohmann)

* doc: add link to nodejs.org (Jenil Christo)

* unix: fix a comment typo in signal.c (Evgeny Ermakov)

* unix: remove redundant cast in process.c (gengjiawen)

* doc: fix wrong mutex function prototypes (Leo Chung)


2019.05.22, Version 1.29.1 (Stable), d16e6094e1eb3b0b5981ef1dd7e03ec4d466944d

Changes since version 1.29.0:
Expand Down
17 changes: 17 additions & 0 deletions deps/uv/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ endif # WINNT

EXTRA_DIST = test/fixtures/empty_file \
test/fixtures/load_error.node \
test/fixtures/lorem_ipsum.txt \
include \
docs \
img \
Expand Down Expand Up @@ -272,6 +273,7 @@ test_run_tests_SOURCES = test/blackhole-server.c \
test/test-tcp-writealot.c \
test/test-tcp-write-fail.c \
test/test-tcp-try-write.c \
test/test-tcp-try-write-error.c \
test/test-tcp-write-queue-order.c \
test/test-thread-equal.c \
test/test-thread.c \
Expand Down Expand Up @@ -320,6 +322,10 @@ test_run_tests_CFLAGS += -D_ALL_SOURCE \
-D_LINUX_SOURCE_COMPAT
endif

if HAIKU
test_run_tests_CFLAGS += -D_BSD_SOURCE
endif

if LINUX
test_run_tests_CFLAGS += -D_GNU_SOURCE
endif
Expand Down Expand Up @@ -409,6 +415,17 @@ libuv_la_SOURCES += src/unix/bsd-ifaddrs.c \
test_run_tests_LDFLAGS += -lutil
endif

if HAIKU
uvinclude_HEADERS += include/uv/posix.h
libuv_la_CFLAGS += -D_BSD_SOURCE
libuv_la_SOURCES += src/unix/bsd-ifaddrs.c \
src/unix/haiku.c \
src/unix/no-fsevents.c \
src/unix/no-proctitle.c \
src/unix/posix-hrtime.c \
src/unix/posix-poll.c
endif

if HURD
uvinclude_HEADERS += include/uv/posix.h
libuv_la_SOURCES += src/unix/no-fsevents.c \
Expand Down
6 changes: 5 additions & 1 deletion deps/uv/configure.ac
Original file line number Diff line number Diff line change
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.29.1], [https://github.com/libuv/libuv/issues])
AC_INIT([libuv], [1.30.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 Expand Up @@ -56,6 +56,7 @@ AM_CONDITIONAL([CYGWIN], [AS_CASE([$host_os],[cygwin*], [true], [false])
AM_CONDITIONAL([DARWIN], [AS_CASE([$host_os],[darwin*], [true], [false])])
AM_CONDITIONAL([DRAGONFLY],[AS_CASE([$host_os],[dragonfly*], [true], [false])])
AM_CONDITIONAL([FREEBSD], [AS_CASE([$host_os],[*freebsd*], [true], [false])])
AM_CONDITIONAL([HAIKU], [AS_CASE([$host_os],[haiku], [true], [false])])
AM_CONDITIONAL([HURD], [AS_CASE([$host_os],[gnu*], [true], [false])])
AM_CONDITIONAL([LINUX], [AS_CASE([$host_os],[linux*], [true], [false])])
AM_CONDITIONAL([MSYS], [AS_CASE([$host_os],[msys*], [true], [false])])
Expand All @@ -71,6 +72,9 @@ AS_CASE([$host_os], [netbsd*], [AC_CHECK_LIB([kvm], [kvm_open])])
AS_CASE([$host_os], [kfreebsd*], [
LIBS="$LIBS -lfreebsd-glue"
])
AS_CASE([$host_os], [haiku], [
LIBS="$LIBS -lnetwork"
])
AC_CHECK_HEADERS([sys/ahafs_evProds.h])
AC_CONFIG_FILES([Makefile libuv.pc])
AC_CONFIG_LINKS([test/fixtures/empty_file:test/fixtures/empty_file])
Expand Down
4 changes: 3 additions & 1 deletion deps/uv/docs/src/design.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
Design overview
===============

libuv is cross-platform support library which was originally written for NodeJS. It's designed
libuv is cross-platform support library which was originally written for `Node.js`_. It's designed
around the event-driven asynchronous I/O model.

.. _Node.js: https://nodejs.org

The library provides much more than a simple abstraction over different I/O polling mechanisms:
'handles' and 'streams' provide a high level abstraction for sockets and other entities;
cross-platform file I/O and threading functionality is also provided, amongst other things.
Expand Down
4 changes: 3 additions & 1 deletion deps/uv/docs/src/threadpool.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ operations, as well as getaddrinfo and getnameinfo requests.

Its default size is 4, but it can be changed at startup time by setting the
``UV_THREADPOOL_SIZE`` environment variable to any value (the absolute maximum
is 128).
is 1024).

.. versionchanged:: 1.29.2 the maximum UV_THREADPOOL_SIZE allowed was increased from 128 to 1024.

The threadpool is global and shared across all event loops. When a particular
function makes use of the threadpool (i.e. when using :c:func:`uv_queue_work`)
Expand Down
2 changes: 2 additions & 0 deletions deps/uv/include/uv/unix.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
defined(__MSYS__) || \
defined(__GNU__)
# include "uv/posix.h"
#elif defined(__HAIKU__)
# include "uv/posix.h"
#endif

#ifndef NI_MAXHOST
Expand Down
4 changes: 2 additions & 2 deletions deps/uv/include/uv/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
*/

#define UV_VERSION_MAJOR 1
#define UV_VERSION_MINOR 29
#define UV_VERSION_PATCH 1
#define UV_VERSION_MINOR 30
#define UV_VERSION_PATCH 0
#define UV_VERSION_IS_RELEASE 1
#define UV_VERSION_SUFFIX ""

Expand Down
2 changes: 1 addition & 1 deletion deps/uv/src/threadpool.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

#include <stdlib.h>

#define MAX_THREADPOOL_SIZE 128
#define MAX_THREADPOOL_SIZE 1024

static uv_once_t once = UV_ONCE_INIT;
static uv_cond_t cond;
Expand Down
7 changes: 6 additions & 1 deletion deps/uv/src/unix/bsd-ifaddrs.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
#include <net/if_dl.h>
#endif

#if defined(__HAIKU__)
#define IFF_RUNNING IFF_LINK
#endif

static int uv__ifaddr_exclude(struct ifaddrs *ent, int exclude_type) {
if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)))
return 1;
Expand All @@ -45,7 +49,8 @@ static int uv__ifaddr_exclude(struct ifaddrs *ent, int exclude_type) {
if (exclude_type == UV__EXCLUDE_IFPHYS)
return (ent->ifa_addr->sa_family != AF_LINK);
#endif
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__DragonFly__)
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__DragonFly__) || \
defined(__HAIKU__)
/*
* On BSD getifaddrs returns information related to the raw underlying
* devices. We're not interested in this information.
Expand Down
37 changes: 32 additions & 5 deletions deps/uv/src/unix/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -526,8 +526,13 @@ int uv__close_nocancel(int fd) {
#if defined(__APPLE__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdollar-in-identifier-extension"
#if defined(__LP64__)
extern int close$NOCANCEL(int);
return close$NOCANCEL(fd);
#else
extern int close$NOCANCEL$UNIX2003(int);
return close$NOCANCEL$UNIX2003(fd);
#endif
#pragma GCC diagnostic pop
#elif defined(__linux__)
return syscall(SYS_close, fd);
Expand Down Expand Up @@ -579,7 +584,7 @@ int uv__nonblock_ioctl(int fd, int set) {
}


#if !defined(__CYGWIN__) && !defined(__MSYS__)
#if !defined(__CYGWIN__) && !defined(__MSYS__) && !defined(__HAIKU__)
int uv__cloexec_ioctl(int fd, int set) {
int r;

Expand Down Expand Up @@ -696,16 +701,38 @@ ssize_t uv__recvmsg(int fd, struct msghdr* msg, int flags) {


int uv_cwd(char* buffer, size_t* size) {
char scratch[1 + UV__PATH_MAX];

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

if (getcwd(buffer, *size) == NULL)
/* Try to read directly into the user's buffer first... */
if (getcwd(buffer, *size) != NULL)
goto fixup;

if (errno != ERANGE)
return UV__ERR(errno);

/* ...or into scratch space if the user's buffer is too small
* so we can report how much space to provide on the next try.
*/
if (getcwd(scratch, sizeof(scratch)) == NULL)
return UV__ERR(errno);

buffer = scratch;

fixup:

*size = strlen(buffer);

if (*size > 1 && buffer[*size - 1] == '/') {
buffer[*size-1] = '\0';
(*size)--;
*size -= 1;
buffer[*size] = '\0';
}

if (buffer == scratch) {
*size += 1;
return UV_ENOBUFS;
}

return 0;
Expand Down Expand Up @@ -947,7 +974,7 @@ int uv_getrusage(uv_rusage_t* rusage) {
rusage->ru_stime.tv_sec = usage.ru_stime.tv_sec;
rusage->ru_stime.tv_usec = usage.ru_stime.tv_usec;

#if !defined(__MVS__)
#if !defined(__MVS__) && !defined(__HAIKU__)
rusage->ru_maxrss = usage.ru_maxrss;
rusage->ru_ixrss = usage.ru_ixrss;
rusage->ru_idrss = usage.ru_idrss;
Expand Down
Loading

0 comments on commit 7cde563

Please sign in to comment.