Permalink
Browse files

deps: upgrade to libuv 1.24.1

PR-URL: #25078
Fixes: #24521
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
  • Loading branch information...
cjihrig authored and MylesBorins committed Dec 16, 2018
1 parent 4f28da8 commit 155d1d54bfa4f9694e4dec49c18d12860971ec25
Showing with 421 additions and 127 deletions.
  1. +1 −1 deps/uv/.gitignore
  2. +6 −0 deps/uv/AUTHORS
  3. +7 −1 deps/uv/CMakeLists.txt
  4. +33 −0 deps/uv/ChangeLog
  5. +3 −0 deps/uv/Makefile.am
  6. +1 −2 deps/uv/README.md
  7. +1 −1 deps/uv/configure.ac
  8. +2 −0 deps/uv/docs/src/handle.rst
  9. +1 −1 deps/uv/include/uv/version.h
  10. +1 −0 deps/uv/include/uv/win.h
  11. +2 −9 deps/uv/src/inet.c
  12. +17 −0 deps/uv/src/strscpy.c
  13. +18 −0 deps/uv/src/strscpy.h
  14. +1 −1 deps/uv/src/timer.c
  15. +16 −16 deps/uv/src/unix/aix.c
  16. +1 −2 deps/uv/src/unix/darwin-proctitle.c
  17. +31 −11 deps/uv/src/unix/fs.c
  18. +3 −0 deps/uv/src/unix/linux-core.c
  19. +4 −2 deps/uv/src/unix/linux-inotify.c
  20. +2 −1 deps/uv/src/unix/netbsd.c
  21. +3 −3 deps/uv/src/unix/os390.c
  22. +2 −4 deps/uv/src/unix/pipe.c
  23. +2 −1 deps/uv/src/unix/sunos.c
  24. +1 −1 deps/uv/src/uv-common.c
  25. +1 −0 deps/uv/src/uv-common.h
  26. +9 −7 deps/uv/src/uv-data-getter-setters.c
  27. +5 −3 deps/uv/src/win/dl.c
  28. +4 −4 deps/uv/src/win/fs-event.c
  29. +39 −10 deps/uv/src/win/fs.c
  30. +3 −3 deps/uv/src/win/pipe.c
  31. +2 −2 deps/uv/src/win/poll.c
  32. +3 −3 deps/uv/src/win/process.c
  33. +3 −2 deps/uv/src/win/tty.c
  34. +3 −0 deps/uv/src/win/winapi.h
  35. +4 −4 deps/uv/test/run-tests.c
  36. +4 −3 deps/uv/test/runner-win.c
  37. +2 −0 deps/uv/test/runner-win.h
  38. +5 −1 deps/uv/test/test-close-fd.c
  39. +1 −1 deps/uv/test/test-condvar.c
  40. +10 −6 deps/uv/test/test-emfile.c
  41. +3 −0 deps/uv/test/test-fork.c
  42. +51 −5 deps/uv/test/test-fs.c
  43. +6 −1 deps/uv/test/test-ip4-addr.c
  44. +1 −1 deps/uv/test/test-ip6-addr.c
  45. +4 −0 deps/uv/test/test-list.h
  46. +4 −0 deps/uv/test/test-pipe-close-stdout-read-stdin.c
  47. +1 −1 deps/uv/test/test-platform-output.c
  48. +1 −1 deps/uv/test/test-poll-close-doesnt-corrupt-stack.c
  49. +5 −0 deps/uv/test/test-poll-oob.c
  50. +1 −2 deps/uv/test/test-process-title-threadsafe.c
  51. +2 −2 deps/uv/test/test-process-title.c
  52. +5 −1 deps/uv/test/test-signal-multiple-loops.c
  53. +7 −1 deps/uv/test/test-spawn.c
  54. +53 −0 deps/uv/test/test-strscpy.c
  55. +5 −1 deps/uv/test/test-tcp-close-accept.c
  56. +6 −1 deps/uv/test/test-tcp-oob.c
  57. +5 −1 deps/uv/test/test-tcp-write-after-connect.c
  58. +0 −2 deps/uv/test/test-tty.c
  59. +2 −1 deps/uv/test/test.gyp
  60. +2 −0 deps/uv/uv.gyp
@@ -42,7 +42,7 @@ Makefile.in
/android-toolchain

/out/
/build/gyp
/build/

/test/.libs/
/test/run-tests
@@ -356,3 +356,9 @@ hitesh <sainihitesh.scientist@gmail.com>
Svante Signell <svante.signell@gmail.com>
Samuel Thibault <sthibault@debian.org>
Jeremy Studer <studerj1.mail@gmail.com>
damon-kwok <563066990@qq.com>
Damon Kwok <MedusaIDE@outlook.com>
Ashe Connor <ashe@kivikakk.ee>
Rick <lcw0622@163.com>
Ivan Krylov <krylov.r00t@gmail.com>
Michael Meier <michael.meier@leica-geosystems.com>
@@ -15,6 +15,7 @@ set(uv_sources
src/fs-poll.c
src/idna.c
src/inet.c
src/strscpy.c
src/threadpool.c
src/timer.c
src/uv-common.c
@@ -116,6 +117,7 @@ set(uv_test_sources
test/test-socket-buffer-size.c
test/test-spawn.c
test/test-stdio-over-pipes.c
test/test-strscpy.c
test/test-tcp-alloc-cb-fail.c
test/test-tcp-bind-error.c
test/test-tcp-bind6-error.c
@@ -208,7 +210,11 @@ 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)
list(APPEND uv_libraries pthread)
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Android")
# Android has pthread as part of its c library, not as a separate
# libpthread.so.
list(APPEND uv_libraries pthread)
endif()
list(APPEND uv_sources
src/unix/async.c
src/unix/core.c
@@ -1,3 +1,36 @@
2018.12.17, Version 1.24.1 (Stable), 274f2bd3b70847cadd9a3965577a87e666ab9ac3

Changes since version 1.24.0:

* test: fix platform_output test on cygwin (damon-kwok)

* gitignore: ignore build/ directory (Damon Kwok)

* unix: zero epoll_event before use (Ashe Connor)

* darwin: use runtime check for file cloning (Ben Noordhuis)

* doc: replace deprecated build command on macOS (Rick)

* warnings: fix code that emits compiler warnings (Jameson Nash)

* doc: clarify expected memory management strategy (Ivan Krylov)

* test: add uv_inet_ntop(AF_INET) coverage (Ben Noordhuis)

* unix: harden string copying, introduce strscpy() (Ben Noordhuis)

* linux: get rid of strncpy() call (Ben Noordhuis)

* aix: get rid of strcat() calls (Ben Noordhuis)

* aix: fix data race in uv_fs_event_start() (Ben Noordhuis)

* win: fs: fix `FILE_FLAG_NO_BUFFERING` for writes (Joran Dirk Greef)

* build: don't link against -lpthread on Android (Michael Meier)


2018.11.14, Version 1.24.0 (Stable), 2d427ee0083d1baf995df4ebf79a3f8890e9a3e1

Changes since version 1.23.2:
@@ -32,6 +32,8 @@ libuv_la_SOURCES = src/fs-poll.c \
src/idna.c \
src/inet.c \
src/queue.h \
src/strscpy.c \
src/strscpy.h \
src/threadpool.c \
src/timer.c \
src/uv-data-getter-setters.c \
@@ -241,6 +243,7 @@ test_run_tests_SOURCES = test/blackhole-server.c \
test/test-socket-buffer-size.c \
test/test-spawn.c \
test/test-stdio-over-pipes.c \
test/test-strscpy.c \
test/test-tcp-alloc-cb-fail.c \
test/test-tcp-bind-error.c \
test/test-tcp-bind6-error.c \
@@ -262,8 +262,7 @@ Run:

```bash
$ ./gyp_uv.py -f xcode
$ xcodebuild -ARCHS="x86_64" -project uv.xcodeproj \
-configuration Release -target All
$ xcodebuild -ARCHS="x86_64" -project out/uv.xcodeproj -configuration Release -alltargets
```

Using Homebrew:
@@ -13,7 +13,7 @@
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

AC_PREREQ(2.57)
AC_INIT([libuv], [1.24.0], [https://github.com/libuv/libuv/issues])
AC_INIT([libuv], [1.24.1], [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])
@@ -140,6 +140,8 @@ API
Request handle to be closed. `close_cb` will be called asynchronously after
this call. This MUST be called on each handle before memory is released.
Moreover, the memory can only be released in `close_cb` or after it has
returned.
Handles that wrap file descriptors are closed immediately but
`close_cb` will still be deferred to the next iteration of the event loop.
@@ -32,7 +32,7 @@

#define UV_VERSION_MAJOR 1
#define UV_VERSION_MINOR 24
#define UV_VERSION_PATCH 0
#define UV_VERSION_PATCH 1
#define UV_VERSION_IS_RELEASE 1
#define UV_VERSION_SUFFIX ""

@@ -25,6 +25,7 @@

#if !defined(_SSIZE_T_) && !defined(_SSIZE_T_DEFINED)
typedef intptr_t ssize_t;
# define SSIZE_MAX INTPTR_MAX
# define _SSIZE_T_
# define _SSIZE_T_DEFINED
#endif
@@ -59,8 +59,7 @@ static int inet_ntop4(const unsigned char *src, char *dst, size_t size) {
if (l <= 0 || (size_t) l >= size) {
return UV_ENOSPC;
}
strncpy(dst, tmp, size);
dst[size - 1] = '\0';
uv__strscpy(dst, tmp, size);
return 0;
}

@@ -142,14 +141,8 @@ static int inet_ntop6(const unsigned char *src, char *dst, size_t size) {
if (best.base != -1 && (best.base + best.len) == ARRAY_SIZE(words))
*tp++ = ':';
*tp++ = '\0';

/*
* Check for overflow, copy, and we're done.
*/
if ((size_t)(tp - tmp) > size) {
if (UV_E2BIG == uv__strscpy(dst, tmp, size))
return UV_ENOSPC;
}
strcpy(dst, tmp);
return 0;
}

@@ -0,0 +1,17 @@
#include "strscpy.h"
#include <limits.h> /* SSIZE_MAX */

ssize_t uv__strscpy(char* d, const char* s, size_t n) {
size_t i;

for (i = 0; i < n; i++)
if ('\0' == (d[i] = s[i]))
return i > SSIZE_MAX ? UV_E2BIG : (ssize_t) i;

if (i == 0)
return 0;

d[--i] = '\0';

return UV_E2BIG;
}
@@ -0,0 +1,18 @@
#ifndef UV_STRSCPY_H_
#define UV_STRSCPY_H_

/* Include uv.h for its definitions of size_t and ssize_t.
* size_t can be obtained directly from <stddef.h> but ssize_t requires
* some hoop jumping on Windows that I didn't want to duplicate here.
*/
#include "uv.h"

/* Copies up to |n-1| bytes from |d| to |s| and always zero-terminates
* the result, except when |n==0|. Returns the number of bytes copied
* or UV_E2BIG if |d| is too small.
*
* See https://www.kernel.org/doc/htmldocs/kernel-api/API-strscpy.html
*/
ssize_t uv__strscpy(char* d, const char* s, size_t n);

#endif /* UV_STRSCPY_H_ */
@@ -152,7 +152,7 @@ int uv__next_timeout(const uv_loop_t* loop) {
if (diff > INT_MAX)
diff = INT_MAX;

return diff;
return (int) diff;
}


@@ -358,19 +358,15 @@ void uv_loadavg(double avg[3]) {


#ifdef HAVE_SYS_AHAFS_EVPRODS_H
static char *uv__rawname(char *cp) {
static char rawbuf[FILENAME_MAX+1];
char *dp = rindex(cp, '/');
static char* uv__rawname(const char* cp, char (*dst)[FILENAME_MAX+1]) {
char* dp;

dp = rindex(cp, '/');
if (dp == 0)
return 0;

*dp = 0;
strcpy(rawbuf, cp);
*dp = '/';
strcat(rawbuf, "/r");
strcat(rawbuf, dp+1);
return rawbuf;
snprintf(*dst, sizeof(*dst), "%.*s/r%s", (int) (dp - cp), cp, dp + 1);
return *dst;
}


@@ -399,6 +395,7 @@ static int uv__path_is_a_directory(char* filename) {
* Returns 0 if AHAFS is mounted, or an error code < 0 on failure
*/
static int uv__is_ahafs_mounted(void){
char rawbuf[FILENAME_MAX+1];
int rv, i = 2;
struct vmount *p;
int size_multiplier = 10;
@@ -432,7 +429,7 @@ static int uv__is_ahafs_mounted(void){
obj = vmt2dataptr(vmt, VMT_OBJECT); /* device */
stub = vmt2dataptr(vmt, VMT_STUB); /* mount point */

if (EQ(obj, dev) || EQ(uv__rawname(obj), dev) || EQ(stub, dev)) {
if (EQ(obj, dev) || EQ(uv__rawname(obj, &rawbuf), dev) || EQ(stub, dev)) {
uv__free(p); /* Found a match */
return 0;
}
@@ -453,7 +450,8 @@ static int uv__makedir_p(const char *dir) {
size_t len;
int err;

snprintf(tmp, sizeof(tmp),"%s",dir);
/* TODO(bnoordhuis) Check uv__strscpy() return value. */
uv__strscpy(tmp, dir, sizeof(tmp));
len = strlen(tmp);
if (tmp[len - 1] == '/')
tmp[len - 1] = 0;
@@ -702,9 +700,9 @@ static void uv__ahafs_event(uv_loop_t* loop, uv__io_t* event_watch, unsigned int
else
p++;
}
strncpy(fname, p, sizeof(fname) - 1);
/* Just in case */
fname[sizeof(fname) - 1] = '\0';

/* TODO(bnoordhuis) Check uv__strscpy() return value. */
uv__strscpy(fname, p, sizeof(fname));

handle->cb(handle, fname, events, 0);
}
@@ -735,7 +733,8 @@ int uv_fs_event_start(uv_fs_event_t* handle,
/* Figure out whether filename is absolute or not */
if (filename[0] == '/') {
/* We have absolute pathname */
snprintf(absolute_path, sizeof(absolute_path), "%s", filename);
/* TODO(bnoordhuis) Check uv__strscpy() return value. */
uv__strscpy(absolute_path, filename, sizeof(absolute_path));
} else {
/* We have a relative pathname, compose the absolute pathname */
snprintf(cwd, sizeof(cwd), "/proc/%lu/cwd", (unsigned long) getpid());
@@ -986,7 +985,8 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
return UV_ENOMEM;
}

strcpy(cpu_id.name, FIRST_CPU);
/* TODO(bnoordhuis) Check uv__strscpy() return value. */
uv__strscpy(cpu_id.name, FIRST_CPU, sizeof(cpu_id.name));
result = perfstat_cpu(&cpu_id, ps_cpus, sizeof(perfstat_cpu_t), ncpus);
if (result == -1) {
uv__free(ps_cpus);
@@ -192,8 +192,7 @@ void uv__set_process_title(const char* title) {

if (dynamic_pthread_setname_np != NULL) {
char namebuf[64]; /* MAXTHREADNAMESIZE */
strncpy(namebuf, title, sizeof(namebuf) - 1);
namebuf[sizeof(namebuf) - 1] = '\0';
uv__strscpy(namebuf, title, sizeof(namebuf));
dynamic_pthread_setname_np(namebuf);
}
}
@@ -61,6 +61,7 @@

#if defined(__APPLE__)
# include <copyfile.h>
# include <sys/sysctl.h>
#elif defined(__linux__) && !defined(FICLONE)
# include <sys/ioctl.h>
# define FICLONE _IOW(0x94, 9, int)
@@ -70,6 +71,10 @@
# include <utime.h>
#endif

#if defined(_AIX) && _XOPEN_SOURCE <= 600
extern char *mkdtemp(char *template); /* See issue #740 on AIX < 7 */
#endif

#define INIT(subtype) \
do { \
if (req == NULL) \
@@ -722,7 +727,7 @@ static ssize_t uv__fs_utime(uv_fs_t* req) {
atr.att_atimechg = 1;
atr.att_mtime = req->mtime;
atr.att_atime = req->atime;
return __lchattr(req->path, &atr, sizeof(atr));
return __lchattr((char*) req->path, &atr, sizeof(atr));
#else
errno = ENOSYS;
return -1;
@@ -793,26 +798,41 @@ static ssize_t uv__fs_write(uv_fs_t* req) {
static ssize_t uv__fs_copyfile(uv_fs_t* req) {
#if defined(__APPLE__) && !TARGET_OS_IPHONE
/* On macOS, use the native copyfile(3). */
static int can_clone;
copyfile_flags_t flags;
char buf[64];
size_t len;
int major;

flags = COPYFILE_ALL;

if (req->flags & UV_FS_COPYFILE_EXCL)
flags |= COPYFILE_EXCL;

#ifdef COPYFILE_CLONE
if (req->flags & UV_FS_COPYFILE_FICLONE)
flags |= COPYFILE_CLONE;
#endif

/* Check OS version. Cloning is only supported on macOS >= 10.12. */
if (req->flags & UV_FS_COPYFILE_FICLONE_FORCE) {
#ifdef COPYFILE_CLONE_FORCE
flags |= COPYFILE_CLONE_FORCE;
#else
return UV_ENOSYS;
#endif
if (can_clone == 0) {
len = sizeof(buf);
if (sysctlbyname("kern.osrelease", buf, &len, NULL, 0))
return UV__ERR(errno);

if (1 != sscanf(buf, "%d", &major))
abort();

can_clone = -1 + 2 * (major >= 16); /* macOS >= 10.12 */
}

if (can_clone < 0)
return UV_ENOSYS;
}

/* copyfile() simply ignores COPYFILE_CLONE if it's not supported. */
if (req->flags & UV_FS_COPYFILE_FICLONE)
flags |= 1 << 24; /* COPYFILE_CLONE */

if (req->flags & UV_FS_COPYFILE_FICLONE_FORCE)
flags |= 1 << 25; /* COPYFILE_CLONE_FORCE */

return copyfile(req->path, req->new_path, NULL, flags);
#else
uv_fs_t fs_req;
Oops, something went wrong.

0 comments on commit 155d1d5

Please sign in to comment.