Skip to content
Permalink
Browse files

deps: upgrade to libuv 1.31.0

Notable changes:

- UV_FS_O_FILEMAP has been added for faster access to memory
  mapped files on Windows.
- uv_fs_mkdir() now returns UV_EINVAL for invalid filenames
  on Windows. It previously returned UV_ENOENT.
- The uv_fs_statfs() API has been added.
- The uv_os_environ() and uv_os_free_environ() APIs have
  been added.

Fixes: #28599
Fixes: #28945
Fixes: #29008
PR-URL: #29070
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
  • Loading branch information...
cjihrig authored and targos committed Aug 9, 2019
1 parent 6f7b561 commit 2c91c65961db2a52f237ed35c9affa83f851dc89
Showing with 2,136 additions and 150 deletions.
  1. +1 −0 deps/uv/.gitignore
  2. +1 −0 deps/uv/.mailmap
  3. +7 −0 deps/uv/AUTHORS
  4. +2 −0 deps/uv/CMakeLists.txt
  5. +49 −0 deps/uv/ChangeLog
  6. +21 −0 deps/uv/Makefile.am
  7. +1 −1 deps/uv/README.md
  8. +2 −1 deps/uv/configure.ac
  9. +47 −0 deps/uv/docs/src/fs.rst
  10. +28 −0 deps/uv/docs/src/misc.rst
  11. +26 −1 deps/uv/include/uv.h
  12. +4 −2 deps/uv/include/uv/unix.h
  13. +2 −2 deps/uv/include/uv/version.h
  14. +1 −0 deps/uv/include/uv/win.h
  15. +60 −0 deps/uv/src/unix/core.c
  16. +79 −68 deps/uv/src/unix/darwin-proctitle.c
  17. +61 −0 deps/uv/src/unix/fs.c
  18. +1 −1 deps/uv/src/unix/openbsd.c
  19. +0 −4 deps/uv/src/unix/proctitle.c
  20. +1 −1 deps/uv/src/unix/stream.c
  21. +11 −0 deps/uv/src/uv-common.c
  22. +178 −0 deps/uv/src/win/fs-fd-hash-inl.h
  23. +450 −8 deps/uv/src/win/fs.c
  24. +2 −2 deps/uv/src/win/process.c
  25. +19 −2 deps/uv/src/win/tty.c
  26. +72 −3 deps/uv/src/win/util.c
  27. +8 −0 deps/uv/src/win/winapi.c
  28. +12 −0 deps/uv/src/win/winapi.h
  29. +6 −0 deps/uv/test/runner-win.c
  30. +4 −0 deps/uv/test/task.h
  31. +36 −1 deps/uv/test/test-env-vars.c
  32. +133 −0 deps/uv/test/test-fs-fd-hash.c
  33. +435 −0 deps/uv/test/test-fs-open-flags.c
  34. +294 −38 deps/uv/test/test-fs.c
  35. +2 −2 deps/uv/test/test-ipc.c
  36. +18 −0 deps/uv/test/test-list.h
  37. +1 −1 deps/uv/test/test-pipe-getsockname.c
  38. +5 −1 deps/uv/test/test-process-title-threadsafe.c
  39. +15 −11 deps/uv/test/test-queue-foreach-delete.c
  40. +28 −0 deps/uv/test/test-spawn.c
  41. +11 −0 deps/uv/test/test-tmpdir.c
  42. +2 −0 deps/uv/test/test.gyp
@@ -51,6 +51,7 @@ Makefile.in
/test/run-benchmarks
/test/run-benchmarks.exe
/test/run-benchmarks.dSYM
test_file_*

*.sln
*.sln.cache
@@ -38,6 +38,7 @@ Sam Roberts <vieuxtech@gmail.com> <sam@strongloop.com>
San-Tai Hsu <vanilla@fatpipi.com>
Santiago Gimeno <santiago.gimeno@quantion.es> <santiago.gimeno@gmail.com>
Saúl Ibarra Corretgé <saghul@gmail.com>
Saúl Ibarra Corretgé <saghul@gmail.com> <s@saghul.net>
Shigeki Ohtsu <ohtsu@iij.ad.jp> <ohtsu@ohtsu.org>
Timothy J. Fontaine <tjfontaine@gmail.com>
Yasuhiro Matsumoto <mattn.jp@gmail.com>
@@ -389,3 +389,10 @@ Jenil Christo <jenilchristo5@gmail.com>
Evgeny Ermakov <evgeny.v.ermakov@gmail.com>
gengjiawen <technicalcute@gmail.com>
Leo Chung <gewalalb@gmail.com>
Javier Blazquez <jblazquez@riotgames.com>
Mustafa M <mus-m@outlook.com>
Zach Bjornson <zbbjornson@gmail.com>
Nan Xiao <nan@chinadtrace.org>
Ben Davies <kaiepi@outlook.com>
Nhan Khong <knhana7@gmail.com>
Crunkle <justcrunkle@hotmail.co.uk>
@@ -53,6 +53,8 @@ set(uv_test_sources
test/test-fs-poll.c
test/test-fs.c
test/test-fs-readdir.c
test/test-fs-fd-hash.c
test/test-fs-open-flags.c
test/test-get-currentexe.c
test/test-get-loadavg.c
test/test-get-memory.c
@@ -1,3 +1,52 @@
2019.08.10, Version 1.31.0 (Stable), 0a6771cee4c15184c924bfe9d397bdd0c3b206ba

Changes since version 1.30.1:

* win,fs: don't modify global file translation mode (Javier Blazquez)

* win: fix uv_os_tmpdir when env var is 260 chars (Mustafa M)

* win: prevent tty event explosion machine hang (Javier Blazquez)

* win: add UV_FS_O_FILEMAP (João Reis)

* win, fs: mkdir return UV_EINVAL for invalid names (Bartosz Sosnowski)

* github: add root warning to template (cjihrig)

* win: misc fs cleanup (cjihrig)

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

* test: avoid AF_LOCAL (Carlo Marcelo Arenas Belón)

* unix,win: add ability to retrieve all env variables (Saúl Ibarra Corretgé)

* Revert "darwin: speed up uv_set_process_title()" (Ben Noordhuis)

* doc: add %p to valgrind log-file arg (Zach Bjornson)

* doc: fix typo in basics.rst (Nan Xiao)

* ibmi: support Makefile build for IBM i (Xu Meng)

* OpenBSD: only get active CPU core count (Ben Davies)

* test: fix gcc 8 warnings for tests (Nhan Khong)

* ibmi: use correct header files (Xu Meng)

* unix: clear UV_HANDLE_READING flag before callback (zyxwvu Shi)

* unix: fix unused-function warning on BSD (Nhan Khong)

* test: fix test runner on MinGW (Crunkle)

* win: remove try-except outside MSVC (Crunkle)

* win: fix uv_spawn() ENOMEM on empty env (Ben Noordhuis)


2019.07.03, Version 1.30.1 (Stable), 1551969c84c2f546a429dac169c7fdac3e38115e

Changes since version 1.30.0:
@@ -184,6 +184,8 @@ test_run_tests_SOURCES = test/blackhole-server.c \
test/test-fs-poll.c \
test/test-fs.c \
test/test-fs-readdir.c \
test/test-fs-fd-hash.c \
test/test-fs-open-flags.c \
test/test-fork.c \
test/test-getters-setters.c \
test/test-get-currentexe.c \
@@ -322,6 +324,12 @@ test_run_tests_CFLAGS += -D_ALL_SOURCE \
-D_LINUX_SOURCE_COMPAT
endif

if OS400
test_run_tests_CFLAGS += -D_ALL_SOURCE \
-D_XOPEN_SOURCE=500 \
-D_LINUX_SOURCE_COMPAT
endif

if HAIKU
test_run_tests_CFLAGS += -D_BSD_SOURCE
endif
@@ -362,6 +370,19 @@ uvinclude_HEADERS += include/uv/aix.h
libuv_la_SOURCES += src/unix/aix.c src/unix/aix-common.c
endif

if OS400
libuv_la_CFLAGS += -D_ALL_SOURCE \
-D_XOPEN_SOURCE=500 \
-D_LINUX_SOURCE_COMPAT \
-D_THREAD_SAFE
uvinclude_HEADERS += include/uv/posix.h
libuv_la_SOURCES += src/unix/aix-common.c \
src/unix/ibmi.c \
src/unix/posix-poll.c \
src/unix/no-fsevents.c \
src/unix/no-proctitle.c
endif

if ANDROID
uvinclude_HEADERS += include/uv/android-ifaddrs.h
libuv_la_SOURCES += src/unix/android-ifaddrs.c \
@@ -387,7 +387,7 @@ $ gdb --args out/Debug/run-tests TEST_NAME
Use the `--trace-children=yes` parameter:

```bash
$ valgrind --trace-children=yes -v --tool=memcheck --leak-check=full --track-origins=yes --leak-resolution=high --show-reachable=yes --log-file=memcheck.log out/Debug/run-tests TEST_NAME
$ valgrind --trace-children=yes -v --tool=memcheck --leak-check=full --track-origins=yes --leak-resolution=high --show-reachable=yes --log-file=memcheck-%p.log out/Debug/run-tests TEST_NAME
```

### Running benchmarks
@@ -13,7 +13,7 @@
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

AC_PREREQ(2.57)
AC_INIT([libuv], [1.30.1], [https://github.com/libuv/libuv/issues])
AC_INIT([libuv], [1.31.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])
@@ -63,6 +63,7 @@ AM_CONDITIONAL([MSYS], [AS_CASE([$host_os],[msys*], [true], [false])
AM_CONDITIONAL([NETBSD], [AS_CASE([$host_os],[netbsd*], [true], [false])])
AM_CONDITIONAL([OPENBSD], [AS_CASE([$host_os],[openbsd*], [true], [false])])
AM_CONDITIONAL([OS390], [AS_CASE([$host_os],[openedition*], [true], [false])])
AM_CONDITIONAL([OS400], [AS_CASE([$host_os],[os400], [true], [false])])
AM_CONDITIONAL([SUNOS], [AS_CASE([$host_os],[solaris*], [true], [false])])
AM_CONDITIONAL([WINNT], [AS_CASE([$host_os],[mingw*], [true], [false])])
AS_CASE([$host_os],[mingw*], [
@@ -102,6 +102,24 @@ Data types
UV_FS_CLOSEDIR
} uv_fs_type;

.. c:type:: uv_statfs_t
Reduced cross platform equivalent of ``struct statfs``.
Used in :c:func:`uv_fs_statfs`.

::

typedef struct uv_statfs_s {
uint64_t f_type;
uint64_t f_bsize;
uint64_t f_blocks;
uint64_t f_bfree;
uint64_t f_bavail;
uint64_t f_files;
uint64_t f_ffree;
uint64_t f_spare[4];
} uv_statfs_t;

.. c:type:: uv_dirent_t
Cross platform (reduced) equivalent of ``struct dirent``.
@@ -200,6 +218,11 @@ API
Equivalent to :man:`preadv(2)`.
.. warning::
On Windows, under non-MSVC environments (e.g. when GCC or Clang is used
to build libuv), files opened using ``UV_FS_O_FILEMAP`` may cause a fatal
crash if the memory mapped read operation fails.
.. c:function:: int uv_fs_unlink(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb)
Equivalent to :man:`unlink(2)`.
@@ -208,6 +231,11 @@ API
Equivalent to :man:`pwritev(2)`.
.. warning::
On Windows, under non-MSVC environments (e.g. when GCC or Clang is used
to build libuv), files opened using ``UV_FS_O_FILEMAP`` may cause a fatal
crash if the memory mapped write operation fails.
.. c:function:: int uv_fs_mkdir(uv_loop_t* loop, uv_fs_t* req, const char* path, int mode, uv_fs_cb cb)
Equivalent to :man:`mkdir(2)`.
@@ -290,6 +318,17 @@ API
Equivalent to :man:`stat(2)`, :man:`fstat(2)` and :man:`lstat(2)` respectively.
.. c:function:: int uv_fs_statfs(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb)
Equivalent to :man:`statfs(2)`. On success, a `uv_statfs_t` is allocated
and returned via `req->ptr`. This memory is freed by `uv_fs_req_cleanup()`.
.. note::
Any fields in the resulting `uv_statfs_t` that are not supported by the
underlying operating system are set to zero.
.. versionadded:: 1.31.0
.. c:function:: int uv_fs_rename(uv_loop_t* loop, uv_fs_t* req, const char* path, const char* new_path, uv_fs_cb cb)
Equivalent to :man:`rename(2)`.
@@ -534,6 +573,14 @@ File open constants
.. versionchanged:: 1.17.0 support is added for Windows.
.. c:macro:: UV_FS_O_FILEMAP
Use a memory file mapping to access the file. When using this flag, the
file cannot be open multiple times concurrently.
.. note::
`UV_FS_O_FILEMAP` is only supported on Windows.
.. c:macro:: UV_FS_O_NOATIME
Do not update the file access time when the file is read.
@@ -180,6 +180,17 @@ Data types
char machine[256];
} uv_utsname_t;

.. c:type:: uv_env_item_t
Data type for environment variable storage.

::

typedef struct uv_env_item_s {
char* name;
char* value;
} uv_env_item_t;


API
---
@@ -523,6 +534,23 @@ API
.. versionadded:: 1.8.0
.. c:function:: int uv_os_environ(uv_env_item_t** envitems, int* count)
Retrieves all environment variables. This function will allocate memory
which must be freed by calling :c:func:`uv_os_free_environ`.
.. warning::
This function is not thread safe.
.. versionadded:: 1.31.0
.. c:function:: void uv_os_free_environ(uv_env_item_t* envitems, int count);
Frees the memory allocated for the environment variables by
:c:func:`uv_os_environ`.

.. versionadded:: 1.31.0

.. c:function:: int uv_os_getenv(const char* name, char* buffer, size_t* size)
Retrieves the environment variable specified by `name`, copies its value
@@ -231,11 +231,13 @@ typedef struct uv_fs_s uv_fs_t;
typedef struct uv_work_s uv_work_t;

/* None of the above. */
typedef struct uv_env_item_s uv_env_item_t;
typedef struct uv_cpu_info_s uv_cpu_info_t;
typedef struct uv_interface_address_s uv_interface_address_t;
typedef struct uv_dirent_s uv_dirent_t;
typedef struct uv_passwd_s uv_passwd_t;
typedef struct uv_utsname_s uv_utsname_t;
typedef struct uv_statfs_s uv_statfs_t;

typedef enum {
UV_LOOP_BLOCK_SIGNAL
@@ -1070,6 +1072,17 @@ struct uv_utsname_s {
to as meaningless in the docs. */
};

struct uv_statfs_s {
uint64_t f_type;
uint64_t f_bsize;
uint64_t f_blocks;
uint64_t f_bfree;
uint64_t f_bavail;
uint64_t f_files;
uint64_t f_ffree;
uint64_t f_spare[4];
};

typedef enum {
UV_DIRENT_UNKNOWN,
UV_DIRENT_FILE,
@@ -1150,6 +1163,13 @@ UV_EXTERN int uv_interface_addresses(uv_interface_address_t** addresses,
UV_EXTERN void uv_free_interface_addresses(uv_interface_address_t* addresses,
int count);

struct uv_env_item_s {
char* name;
char* value;
};

UV_EXTERN int uv_os_environ(uv_env_item_t** envitems, int* count);
UV_EXTERN void uv_os_free_environ(uv_env_item_t* envitems, int count);
UV_EXTERN int uv_os_getenv(const char* name, char* buffer, size_t* size);
UV_EXTERN int uv_os_setenv(const char* name, const char* value);
UV_EXTERN int uv_os_unsetenv(const char* name);
@@ -1205,7 +1225,8 @@ typedef enum {
UV_FS_LCHOWN,
UV_FS_OPENDIR,
UV_FS_READDIR,
UV_FS_CLOSEDIR
UV_FS_CLOSEDIR,
UV_FS_STATFS
} uv_fs_type;

struct uv_dir_s {
@@ -1433,6 +1454,10 @@ UV_EXTERN int uv_fs_lchown(uv_loop_t* loop,
uv_uid_t uid,
uv_gid_t gid,
uv_fs_cb cb);
UV_EXTERN int uv_fs_statfs(uv_loop_t* loop,
uv_fs_t* req,
const char* path,
uv_fs_cb cb);


enum uv_fs_event {
@@ -49,6 +49,8 @@
# include "uv/linux.h"
#elif defined (__MVS__)
# include "uv/os390.h"
#elif defined(__PASE__) /* __PASE__ and _AIX are both defined on IBM i */
# include "uv/posix.h" /* IBM i needs uv/posix.h, not uv/aix.h */
#elif defined(_AIX)
# include "uv/aix.h"
#elif defined(__sun)
@@ -61,8 +63,7 @@
defined(__OpenBSD__) || \
defined(__NetBSD__)
# include "uv/bsd.h"
#elif defined(__PASE__) || \
defined(__CYGWIN__) || \
#elif defined(__CYGWIN__) || \
defined(__MSYS__) || \
defined(__GNU__)
# include "uv/posix.h"
@@ -481,6 +482,7 @@ typedef struct {
#endif

/* fs open() flags supported on other platforms: */
#define UV_FS_O_FILEMAP 0
#define UV_FS_O_RANDOM 0
#define UV_FS_O_SHORT_LIVED 0
#define UV_FS_O_SEQUENTIAL 0
@@ -31,8 +31,8 @@
*/

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

@@ -668,6 +668,7 @@ typedef struct {
#define UV_FS_O_APPEND _O_APPEND
#define UV_FS_O_CREAT _O_CREAT
#define UV_FS_O_EXCL _O_EXCL
#define UV_FS_O_FILEMAP 0x20000000
#define UV_FS_O_RANDOM _O_RANDOM
#define UV_FS_O_RDONLY _O_RDONLY
#define UV_FS_O_RDWR _O_RDWR

0 comments on commit 2c91c65

Please sign in to comment.
You can’t perform that action at this time.