Skip to content

Commit

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

- Fix handling of large files in uv_fs_copyfile().
  Fixes: #30085
- Fix Android build errors.
- uv_sleep() has been added.
- uv_interface_addresses() IPv6 netmask support has been fixed.
  Fixes: #30504
- uv_fs_mkstemp() has been added.

PR-URL: #30783
Fixes: #30085
Fixes: #30504
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
  • Loading branch information
cjihrig authored and targos committed Jan 13, 2020
1 parent eb8f19a commit fff1167
Show file tree
Hide file tree
Showing 26 changed files with 535 additions and 106 deletions.
1 change: 1 addition & 0 deletions deps/uv/AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -411,3 +411,4 @@ Ouyang Yadong <oyydoibh@gmail.com>
ZYSzys <zyszys98@gmail.com>
Carl Lei <xecycle@gmail.com>
Stefan Bender <stefan.bender@ntnu.no>
nia <nia@NetBSD.org>
4 changes: 3 additions & 1 deletion deps/uv/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Android")
src/unix/linux-syscalls.c
src/unix/procfs-exepath.c
src/unix/pthread-fixes.c
src/unix/random-getrandom.c
src/unix/random-sysctl-linux.c
src/unix/sysinfo-loadavg.c)
endif()

Expand Down Expand Up @@ -320,7 +322,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
src/unix/linux-syscalls.c
src/unix/procfs-exepath.c
src/unix/random-getrandom.c
src/unix/random-sysctl.c
src/unix/random-sysctl-linux.c
src/unix/sysinfo-loadavg.c)
endif()

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.12.05, Version 1.34.0 (Stable), 15ae750151ac9341e5945eb38f8982d59fb99201

Changes since version 1.33.1:

* unix: move random-sysctl to random-sysctl-linux (nia)

* netbsd: use KERN_ARND sysctl to get entropy (nia)

* unix: refactor uv__fs_copyfile() logic (cjihrig)

* build: fix android build, add missing sources (Ben Noordhuis)

* build: fix android build, fix symbol redefinition (Ben Noordhuis)

* build: fix android autotools build (Ben Noordhuis)

* fs: handle non-functional statx system call (Milad Farazmand)

* unix,win: add uv_sleep() (cjihrig)

* doc: add richardlau to maintainers (Richard Lau)

* aix: fix netmask for IPv6 (Richard Lau)

* aix: clean up after errors in uv_interface_addresses() (Richard Lau)

* aix: fix setting of physical addresses (Richard Lau)

* fs: add uv_fs_mkstemp (Saúl Ibarra Corretgé)

* unix: switch uv_sleep() to nanosleep() (Ben Noordhuis)

* unix: retry on EINTR in uv_sleep() (Ben Noordhuis)

* zos: fix nanosleep() emulation (Ben Noordhuis)


2019.10.20, Version 1.33.1 (Stable), 07ad32138f4d2285ba2226b5e20462b27b091a59

Changes since version 1.33.0:
Expand Down
2 changes: 2 additions & 0 deletions deps/uv/MAINTAINERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ libuv is currently managed by the following individuals:
- GPG key: 9DFE AA5F 481B BF77 2D90 03CE D592 4925 2F8E C41A (pubkey-iwuzhere)
* **Jameson Nash** ([@vtjnash](https://github.com/vtjnash))
* **John Barboza** ([@jbarz](https://github.com/jbarz))
* **Richard Lau** ([@richardlau](https://github.com/richardlau))
- GPG key: C82F A3AE 1CBE DC6B E46B 9360 C43C EC45 C17A B93C (pubkey-richardlau)
* **Santiago Gimeno** ([@santigimeno](https://github.com/santigimeno))
- GPG key: 612F 0EAD 9401 6223 79DF 4402 F28C 3C8D A33C 03BE (pubkey-santigimeno)
* **Saúl Ibarra Corretgé** ([@saghul](https://github.com/saghul))
Expand Down
11 changes: 9 additions & 2 deletions deps/uv/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,14 @@ endif
if ANDROID
uvinclude_HEADERS += include/uv/android-ifaddrs.h
libuv_la_SOURCES += src/unix/android-ifaddrs.c \
src/unix/pthread-fixes.c
src/unix/linux-core.c \
src/unix/linux-inotify.c \
src/unix/linux-syscalls.c \
src/unix/procfs-exepath.c \
src/unix/pthread-fixes.c \
src/unix/random-getrandom.c \
src/unix/random-sysctl-linux.c \
src/unix/sysinfo-loadavg.c
endif

if CYGWIN
Expand Down Expand Up @@ -467,7 +474,7 @@ libuv_la_SOURCES += src/unix/linux-core.c \
src/unix/procfs-exepath.c \
src/unix/proctitle.c \
src/unix/random-getrandom.c \
src/unix/random-sysctl.c \
src/unix/random-sysctl-linux.c \
src/unix/sysinfo-loadavg.c
test_run_tests_LDFLAGS += -lutil
endif
Expand Down
2 changes: 1 addition & 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.33.1], [https://github.com/libuv/libuv/issues])
AC_INIT([libuv], [1.34.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
13 changes: 9 additions & 4 deletions deps/uv/docs/src/fs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ Data types
UV_FS_LCHOWN,
UV_FS_OPENDIR,
UV_FS_READDIR,
UV_FS_CLOSEDIR
UV_FS_CLOSEDIR,
UV_FS_MKSTEMP
} uv_fs_type;

.. c:type:: uv_statfs_t
Expand Down Expand Up @@ -245,10 +246,14 @@ API
.. c:function:: int uv_fs_mkdtemp(uv_loop_t* loop, uv_fs_t* req, const char* tpl, uv_fs_cb cb)
Equivalent to :man:`mkdtemp(3)`.
Equivalent to :man:`mkdtemp(3)`. The result can be found as a null terminated string at `req->path`.
.. note::
The result can be found as a null terminated string at `req->path`.
.. c:function:: int uv_fs_mkstemp(uv_loop_t* loop, uv_fs_t* req, const char* tpl, uv_fs_cb cb)
Equivalent to :man:`mkstemp(3)`. The created file path can be found as a null terminated string at `req->path`.
The file descriptor can be found as an integer at `req->result`.
.. versionadded:: 1.34.0
.. c:function:: int uv_fs_rmdir(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb)
Expand Down
7 changes: 7 additions & 0 deletions deps/uv/docs/src/misc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,7 @@ API
:man:`sysctl(2)`.
- FreeBSD: `getrandom(2) <https://www.freebsd.org/cgi/man.cgi?query=getrandom&sektion=2>_`,
or `/dev/urandom` after reading from `/dev/random` once.
- NetBSD: `KERN_ARND` `sysctl(3) <https://netbsd.gw.com/cgi-bin/man-cgi?sysctl+3+NetBSD-current>_`
- macOS, OpenBSD: `getentropy(2) <https://man.openbsd.org/getentropy.2>_`
if available, or `/dev/urandom` after reading from `/dev/random` once.
- AIX: `/dev/random`.
Expand All @@ -693,3 +694,9 @@ API
are not used and can be set to `NULL`.
.. versionadded:: 1.33.0
.. c:function:: void uv_sleep(unsigned int msec)
Causes the calling thread to sleep for `msec` milliseconds.
.. versionadded:: 1.34.0
8 changes: 7 additions & 1 deletion deps/uv/include/uv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1258,7 +1258,8 @@ typedef enum {
UV_FS_OPENDIR,
UV_FS_READDIR,
UV_FS_CLOSEDIR,
UV_FS_STATFS
UV_FS_STATFS,
UV_FS_MKSTEMP
} uv_fs_type;

struct uv_dir_s {
Expand Down Expand Up @@ -1349,6 +1350,10 @@ UV_EXTERN int uv_fs_mkdtemp(uv_loop_t* loop,
uv_fs_t* req,
const char* tpl,
uv_fs_cb cb);
UV_EXTERN int uv_fs_mkstemp(uv_loop_t* loop,
uv_fs_t* req,
const char* tpl,
uv_fs_cb cb);
UV_EXTERN int uv_fs_rmdir(uv_loop_t* loop,
uv_fs_t* req,
const char* path,
Expand Down Expand Up @@ -1641,6 +1646,7 @@ UV_EXTERN uint64_t uv_get_total_memory(void);
UV_EXTERN uint64_t uv_get_constrained_memory(void);

UV_EXTERN uint64_t uv_hrtime(void);
UV_EXTERN void uv_sleep(unsigned int msec);

UV_EXTERN void uv_disable_stdio_inheritance(void);

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 33
#define UV_VERSION_PATCH 1
#define UV_VERSION_MINOR 34
#define UV_VERSION_PATCH 0
#define UV_VERSION_IS_RELEASE 1
#define UV_VERSION_SUFFIX ""

Expand Down
2 changes: 2 additions & 0 deletions deps/uv/src/random.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ static int uv__random(void* buf, size_t buflen) {
rc = uv__random_getentropy(buf, buflen);
if (rc == UV_ENOSYS)
rc = uv__random_devurandom(buf, buflen);
#elif defined(__NetBSD__)
rc = uv__random_sysctl(buf, buflen);
#elif defined(__FreeBSD__) || defined(__linux__)
rc = uv__random_getrandom(buf, buflen);
if (rc == UV_ENOSYS)
Expand Down
114 changes: 82 additions & 32 deletions deps/uv/src/unix/aix-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <sys/ioctl.h>
#include <net/if.h>
#include <netinet/in.h>
#include <netinet/in6_var.h>
#include <arpa/inet.h>

#include <sys/time.h>
Expand Down Expand Up @@ -158,28 +159,42 @@ int uv_exepath(char* buffer, size_t* size) {

int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
uv_interface_address_t* address;
int sockfd, inet6, size = 1;
int sockfd, sock6fd, inet6, i, r, size = 1;
struct ifconf ifc;
struct ifreq *ifr, *p, flg;
struct in6_ifreq if6;
struct sockaddr_dl* sa_addr;

ifc.ifc_req = NULL;
sock6fd = -1;
r = 0;
*count = 0;
*addresses = NULL;

if (0 > (sockfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP))) {
return UV__ERR(errno);
r = UV__ERR(errno);
goto cleanup;
}

if (0 > (sock6fd = socket(AF_INET6, SOCK_DGRAM, IPPROTO_IP))) {
r = UV__ERR(errno);
goto cleanup;
}

if (ioctl(sockfd, SIOCGSIZIFCONF, &size) == -1) {
uv__close(sockfd);
return UV__ERR(errno);
r = UV__ERR(errno);
goto cleanup;
}

ifc.ifc_req = (struct ifreq*)uv__malloc(size);
if (ifc.ifc_req == NULL) {
r = UV_ENOMEM;
goto cleanup;
}
ifc.ifc_len = size;
if (ioctl(sockfd, SIOCGIFCONF, &ifc) == -1) {
uv__close(sockfd);
return UV__ERR(errno);
r = UV__ERR(errno);
goto cleanup;
}

#define ADDR_SIZE(p) MAX((p).sa_len, sizeof(p))
Expand All @@ -197,8 +212,8 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {

memcpy(flg.ifr_name, p->ifr_name, sizeof(flg.ifr_name));
if (ioctl(sockfd, SIOCGIFFLAGS, &flg) == -1) {
uv__close(sockfd);
return UV__ERR(errno);
r = UV__ERR(errno);
goto cleanup;
}

if (!(flg.ifr_flags & IFF_UP && flg.ifr_flags & IFF_RUNNING))
Expand All @@ -207,16 +222,14 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
(*count)++;
}

if (*count == 0) {
uv__close(sockfd);
return 0;
}
if (*count == 0)
goto cleanup;

/* Alloc the return interface structs */
*addresses = uv__malloc(*count * sizeof(uv_interface_address_t));
*addresses = uv__calloc(*count, sizeof(**addresses));
if (!(*addresses)) {
uv__close(sockfd);
return UV_ENOMEM;
r = UV_ENOMEM;
goto cleanup;
}
address = *addresses;

Expand All @@ -233,10 +246,8 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
inet6 = (p->ifr_addr.sa_family == AF_INET6);

memcpy(flg.ifr_name, p->ifr_name, sizeof(flg.ifr_name));
if (ioctl(sockfd, SIOCGIFFLAGS, &flg) == -1) {
uv__close(sockfd);
return UV_ENOSYS;
}
if (ioctl(sockfd, SIOCGIFFLAGS, &flg) == -1)
goto syserror;

if (!(flg.ifr_flags & IFF_UP && flg.ifr_flags & IFF_RUNNING))
continue;
Expand All @@ -250,28 +261,67 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
else
address->address.address4 = *((struct sockaddr_in*) &p->ifr_addr);

sa_addr = (struct sockaddr_dl*) &p->ifr_addr;
memcpy(address->phys_addr, LLADDR(sa_addr), sizeof(address->phys_addr));

if (ioctl(sockfd, SIOCGIFNETMASK, p) == -1) {
uv__close(sockfd);
return UV_ENOSYS;
}

if (inet6)
address->netmask.netmask6 = *((struct sockaddr_in6*) &p->ifr_addr);
else
if (inet6) {
memset(&if6, 0, sizeof(if6));
r = uv__strscpy(if6.ifr_name, p->ifr_name, sizeof(if6.ifr_name));
if (r == UV_E2BIG)
goto cleanup;
r = 0;
memcpy(&if6.ifr_Addr, &p->ifr_addr, sizeof(if6.ifr_Addr));
if (ioctl(sock6fd, SIOCGIFNETMASK6, &if6) == -1)
goto syserror;
address->netmask.netmask6 = *((struct sockaddr_in6*) &if6.ifr_Addr);
/* Explicitly set family as the ioctl call appears to return it as 0. */
address->netmask.netmask6.sin6_family = AF_INET6;
} else {
if (ioctl(sockfd, SIOCGIFNETMASK, p) == -1)
goto syserror;
address->netmask.netmask4 = *((struct sockaddr_in*) &p->ifr_addr);
/* Explicitly set family as the ioctl call appears to return it as 0. */
address->netmask.netmask4.sin_family = AF_INET;
}

address->is_internal = flg.ifr_flags & IFF_LOOPBACK ? 1 : 0;

address++;
}

/* Fill in physical addresses. */
ifr = ifc.ifc_req;
while ((char*)ifr < (char*)ifc.ifc_req + ifc.ifc_len) {
p = ifr;
ifr = (struct ifreq*)
((char*)ifr + sizeof(ifr->ifr_name) + ADDR_SIZE(ifr->ifr_addr));

if (p->ifr_addr.sa_family != AF_LINK)
continue;

address = *addresses;
for (i = 0; i < *count; i++) {
if (strcmp(address->name, p->ifr_name) == 0) {
sa_addr = (struct sockaddr_dl*) &p->ifr_addr;
memcpy(address->phys_addr, LLADDR(sa_addr), sizeof(address->phys_addr));
}
address++;
}
}

#undef ADDR_SIZE
goto cleanup;

uv__close(sockfd);
return 0;
syserror:
uv_free_interface_addresses(*addresses, *count);
*addresses = NULL;
*count = 0;
r = UV_ENOSYS;

cleanup:
if (sockfd != -1)
uv__close(sockfd);
if (sock6fd != -1)
uv__close(sock6fd);
uv__free(ifc.ifc_req);
return r;
}


Expand Down
Loading

0 comments on commit fff1167

Please sign in to comment.