Skip to content

Commit

Permalink
deps: upgrade to libuv 1.27.0
Browse files Browse the repository at this point in the history
Notable changes:
- `statx()` is used to retrieve file birth times on
  supported platforms.
- Improved support of running under Windows safe mode.
- Add support for UDP connected sockets. Several functions
  can now return `UV_EBADF` instead of `UV_EINVAL`.
- SunOS support is improved.

Backport-PR-URL: #27728
PR-URL: #26707
Reviewed-By: Santiago Gimeno <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
cjihrig authored and MylesBorins committed May 16, 2019
1 parent f76776b commit 7e5ef4a
Show file tree
Hide file tree
Showing 49 changed files with 1,146 additions and 200 deletions.
2 changes: 2 additions & 0 deletions deps/uv/AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -369,3 +369,5 @@ Kevin Adler <[email protected]>
Stephen Belanger <[email protected]>
yeyuanfeng <[email protected]>
erw7 <[email protected]>
Thomas Karl Pietrowski <[email protected]>
evgley <[email protected]>
6 changes: 4 additions & 2 deletions deps/uv/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ set(uv_test_sources
test/test-tty.c
test/test-udp-alloc-cb-fail.c
test/test-udp-bind.c
test/test-udp-connect.c
test/test-udp-create-socket-early.c
test/test-udp-dgram-too-big.c
test/test-udp-ipv6.c
Expand Down Expand Up @@ -351,7 +352,8 @@ target_link_libraries(uv_a ${uv_libraries})
if(BUILD_TESTING)
include(CTest)
add_executable(uv_run_tests ${uv_test_sources})
target_compile_definitions(uv_run_tests PRIVATE ${uv_defines})
target_compile_definitions(uv_run_tests
PRIVATE ${uv_defines} USING_UV_SHARED=1)
target_compile_options(uv_run_tests PRIVATE ${uv_cflags})
target_include_directories(uv_run_tests PRIVATE include)
target_link_libraries(uv_run_tests uv ${uv_test_libraries})
Expand Down Expand Up @@ -383,7 +385,7 @@ if(UNIX)

install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(FILES LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR})
install(FILES LICENSE ${CMAKE_CURRENT_BINARY_DIR}/libuv.pc
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libuv.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
59 changes: 59 additions & 0 deletions deps/uv/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,62 @@
2019.03.17, Version 1.27.0 (Stable), a4fc9a66cc35256dbc4dcd67c910174f05b6daa6

Changes since version 1.26.0:

* doc: describe unix signal handling better (Vladimír Čunát)

* linux: use statx() to obtain file birth time (Ben Noordhuis)

* src: fill sockaddr_in6.sin6_len when it's defined (Santiago Gimeno)

* test: relax uv_hrtime() test assumptions (Ben Noordhuis)

* build: make cmake install LICENSE only once (Thomas Karl Pietrowski)

* bsd: plug uv_fs_event_start() error path fd leak (Ben Noordhuis)

* unix: fix __FreeBSD_kernel__ typo (cjihrig)

* doc: add note about uv_run() not being reentrant (Ben Noordhuis)

* unix, win: make fs-poll close wait for resource cleanup (Anna Henningsen)

* doc: fix typo in uv_thread_options_t definition (Ryan Liptak)

* win: skip winsock initialization in safe mode (evgley)

* unix: refactor getsockname/getpeername methods (Santiago Gimeno)

* win,udp: allow to use uv_udp_open on bound sockets (Santiago Gimeno)

* udp: add support for UDP connected sockets (Santiago Gimeno)

* build: fix uv_test shared uv Windows cmake build (ptlomholt)

* build: add android-configure scripts to EXTRA_DIST (Ben Noordhuis)

* build: add missing header (cjihrig)

* sunos: add perror() output prior to abort() (Andrew Paprocki)

* test,sunos: disable UV_DISCONNECT handling (Andrew Paprocki)

* sunos: disable __attribute__((unused)) (Andrew Paprocki)

* test,sunos: use unistd.h code branch (Andrew Paprocki)

* build,sunos: better handling of non-GCC compiler (Andrew Paprocki)

* test,sunos: fix statement not reached warnings (Andrew Paprocki)

* sunos: fix argument/prototype mismatch in atomics (Andrew Paprocki)

* test,sunos: test-ipc.c lacks newline at EOF (Andrew Paprocki)

* test: change spawn_stdin_stdout return to void (Andrew Paprocki)

* test: remove call to floor() in test driver (Andrew Paprocki)


2019.02.11, Version 1.26.0 (Stable), 8669d8d3e93cddb62611b267ef62a3ddb5ba3ca0

Changes since version 1.25.0:
Expand Down
24 changes: 20 additions & 4 deletions deps/uv/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ libuv_la_LDFLAGS = -no-undefined -version-info 1:0:0
libuv_la_SOURCES = src/fs-poll.c \
src/heap-inl.h \
src/idna.c \
src/idna.h \
src/inet.c \
src/queue.h \
src/strscpy.c \
Expand All @@ -44,10 +45,12 @@ libuv_la_SOURCES = src/fs-poll.c \
src/version.c

if SUNOS
if GCC
# Can't be turned into a CC_CHECK_CFLAGS in configure.ac, it makes compilers
# on other platforms complain that the argument is unused during compilation.
libuv_la_CFLAGS += -pthreads
endif
endif

if WINNT

Expand Down Expand Up @@ -121,11 +124,13 @@ EXTRA_DIST = test/fixtures/empty_file \
docs \
img \
samples \
android-configure \
android-configure-arm \
android-configure-arm64 \
android-configure-x86 \
android-configure-x86_64 \
CONTRIBUTING.md \
LICENSE \
README.md \
checksparse.sh \
vcbuild.bat \
common.gypi \
gyp_uv.py \
Expand All @@ -138,14 +143,20 @@ check_PROGRAMS = test/run-tests
if OS390
test_run_tests_CFLAGS =
else
if GCC
test_run_tests_CFLAGS = -Wno-long-long
else
test_run_tests_CFLAGS =
endif
endif

if SUNOS
if GCC
# Can't be turned into a CC_CHECK_CFLAGS in configure.ac, it makes compilers
# on other platforms complain that the argument is unused during compilation.
test_run_tests_CFLAGS += -pthreads
endif
endif

test_run_tests_LDFLAGS =
test_run_tests_SOURCES = test/blackhole-server.c \
Expand Down Expand Up @@ -281,6 +292,7 @@ test_run_tests_SOURCES = test/blackhole-server.c \
test/test-tty.c \
test/test-udp-alloc-cb-fail.c \
test/test-udp-bind.c \
test/test-udp-connect.c \
test/test-udp-create-socket-early.c \
test/test-udp-dgram-too-big.c \
test/test-udp-ipv6.c \
Expand Down Expand Up @@ -320,7 +332,9 @@ test_run_tests_CFLAGS += -D_GNU_SOURCE
endif

if SUNOS
test_run_tests_CFLAGS += -D__EXTENSIONS__ -D_XOPEN_SOURCE=500
test_run_tests_CFLAGS += -D__EXTENSIONS__ \
-D_XOPEN_SOURCE=500 \
-D_REENTRANT
endif

if OS390
Expand Down Expand Up @@ -458,7 +472,9 @@ endif

if SUNOS
uvinclude_HEADERS += include/uv/sunos.h
libuv_la_CFLAGS += -D__EXTENSIONS__ -D_XOPEN_SOURCE=500
libuv_la_CFLAGS += -D__EXTENSIONS__ \
-D_XOPEN_SOURCE=500 \
-D_REENTRANT
libuv_la_SOURCES += src/unix/no-proctitle.c \
src/unix/sunos.c
endif
Expand Down
2 changes: 1 addition & 1 deletion deps/uv/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ $ make -C out
The default API level is 24, but a different one can be selected as follows:

```bash
$ source ./android-configure ~/android-ndk-r15b gyp 21
$ source ./android-configure-arm ~/android-ndk-r15b gyp 21
$ make -C out
```

Expand Down
21 changes: 12 additions & 9 deletions 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.26.0], [https://github.com/libuv/libuv/issues])
AC_INIT([libuv], [1.27.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 All @@ -24,16 +24,18 @@ AC_ENABLE_SHARED
AC_ENABLE_STATIC
AC_PROG_CC
AM_PROG_CC_C_O
AS_IF([AS_CASE([$host_os],[openedition*], [false], [true])], [
CC_CHECK_CFLAGS_APPEND([-pedantic])
])
CC_FLAG_VISIBILITY #[-fvisibility=hidden]
CC_CHECK_CFLAGS_APPEND([-g])
CC_CHECK_CFLAGS_APPEND([-std=gnu89])
CC_CHECK_CFLAGS_APPEND([-Wall])
CC_CHECK_CFLAGS_APPEND([-Wextra])
CC_CHECK_CFLAGS_APPEND([-Wno-unused-parameter])
CC_CHECK_CFLAGS_APPEND([-Wstrict-prototypes])
AS_IF([test "x$GCC" = xyes], [
AS_IF([AS_CASE([$host_os], [openedition*], [false], [true])], [
CC_CHECK_CFLAGS_APPEND([-pedantic])
])
CC_CHECK_CFLAGS_APPEND([-std=gnu89])
CC_CHECK_CFLAGS_APPEND([-Wall])
CC_CHECK_CFLAGS_APPEND([-Wextra])
CC_CHECK_CFLAGS_APPEND([-Wno-unused-parameter])
CC_CHECK_CFLAGS_APPEND([-Wstrict-prototypes])
])
# AM_PROG_AR is not available in automake v0.11 but it's essential in v0.12.
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
# autoconf complains if AC_PROG_LIBTOOL precedes AM_PROG_AR.
Expand All @@ -50,6 +52,7 @@ AC_CHECK_LIB([rt], [clock_gettime])
AC_CHECK_LIB([sendfile], [sendfile])
AC_CHECK_LIB([socket], [socket])
AC_SYS_LARGEFILE
AM_CONDITIONAL([GCC], [AS_IF([test "x$GCC" = xyes], [true], [false])])
AM_CONDITIONAL([AIX], [AS_CASE([$host_os],[aix*], [true], [false])])
AM_CONDITIONAL([ANDROID], [AS_CASE([$host_os],[linux-android*],[true], [false])])
AM_CONDITIONAL([CYGWIN], [AS_CASE([$host_os],[cygwin*], [true], [false])])
Expand Down
2 changes: 2 additions & 0 deletions deps/uv/docs/src/loop.rst
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ API
or requests left), or non-zero if more callbacks are expected (meaning
you should run the event loop again sometime in the future).
:c:func:`uv_run` is not reentrant. It must not be called from a callback.
.. c:function:: int uv_loop_alive(const uv_loop_t* loop)
Returns non-zero if there are referenced active handles, active
Expand Down
24 changes: 18 additions & 6 deletions deps/uv/docs/src/signal.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@

Signal handles implement Unix style signal handling on a per-event loop bases.

Reception of some signals is emulated on Windows:
Windows notes
-------------

Reception of some signals is emulated:

* SIGINT is normally delivered when the user presses CTRL+C. However, like
on Unix, it is not generated when terminal raw mode is enabled.
Expand All @@ -24,13 +27,22 @@ Reception of some signals is emulated on Windows:
* Calls to raise() or abort() to programmatically raise a signal are
not detected by libuv; these will not trigger a signal watcher.

.. note::
On Linux SIGRT0 and SIGRT1 (signals 32 and 33) are used by the NPTL pthreads library to
manage threads. Installing watchers for those signals will lead to unpredictable behavior
and is strongly discouraged. Future versions of libuv may simply reject them.

.. versionchanged:: 1.15.0 SIGWINCH support on Windows was improved.

Unix notes
----------

* SIGKILL and SIGSTOP are impossible to catch.

* Handling SIGBUS, SIGFPE, SIGILL or SIGSEGV via libuv results into undefined behavior.

* SIGABRT will not be caught by libuv if generated by `abort()`, e.g. through `assert()`.

* On Linux SIGRT0 and SIGRT1 (signals 32 and 33) are used by the NPTL pthreads library to
manage threads. Installing watchers for those signals will lead to unpredictable behavior
and is strongly discouraged. Future versions of libuv may simply reject them.


Data types
----------

Expand Down
4 changes: 2 additions & 2 deletions deps/uv/docs/src/threading.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ Threads

::

typedef struct uv_process_options_s {
typedef struct uv_thread_options_s {
enum {
UV_THREAD_NO_FLAGS = 0x00,
UV_THREAD_HAS_STACK_SIZE = 0x01
} flags;
size_t stack_size;
} uv_process_options_t;
} uv_thread_options_t;

More fields may be added to this struct at any time, so its exact
layout and size should not be relied upon.
Expand Down
54 changes: 54 additions & 0 deletions deps/uv/docs/src/udp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,44 @@ API
:returns: 0 on success, or an error code < 0 on failure.
.. c:function:: int uv_udp_connect(uv_udp_t* handle, const struct sockaddr* addr)
Associate the UDP handle to a remote address and port, so every
message sent by this handle is automatically sent to that destination.
Calling this function with a `NULL` `addr` disconnects the handle.
Trying to call `uv_udp_connect()` on an already connected handle will result
in an `UV_EISCONN` error. Trying to disconnect a handle that is not
connected will return an `UV_ENOTCONN` error.
:param handle: UDP handle. Should have been initialized with
:c:func:`uv_udp_init`.
:param addr: `struct sockaddr_in` or `struct sockaddr_in6`
with the address and port to associate to.
:returns: 0 on success, or an error code < 0 on failure.
.. versionadded:: 1.27.0
.. c:function:: int uv_udp_getpeername(const uv_udp_t* handle, struct sockaddr* name, int* namelen)
Get the remote IP and port of the UDP handle on connected UDP handles.
On unconnected handles, it returns `UV_ENOTCONN`.
:param handle: UDP handle. Should have been initialized with
:c:func:`uv_udp_init` and bound.
:param name: Pointer to the structure to be filled with the address data.
In order to support IPv4 and IPv6 `struct sockaddr_storage` should be
used.
:param namelen: On input it indicates the data of the `name` field. On
output it indicates how much of it was filled.
:returns: 0 on success, or an error code < 0 on failure
.. versionadded:: 1.27.0
.. c:function:: int uv_udp_getsockname(const uv_udp_t* handle, struct sockaddr* name, int* namelen)
Get the local IP and port of the UDP handle.
Expand Down Expand Up @@ -247,6 +285,12 @@ API
(``0.0.0.0`` or ``::``) it will be changed to point to ``localhost``.
This is done to match the behavior of Linux systems.
For connected UDP handles, `addr` must be set to `NULL`, otherwise it will
return `UV_EISCONN` error.
For connectionless UDP handles, `addr` cannot be `NULL`, otherwise it will
return `UV_EDESTADDRREQ` error.
:param req: UDP request handle. Need not be initialized.
:param handle: UDP handle. Should have been initialized with
Expand All @@ -266,15 +310,25 @@ API
.. versionchanged:: 1.19.0 added ``0.0.0.0`` and ``::`` to ``localhost``
mapping
.. versionchanged:: 1.27.0 added support for connected sockets
.. c:function:: int uv_udp_try_send(uv_udp_t* handle, const uv_buf_t bufs[], unsigned int nbufs, const struct sockaddr* addr)
Same as :c:func:`uv_udp_send`, but won't queue a send request if it can't
be completed immediately.
For connected UDP handles, `addr` must be set to `NULL`, otherwise it will
return `UV_EISCONN` error.
For connectionless UDP handles, `addr` cannot be `NULL`, otherwise it will
return `UV_EDESTADDRREQ` error.
:returns: >= 0: number of bytes sent (it matches the given buffer size).
< 0: negative error code (``UV_EAGAIN`` is returned when the message
can't be sent immediately).
.. versionchanged:: 1.27.0 added support for connected sockets
.. c:function:: int uv_udp_recv_start(uv_udp_t* handle, uv_alloc_cb alloc_cb, uv_udp_recv_cb recv_cb)
Prepare for receiving data. If the socket has not previously been bound
Expand Down
4 changes: 4 additions & 0 deletions deps/uv/include/uv.h
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,11 @@ UV_EXTERN int uv_udp_open(uv_udp_t* handle, uv_os_sock_t sock);
UV_EXTERN int uv_udp_bind(uv_udp_t* handle,
const struct sockaddr* addr,
unsigned int flags);
UV_EXTERN int uv_udp_connect(uv_udp_t* handle, const struct sockaddr* addr);

UV_EXTERN int uv_udp_getpeername(const uv_udp_t* handle,
struct sockaddr* name,
int* namelen);
UV_EXTERN int uv_udp_getsockname(const uv_udp_t* handle,
struct sockaddr* name,
int* namelen);
Expand Down
Loading

0 comments on commit 7e5ef4a

Please sign in to comment.