summaryrefslogtreecommitdiff
path: root/deps/uv
diff options
context:
space:
mode:
authorcjihrig <cjihrig@gmail.com>2017-11-10 12:15:10 -0500
committercjihrig <cjihrig@gmail.com>2017-11-10 13:32:42 -0500
commit766cd1f59d5adb03953656391e63b4186c9aff10 (patch)
treebbcbb6ac69913e6fa60c971f68d62b090906719f /deps/uv
parent6f02da255f803719cda330f69213ad9a11ef4b04 (diff)
downloadandroid-node-v8-766cd1f59d5adb03953656391e63b4186c9aff10.tar.gz
android-node-v8-766cd1f59d5adb03953656391e63b4186c9aff10.tar.bz2
android-node-v8-766cd1f59d5adb03953656391e63b4186c9aff10.zip
deps: upgrade libuv to 1.16.1
PR-URL: https://github.com/nodejs/node/pull/16835 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'deps/uv')
-rw-r--r--deps/uv/.mailmap1
-rw-r--r--deps/uv/AUTHORS3
-rw-r--r--deps/uv/ChangeLog52
-rw-r--r--deps/uv/Makefile.am1
-rw-r--r--deps/uv/appveyor.yml2
-rw-r--r--deps/uv/configure.ac2
-rw-r--r--deps/uv/docs/src/fs.rst151
-rw-r--r--deps/uv/docs/src/loop.rst3
-rw-r--r--deps/uv/docs/src/misc.rst66
-rw-r--r--deps/uv/docs/src/pipe.rst9
-rw-r--r--deps/uv/include/uv-errno.h6
-rw-r--r--deps/uv/include/uv-unix.h94
-rw-r--r--deps/uv/include/uv-version.h4
-rw-r--r--deps/uv/include/uv-win.h26
-rw-r--r--deps/uv/include/uv.h18
-rw-r--r--deps/uv/src/unix/core.c5
-rw-r--r--deps/uv/src/unix/fs.c27
-rw-r--r--deps/uv/src/unix/getaddrinfo.c30
-rw-r--r--deps/uv/src/unix/kqueue.c1
-rw-r--r--deps/uv/src/unix/loop.c2
-rw-r--r--deps/uv/src/unix/os390-syscalls.c31
-rw-r--r--deps/uv/src/unix/pipe.c53
-rw-r--r--deps/uv/src/win/dl.c10
-rw-r--r--deps/uv/src/win/fs.c102
-rw-r--r--deps/uv/src/win/getaddrinfo.c71
-rw-r--r--deps/uv/src/win/internal.h1
-rw-r--r--deps/uv/src/win/pipe.c88
-rw-r--r--deps/uv/src/win/stream-inl.h3
-rw-r--r--deps/uv/src/win/util.c2
-rw-r--r--deps/uv/test/benchmark-pump.c4
-rw-r--r--deps/uv/test/runner.c9
-rw-r--r--deps/uv/test/test-fork.c2
-rw-r--r--deps/uv/test/test-fs.c114
-rw-r--r--deps/uv/test/test-ip6-addr.c31
-rw-r--r--deps/uv/test/test-list.h12
-rw-r--r--deps/uv/test/test-pipe-set-fchmod.c66
-rw-r--r--deps/uv/test/test-platform-output.c5
-rw-r--r--deps/uv/test/test-spawn.c4
-rw-r--r--deps/uv/uv.gyp1
39 files changed, 1035 insertions, 77 deletions
diff --git a/deps/uv/.mailmap b/deps/uv/.mailmap
index 500c2b5185..da4214365c 100644
--- a/deps/uv/.mailmap
+++ b/deps/uv/.mailmap
@@ -26,6 +26,7 @@ Marc Schlaich <marc.schlaich@googlemail.com> <marc.schlaich@gmail.com>
Michael <michael_dawson@ca.ibm.com>
Michael Neumann <mneumann@think.localnet> <mneumann@ntecs.de>
Nicholas Vavilov <vvnicholas@gmail.com>
+Nick Logan <ugexe@cpan.org> <nlogan@gmail.com>
Rasmus Christian Pedersen <zerhacken@yahoo.com>
Rasmus Christian Pedersen <zerhacken@yahoo.com> <ruysch@outlook.com>
Robert Mustacchi <rm@joyent.com> <rm@fingolfin.org>
diff --git a/deps/uv/AUTHORS b/deps/uv/AUTHORS
index 4747c06b30..03255534fa 100644
--- a/deps/uv/AUTHORS
+++ b/deps/uv/AUTHORS
@@ -315,3 +315,6 @@ darobs <darobs@microsoft.com>
Zheng, Lei <realthunder.dev@gmail.com>
Carlo Marcelo Arenas Belón <carenas@gmail.com>
Scott Parker <scott.parker087@gmail.com>
+Wade Brainerd <Wade.Brainerd@activision.com>
+rayrase <rmartinez2175@eagle.fgcu.edu>
+Pekka Nikander <pekka.nikander@iki.fi>
diff --git a/deps/uv/ChangeLog b/deps/uv/ChangeLog
index 64b18695e1..595b387127 100644
--- a/deps/uv/ChangeLog
+++ b/deps/uv/ChangeLog
@@ -1,3 +1,55 @@
+2017.11.11, Version 1.16.1 (Stable), 4056fbe46493ef87237e307e0025e551db875e13
+
+Changes since version 1.16.0:
+
+* unix: move net/if.h include (cjihrig)
+
+* win: fix undeclared NDIS_IF_MAX_STRING_SIZE (Nick Logan)
+
+
+2017.11.07, Version 1.16.0 (Stable), d68779f0ea742918f653b9c20237460271c39aeb
+
+Changes since version 1.15.0:
+
+* win: change st_blksize from `2048` to `4096` (Joran Dirk Greef)
+
+* unix,win: add fs open flags, map O_DIRECT|O_DSYNC (Joran Dirk Greef)
+
+* win, fs: fix non-symlink reparse points (Wade Brainerd)
+
+* test: fix -Wstrict-prototypes warnings (Ben Noordhuis)
+
+* unix, windows: map ENOTTY errno (Ben Noordhuis)
+
+* unix: fall back to fsync() if F_FULLFSYNC fails (Joran Dirk Greef)
+
+* unix: do not close invalid kqueue fd after fork (jBarz)
+
+* zos: reset epoll data after fork (jBarz)
+
+* zos: skip fork_threadpool_queue_work_simple (jBarz)
+
+* test: keep platform_output as first test (Bartosz Sosnowski)
+
+* win: fix non-English dlopen error message (Bartosz Sosnowski)
+
+* unix,win: add uv_os_getppid() (cjihrig)
+
+* test: fix const qualification compiler warning (Ben Noordhuis)
+
+* doc: mark uv_default_loop() as not thread safe (rayrase)
+
+* win, pipe: null-initialize stream->shutdown_req (Jameson Nash)
+
+* tty, win: get SetWinEventHook pointer at startup (Bartosz Sosnowski)
+
+* test: no extra new line in skipped test output (Bartosz Sosnowski)
+
+* pipe: allow access from other users (Bartosz Sosnowski)
+
+* unix,win: add uv_if_{indextoname,indextoiid} (Pekka Nikander)
+
+
2017.10.03, Version 1.15.0 (Stable), 8b69ce1419d2958011d415a636810705c36c2cc2
Changes since version 1.14.1:
diff --git a/deps/uv/Makefile.am b/deps/uv/Makefile.am
index b94fdd63b5..6e548a69c3 100644
--- a/deps/uv/Makefile.am
+++ b/deps/uv/Makefile.am
@@ -212,6 +212,7 @@ test_run_tests_SOURCES = test/blackhole-server.c \
test/test-pipe-server-close.c \
test/test-pipe-close-stdout-read-stdin.c \
test/test-pipe-set-non-blocking.c \
+ test/test-pipe-set-fchmod.c \
test/test-platform-output.c \
test/test-poll.c \
test/test-poll-close.c \
diff --git a/deps/uv/appveyor.yml b/deps/uv/appveyor.yml
index f519bc099b..8ad69718b6 100644
--- a/deps/uv/appveyor.yml
+++ b/deps/uv/appveyor.yml
@@ -1,4 +1,4 @@
-version: v1.15.0.build{build}
+version: v1.16.1.build{build}
init:
- git config --global core.autocrlf true
diff --git a/deps/uv/configure.ac b/deps/uv/configure.ac
index ebf5bc3d8e..5fc0f72434 100644
--- a/deps/uv/configure.ac
+++ b/deps/uv/configure.ac
@@ -13,7 +13,7 @@
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
AC_PREREQ(2.57)
-AC_INIT([libuv], [1.15.0], [https://github.com/libuv/libuv/issues])
+AC_INIT([libuv], [1.16.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])
diff --git a/deps/uv/docs/src/fs.rst b/deps/uv/docs/src/fs.rst
index 2db915bc9e..f46c4e761a 100644
--- a/deps/uv/docs/src/fs.rst
+++ b/deps/uv/docs/src/fs.rst
@@ -353,3 +353,154 @@ Helper functions
any attempts to close it or to use it after closing the fd may lead to malfunction.
.. versionadded:: 1.12.0
+
+File open constants
+-------------------
+
+.. c:macro:: UV_FS_O_APPEND
+
+ The file is opened in append mode. Before each write, the file offset is
+ positioned at the end of the file.
+
+.. c:macro:: UV_FS_O_CREAT
+
+ The file is created if it does not already exist.
+
+.. c:macro:: UV_FS_O_DIRECT
+
+ File I/O is done directly to and from user-space buffers, which must be
+ aligned. Buffer size and address should be a multiple of the physical sector
+ size of the block device.
+
+ .. note::
+ `UV_FS_O_DIRECT` is supported on Linux, and on Windows via
+ `FILE_FLAG_NO_BUFFERING <https://msdn.microsoft.com/en-us/library/windows/desktop/cc644950.aspx>`_.
+ `UV_FS_O_DIRECT` is not supported on macOS.
+
+.. c:macro:: UV_FS_O_DIRECTORY
+
+ If the path is not a directory, fail the open.
+
+ .. note::
+ `UV_FS_O_DIRECTORY` is not supported on Windows.
+
+.. c:macro:: UV_FS_O_DSYNC
+
+ The file is opened for synchronous I/O. Write operations will complete once
+ all data and a minimum of metadata are flushed to disk.
+
+ .. note::
+ `UV_FS_O_DSYNC` is supported on Windows via
+ `FILE_FLAG_WRITE_THROUGH <https://msdn.microsoft.com/en-us/library/windows/desktop/cc644950.aspx>`_.
+
+.. c:macro:: UV_FS_O_EXCL
+
+ If the `O_CREAT` flag is set and the file already exists, fail the open.
+
+ .. note::
+ In general, the behavior of `O_EXCL` is undefined if it is used without
+ `O_CREAT`. There is one exception: on Linux 2.6 and later, `O_EXCL` can
+ be used without `O_CREAT` if pathname refers to a block device. If the
+ block device is in use by the system (e.g., mounted), the open will fail
+ with the error `EBUSY`.
+
+.. c:macro:: UV_FS_O_EXLOCK
+
+ Atomically obtain an exclusive lock.
+
+ .. note::
+ `UV_FS_O_EXLOCK` is only supported on macOS.
+
+.. c:macro:: UV_FS_O_NOATIME
+
+ Do not update the file access time when the file is read.
+
+ .. note::
+ `UV_FS_O_NOATIME` is not supported on Windows.
+
+.. c:macro:: UV_FS_O_NOCTTY
+
+ If the path identifies a terminal device, opening the path will not cause
+ that terminal to become the controlling terminal for the process (if the
+ process does not already have one).
+
+ .. note::
+ `UV_FS_O_NOCTTY` is not supported on Windows.
+
+.. c:macro:: UV_FS_O_NOFOLLOW
+
+ If the path is a symbolic link, fail the open.
+
+ .. note::
+ `UV_FS_O_NOFOLLOW` is not supported on Windows.
+
+.. c:macro:: UV_FS_O_NONBLOCK
+
+ Open the file in nonblocking mode if possible.
+
+ .. note::
+ `UV_FS_O_NONBLOCK` is not supported on Windows.
+
+.. c:macro:: UV_FS_O_RANDOM
+
+ Access is intended to be random. The system can use this as a hint to
+ optimize file caching.
+
+ .. note::
+ `UV_FS_O_RANDOM` is only supported on Windows via
+ `FILE_FLAG_RANDOM_ACCESS <https://msdn.microsoft.com/en-us/library/windows/desktop/aa363858.aspx>`_.
+
+.. c:macro:: UV_FS_O_RDONLY
+
+ Open the file for read-only access.
+
+.. c:macro:: UV_FS_O_RDWR
+
+ Open the file for read-write access.
+
+.. c:macro:: UV_FS_O_SEQUENTIAL
+
+ Access is intended to be sequential from beginning to end. The system can
+ use this as a hint to optimize file caching.
+
+ .. note::
+ `UV_FS_O_SEQUENTIAL` is only supported on Windows via
+ `FILE_FLAG_SEQUENTIAL_SCAN <https://msdn.microsoft.com/en-us/library/windows/desktop/aa363858.aspx>`_.
+
+.. c:macro:: UV_FS_O_SHORT_LIVED
+
+ The file is temporary and should not be flushed to disk if possible.
+
+ .. note::
+ `UV_FS_O_SHORT_LIVED` is only supported on Windows via
+ `FILE_ATTRIBUTE_TEMPORARY <https://msdn.microsoft.com/en-us/library/windows/desktop/aa363858.aspx>`_.
+
+.. c:macro:: UV_FS_O_SYMLINK
+
+ Open the symbolic link itself rather than the resource it points to.
+
+.. c:macro:: UV_FS_O_SYNC
+
+ The file is opened for synchronous I/O. Write operations will complete once
+ all data and all metadata are flushed to disk.
+
+ .. note::
+ `UV_FS_O_SYNC` is supported on Windows via
+ `FILE_FLAG_WRITE_THROUGH <https://msdn.microsoft.com/en-us/library/windows/desktop/cc644950.aspx>`_.
+
+.. c:macro:: UV_FS_O_TEMPORARY
+
+ The file is temporary and should not be flushed to disk if possible.
+
+ .. note::
+ `UV_FS_O_TEMPORARY` is only supported on Windows via
+ `FILE_ATTRIBUTE_TEMPORARY <https://msdn.microsoft.com/en-us/library/windows/desktop/aa363858.aspx>`_.
+
+.. c:macro:: UV_FS_O_TRUNC
+
+ If the file exists and is a regular file, and the file is opened
+ successfully for write access, its length shall be truncated to zero.
+
+.. c:macro:: UV_FS_O_WRONLY
+
+ Open the file for write-only access.
diff --git a/deps/uv/docs/src/loop.rst b/deps/uv/docs/src/loop.rst
index 02543171de..c63f813993 100644
--- a/deps/uv/docs/src/loop.rst
+++ b/deps/uv/docs/src/loop.rst
@@ -86,6 +86,9 @@ API
should) be closed with :c:func:`uv_loop_close` so the resources associated
with it are freed.
+ .. warning::
+ This function is not thread safe.
+
.. c:function:: int uv_run(uv_loop_t* loop, uv_run_mode mode)
This function runs the event loop. It will act differently depending on the
diff --git a/deps/uv/docs/src/misc.rst b/deps/uv/docs/src/misc.rst
index 3fea708a8d..2968d1cea1 100644
--- a/deps/uv/docs/src/misc.rst
+++ b/deps/uv/docs/src/misc.rst
@@ -59,6 +59,12 @@ Data types
Abstract representation of a file descriptor. On Unix systems this is a
`typedef` of `int` and on Windows a `HANDLE`.
+.. c:type:: uv_pid_t
+
+ Cross platform representation of a `pid_t`.
+
+ .. versionadded:: 1.16.0
+
.. c:type:: uv_rusage_t
Data type for resource usage results.
@@ -221,6 +227,12 @@ API
On Windows not all fields are set, the unsupported fields are filled with zeroes.
See :c:type:`uv_rusage_t` for more details.
+.. c:function:: uv_pid_t uv_os_getppid(void)
+
+ Returns the parent process ID.
+
+ .. versionadded:: 1.16.0
+
.. c:function:: int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count)
Gets information about the CPUs on the system. The `cpu_infos` array will
@@ -271,6 +283,60 @@ API
and :man:`inet_pton(3)`. On success they return 0. In case of error
the target `dst` pointer is unmodified.
+.. c:macro:: UV_IF_NAMESIZE
+
+ Maximum IPv6 interface identifier name length. Defined as
+ `IFNAMSIZ` on Unix and `IF_NAMESIZE` on Linux and Windows.
+
+ .. versionadded:: 1.16.0
+
+.. c:function:: int uv_if_indextoname(unsigned int ifindex, char* buffer, size_t* size)
+
+ IPv6-capable implementation of :man:`if_indextoname(3)`. When called,
+ `*size` indicates the length of the `buffer`, which is used to store the
+ result.
+ On success, zero is returned, `buffer` contains the interface name, and
+ `*size` represents the string length of the `buffer`, excluding the NUL
+ terminator byte from `*size`. On error, a negative result is
+ returned. If `buffer` is not large enough to hold the result,
+ `UV_ENOBUFS` is returned, and `*size` represents the necessary size in
+ bytes, including the NUL terminator byte into the `*size`.
+
+ On Unix, the returned interface name can be used directly as an
+ interface identifier in scoped IPv6 addresses, e.g.
+ `fe80::abc:def1:2345%en0`.
+
+ On Windows, the returned interface cannot be used as an interface
+ identifier, as Windows uses numerical interface identifiers, e.g.
+ `fe80::abc:def1:2345%5`.
+
+ To get an interface identifier in a cross-platform compatible way,
+ use `uv_if_indextoiid()`.
+
+ Example:
+
+ ::
+
+ char ifname[UV_IF_NAMESIZE];
+ size_t size = sizeof(ifname);
+ uv_if_indextoname(sin6->sin6_scope_id, ifname, &size);
+
+ .. versionadded:: 1.16.0
+
+.. c:function:: int uv_if_indextoiid(unsigned int ifindex, char* buffer, size_t* size)
+
+ Retrieves a network interface identifier suitable for use in an IPv6 scoped
+ address. On Windows, returns the numeric `ifindex` as a string. On all other
+ platforms, `uv_if_indextoname()` is called. The result is written to
+ `buffer`, with `*size` indicating the length of `buffer`. If `buffer` is not
+ large enough to hold the result, then `UV_ENOBUFS` is returned, and `*size`
+ represents the size, including the NUL byte, required to hold the
+ result.
+
+ See `uv_if_indextoname` for further details.
+
+ .. versionadded:: 1.16.0
+
.. c:function:: int uv_exepath(char* buffer, size_t* size)
Gets the executable path.
diff --git a/deps/uv/docs/src/pipe.rst b/deps/uv/docs/src/pipe.rst
index d33b0f2b97..bdaeeba9d4 100644
--- a/deps/uv/docs/src/pipe.rst
+++ b/deps/uv/docs/src/pipe.rst
@@ -102,3 +102,12 @@ API
and call ``uv_accept(pipe, handle)``.
.. seealso:: The :c:type:`uv_stream_t` API functions also apply.
+
+.. c:function:: int uv_pipe_chmod(uv_pipe_t* handle, int flags)
+
+ Alters pipe permissions, allowing it to be accessed from processes run by
+ different users. Makes the pipe writable or readable by all users. Mode can
+ be ``UV_WRITABLE``, ``UV_READABLE`` or ``UV_WRITABLE | UV_READABLE``. This
+ function is blocking.
+
+ .. versionadded:: 1.16.0
diff --git a/deps/uv/include/uv-errno.h b/deps/uv/include/uv-errno.h
index 32bbc5177e..8a41533147 100644
--- a/deps/uv/include/uv-errno.h
+++ b/deps/uv/include/uv-errno.h
@@ -422,4 +422,10 @@
# define UV__EREMOTEIO (-4030)
#endif
+#if defined(ENOTTY) && !defined(_WIN32)
+# define UV__ENOTTY (-ENOTTY)
+#else
+# define UV__ENOTTY (-4029)
+#endif
+
#endif /* UV_ERRNO_H_ */
diff --git a/deps/uv/include/uv-unix.h b/deps/uv/include/uv-unix.h
index d7754509b1..6565ff441e 100644
--- a/deps/uv/include/uv-unix.h
+++ b/deps/uv/include/uv-unix.h
@@ -123,6 +123,7 @@ typedef struct uv_buf_t {
typedef int uv_file;
typedef int uv_os_sock_t;
typedef int uv_os_fd_t;
+typedef pid_t uv_pid_t;
#define UV_ONCE_INIT PTHREAD_ONCE_INIT
@@ -365,4 +366,97 @@ typedef struct {
uv_fs_event_cb cb; \
UV_PLATFORM_FS_EVENT_FIELDS \
+/* fs open() flags supported on this platform: */
+#if defined(O_APPEND)
+# define UV_FS_O_APPEND O_APPEND
+#else
+# define UV_FS_O_APPEND 0
+#endif
+#if defined(O_CREAT)
+# define UV_FS_O_CREAT O_CREAT
+#else
+# define UV_FS_O_CREAT 0
+#endif
+#if defined(O_DIRECT)
+# define UV_FS_O_DIRECT O_DIRECT
+#else
+# define UV_FS_O_DIRECT 0
+#endif
+#if defined(O_DIRECTORY)
+# define UV_FS_O_DIRECTORY O_DIRECTORY
+#else
+# define UV_FS_O_DIRECTORY 0
+#endif
+#if defined(O_DSYNC)
+# define UV_FS_O_DSYNC O_DSYNC
+#else
+# define UV_FS_O_DSYNC 0
+#endif
+#if defined(O_EXCL)
+# define UV_FS_O_EXCL O_EXCL
+#else
+# define UV_FS_O_EXCL 0
+#endif
+#if defined(O_EXLOCK)
+# define UV_FS_O_EXLOCK O_EXLOCK
+#else
+# define UV_FS_O_EXLOCK 0
+#endif
+#if defined(O_NOATIME)
+# define UV_FS_O_NOATIME O_NOATIME
+#else
+# define UV_FS_O_NOATIME 0
+#endif
+#if defined(O_NOCTTY)
+# define UV_FS_O_NOCTTY O_NOCTTY
+#else
+# define UV_FS_O_NOCTTY 0
+#endif
+#if defined(O_NOFOLLOW)
+# define UV_FS_O_NOFOLLOW O_NOFOLLOW
+#else
+# define UV_FS_O_NOFOLLOW 0
+#endif
+#if defined(O_NONBLOCK)
+# define UV_FS_O_NONBLOCK O_NONBLOCK
+#else
+# define UV_FS_O_NONBLOCK 0
+#endif
+#if defined(O_RDONLY)
+# define UV_FS_O_RDONLY O_RDONLY
+#else
+# define UV_FS_O_RDONLY 0
+#endif
+#if defined(O_RDWR)
+# define UV_FS_O_RDWR O_RDWR
+#else
+# define UV_FS_O_RDWR 0
+#endif
+#if defined(O_SYMLINK)
+# define UV_FS_O_SYMLINK O_SYMLINK
+#else
+# define UV_FS_O_SYMLINK 0
+#endif
+#if defined(O_SYNC)
+# define UV_FS_O_SYNC O_SYNC
+#else
+# define UV_FS_O_SYNC 0
+#endif
+#if defined(O_TRUNC)
+# define UV_FS_O_TRUNC O_TRUNC
+#else
+# define UV_FS_O_TRUNC 0
+#endif
+#if defined(O_WRONLY)
+# define UV_FS_O_WRONLY O_WRONLY
+#else
+# define UV_FS_O_WRONLY 0
+#endif
+
+/* fs open() flags supported on other platforms: */
+#define UV_FS_O_RANDOM 0
+#define UV_FS_O_SHORT_LIVED 0
+#define UV_FS_O_SEQUENTIAL 0
+#define UV_FS_O_TEMPORARY 0
+
#endif /* UV_UNIX_H */
diff --git a/deps/uv/include/uv-version.h b/deps/uv/include/uv-version.h
index 55d7c91055..1c9113cdc9 100644
--- a/deps/uv/include/uv-version.h
+++ b/deps/uv/include/uv-version.h
@@ -31,8 +31,8 @@
*/
#define UV_VERSION_MAJOR 1
-#define UV_VERSION_MINOR 15
-#define UV_VERSION_PATCH 0
+#define UV_VERSION_MINOR 16
+#define UV_VERSION_PATCH 1
#define UV_VERSION_IS_RELEASE 1
#define UV_VERSION_SUFFIX ""
diff --git a/deps/uv/include/uv-win.h b/deps/uv/include/uv-win.h
index 9677ff164b..be150fc482 100644
--- a/deps/uv/include/uv-win.h
+++ b/deps/uv/include/uv-win.h
@@ -222,6 +222,7 @@ typedef struct uv_buf_t {
typedef int uv_file;
typedef SOCKET uv_os_sock_t;
typedef HANDLE uv_os_fd_t;
+typedef int uv_pid_t;
typedef HANDLE uv_thread_t;
@@ -648,3 +649,28 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s);
#ifndef X_OK
#define X_OK 1
#endif
+
+/* fs open() flags supported on this platform: */
+#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_RANDOM _O_RANDOM
+#define UV_FS_O_RDONLY _O_RDONLY
+#define UV_FS_O_RDWR _O_RDWR
+#define UV_FS_O_SEQUENTIAL _O_SEQUENTIAL
+#define UV_FS_O_SHORT_LIVED _O_SHORT_LIVED
+#define UV_FS_O_TEMPORARY _O_TEMPORARY
+#define UV_FS_O_TRUNC _O_TRUNC
+#define UV_FS_O_WRONLY _O_WRONLY
+
+/* fs open() flags supported on other platforms (or mapped on this platform): */
+#define UV_FS_O_DIRECT 0x2000000 /* FILE_FLAG_NO_BUFFERING */
+#define UV_FS_O_DIRECTORY 0
+#define UV_FS_O_DSYNC 0x4000000 /* FILE_FLAG_WRITE_THROUGH */
+#define UV_FS_O_EXLOCK 0
+#define UV_FS_O_NOATIME 0
+#define UV_FS_O_NOCTTY 0
+#define UV_FS_O_NOFOLLOW 0
+#define UV_FS_O_NONBLOCK 0
+#define UV_FS_O_SYMLINK 0
+#define UV_FS_O_SYNC 0x8000000 /* FILE_FLAG_WRITE_THROUGH */
diff --git a/deps/uv/include/uv.h b/deps/uv/include/uv.h
index 0e4151d138..3f61812081 100644
--- a/deps/uv/include/uv.h
+++ b/deps/uv/include/uv.h
@@ -141,6 +141,7 @@ extern "C" {
XX(EMLINK, "too many links") \
XX(EHOSTDOWN, "host is down") \
XX(EREMOTEIO, "remote I/O error") \
+ XX(ENOTTY, "inappropriate ioctl for device") \
#define UV_HANDLE_TYPE_MAP(XX) \
XX(ASYNC, async) \
@@ -709,6 +710,7 @@ UV_EXTERN int uv_pipe_getpeername(const uv_pipe_t* handle,
UV_EXTERN void uv_pipe_pending_instances(uv_pipe_t* handle, int count);
UV_EXTERN int uv_pipe_pending_count(uv_pipe_t* handle);
UV_EXTERN uv_handle_type uv_pipe_pending_type(uv_pipe_t* handle);
+UV_EXTERN int uv_pipe_chmod(uv_pipe_t* handle, int flags);
struct uv_poll_s {
@@ -1068,6 +1070,7 @@ UV_EXTERN int uv_os_homedir(char* buffer, size_t* size);
UV_EXTERN int uv_os_tmpdir(char* buffer, size_t* size);
UV_EXTERN int uv_os_get_passwd(uv_passwd_t* pwd);
UV_EXTERN void uv_os_free_passwd(uv_passwd_t* pwd);
+UV_EXTERN uv_pid_t uv_os_getppid(void);
UV_EXTERN int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count);
UV_EXTERN void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count);
@@ -1405,6 +1408,21 @@ UV_EXTERN int uv_ip6_name(const struct sockaddr_in6* src, char* dst, size_t size
UV_EXTERN int uv_inet_ntop(int af, const void* src, char* dst, size_t size);
UV_EXTERN int uv_inet_pton(int af, const char* src, void* dst);
+#if defined(IF_NAMESIZE)
+# define UV_IF_NAMESIZE (IF_NAMESIZE + 1)
+#elif defined(IFNAMSIZ)
+# define UV_IF_NAMESIZE (IFNAMSIZ + 1)
+#else
+# define UV_IF_NAMESIZE (16 + 1)
+#endif
+
+UV_EXTERN int uv_if_indextoname(unsigned int ifindex,
+ char* buffer,
+ size_t* size);
+UV_EXTERN int uv_if_indextoiid(unsigned int ifindex,
+ char* buffer,
+ size_t* size);
+
UV_EXTERN int uv_exepath(char* buffer, size_t* size);
UV_EXTERN int uv_cwd(char* buffer, size_t* size);
diff --git a/deps/uv/src/unix/core.c b/deps/uv/src/unix/core.c
index ef82ee27b8..d64593a313 100644
--- a/deps/uv/src/unix/core.c
+++ b/deps/uv/src/unix/core.c
@@ -1343,3 +1343,8 @@ int uv_os_gethostname(char* buffer, size_t* size) {
uv_os_fd_t uv_get_osfhandle(int fd) {
return fd;
}
+
+
+uv_pid_t uv_os_getppid(void) {
+ return getppid();
+}
diff --git a/deps/uv/src/unix/fs.c b/deps/uv/src/unix/fs.c
index 2684c814a2..e0969a4c2f 100644
--- a/deps/uv/src/unix/fs.c
+++ b/deps/uv/src/unix/fs.c
@@ -132,26 +132,33 @@
while (0)
-static ssize_t uv__fs_fdatasync(uv_fs_t* req) {
-#if defined(__linux__) || defined(__sun) || defined(__NetBSD__)
- return fdatasync(req->file);
-#elif defined(__APPLE__)
+static ssize_t uv__fs_fsync(uv_fs_t* req) {
+#if defined(__APPLE__)
/* Apple's fdatasync and fsync explicitly do NOT flush the drive write cache
* to the drive platters. This is in contrast to Linux's fdatasync and fsync
* which do, according to recent man pages. F_FULLFSYNC is Apple's equivalent
- * for flushing buffered data to permanent storage.
+ * for flushing buffered data to permanent storage. If F_FULLFSYNC is not
+ * supported by the file system we should fall back to fsync(). This is the
+ * same approach taken by sqlite.
*/
- return fcntl(req->file, F_FULLFSYNC);
+ int r;
+
+ r = fcntl(req->file, F_FULLFSYNC);
+ if (r != 0 && errno == ENOTTY)
+ r = fsync(req->file);
+ return r;
#else
return fsync(req->file);
#endif
}
-static ssize_t uv__fs_fsync(uv_fs_t* req) {
-#if defined(__APPLE__)
- /* See the comment in uv__fs_fdatasync. */
- return fcntl(req->file, F_FULLFSYNC);
+static ssize_t uv__fs_fdatasync(uv_fs_t* req) {
+#if defined(__linux__) || defined(__sun) || defined(__NetBSD__)
+ return fdatasync(req->file);
+#elif defined(__APPLE__)
+ /* See the comment in uv__fs_fsync. */
+ return uv__fs_fsync(req);
#else
return fsync(req->file);
#endif
diff --git a/deps/uv/src/unix/getaddrinfo.c b/deps/uv/src/unix/getaddrinfo.c
index 2049aea2f3..0185971697 100644
--- a/deps/uv/src/unix/getaddrinfo.c
+++ b/deps/uv/src/unix/getaddrinfo.c
@@ -32,6 +32,7 @@
#include <stddef.h> /* NULL */
#include <stdlib.h>
#include <string.h>
+#include <net/if.h> /* if_indextoname() */
/* EAI_* constants. */
#include <netdb.h>
@@ -200,3 +201,32 @@ void uv_freeaddrinfo(struct addrinfo* ai) {
if (ai)
freeaddrinfo(ai);
}
+
+
+int uv_if_indextoname(unsigned int ifindex, char* buffer, size_t* size) {
+ char ifname_buf[UV_IF_NAMESIZE];
+ size_t len;
+
+ if (buffer == NULL || size == NULL || *size == 0)
+ return UV_EINVAL;
+
+ if (if_indextoname(ifindex, ifname_buf) == NULL)
+ return -errno;
+
+ len = strnlen(ifname_buf, sizeof(ifname_buf));
+
+ if (*size <= len) {
+ *size = len + 1;
+ return UV_ENOBUFS;
+ }
+
+ memcpy(buffer, ifname_buf, len);
+ buffer[len] = '\0';
+ *size = len;
+
+ return 0;
+}
+
+int uv_if_indextoiid(unsigned int ifindex, char* buffer, size_t* size) {
+ return uv_if_indextoname(ifindex, buffer, size);
+}
diff --git a/deps/uv/src/unix/kqueue.c b/deps/uv/src/unix/kqueue.c
index c9adddbdb8..5e89bdced4 100644
--- a/deps/uv/src/unix/kqueue.c
+++ b/deps/uv/src/unix/kqueue.c
@@ -65,7 +65,6 @@ static int uv__has_forked_with_cfrunloop;
int uv__io_fork(uv_loop_t* loop) {
int err;
- uv__close(loop->backend_fd);
loop->backend_fd = -1;
err = uv__kqueue_init(loop);
if (err)
diff --git a/deps/uv/src/unix/loop.c b/deps/uv/src/unix/loop.c
index bcd49242ce..5b5b0e095b 100644
--- a/deps/uv/src/unix/loop.c
+++ b/deps/uv/src/unix/loop.c
@@ -31,7 +31,6 @@ int uv_loop_init(uv_loop_t* loop) {
void* saved_data;
int err;
- uv__signal_global_once_init();
saved_data = loop->data;
memset(loop, 0, sizeof(*loop));
@@ -68,6 +67,7 @@ int uv_loop_init(uv_loop_t* loop) {
if (err)
return err;
+ uv__signal_global_once_init();
err = uv_signal_init(loop, &loop->child_watcher);
if (err)
goto fail_signal_init;
diff --git a/deps/uv/src/unix/os390-syscalls.c b/deps/uv/src/unix/os390-syscalls.c
index ca539c26f7..86c6852b4b 100644
--- a/deps/uv/src/unix/os390-syscalls.c
+++ b/deps/uv/src/unix/os390-syscalls.c
@@ -120,10 +120,41 @@ static void maybe_resize(uv__os390_epoll* lst, unsigned int len) {
}
+static void before_fork(void) {
+ uv_mutex_lock(&global_epoll_lock);
+}
+
+
+static void after_fork(void) {
+ uv_mutex_unlock(&global_epoll_lock);
+}
+
+
+static void child_fork(void) {
+ QUEUE* q;
+ uv_once_t child_once = UV_ONCE_INIT;
+
+ /* reset once */
+ memcpy(&once, &child_once, sizeof(child_once));
+
+ /* reset epoll list */
+ while (!QUEUE_EMPTY(&global_epoll_queue)) {
+ q = QUEUE_HEAD(&global_epoll_queue);
+ QUEUE_REMOVE(q);
+ }
+
+ uv_mutex_unlock(&global_epoll_lock);
+ uv_mutex_destroy(&global_epoll_lock);
+}
+
+
static void epoll_init(void) {
QUEUE_INIT(&global_epoll_queue);
if (uv_mutex_init(&global_epoll_lock))
abort();
+
+ if (pthread_atfork(&before_fork, &after_fork, &child_fork))
+ abort();
}
diff --git a/deps/uv/src/unix/pipe.c b/deps/uv/src/unix/pipe.c
index 4a812955b0..ac7cfb46a9 100644
--- a/deps/uv/src/unix/pipe.c
+++ b/deps/uv/src/unix/pipe.c
@@ -302,3 +302,56 @@ uv_handle_type uv_pipe_pending_type(uv_pipe_t* handle) {
else
return uv__handle_type(handle->accepted_fd);
}
+
+
+int uv_pipe_chmod(uv_pipe_t* handle, int mode) {
+ unsigned desired_mode;
+ struct stat pipe_stat;
+ char* name_buffer;
+ size_t name_len;
+ int r;
+
+ if (handle == NULL || uv__stream_fd(handle) == -1)
+ return -EBADF;
+
+ if (mode != UV_READABLE &&
+ mode != UV_WRITABLE &&
+ mode != (UV_WRITABLE | UV_READABLE))
+ return -EINVAL;
+
+ if (fstat(uv__stream_fd(handle), &pipe_stat) == -1)
+ return -errno;
+
+ desired_mode = 0;
+ if (mode & UV_READABLE)
+ desired_mode |= S_IRUSR | S_IRGRP | S_IROTH;
+ if (mode & UV_WRITABLE)
+ desired_mode |= S_IWUSR | S_IWGRP | S_IWOTH;
+
+ /* Exit early if pipe already has desired mode. */
+ if ((pipe_stat.st_mode & desired_mode) == desired_mode)
+ return 0;
+
+ pipe_stat.st_mode |= desired_mode;
+
+ /* Unfortunately fchmod does not work on all platforms, we will use chmod. */
+ name_len = 0;
+ r = uv_pipe_getsockname(handle, NULL, &name_len);
+ if (r != UV_ENOBUFS)
+ return r;
+
+ name_buffer = uv__malloc(name_len);
+ if (name_buffer == NULL)
+ return UV_ENOMEM;
+
+ r = uv_pipe_getsockname(handle, name_buffer, &name_len);
+ if (r != 0) {
+ uv__free(name_buffer);
+ return r;
+ }
+
+ r = chmod(name_buffer, pipe_stat.st_mode);
+ uv__free(name_buffer);
+
+ return r != -1 ? 0 : -errno;
+}
diff --git a/deps/uv/src/win/dl.c b/deps/uv/src/win/dl.c
index d454014d8a..97ac1c1ad1 100644
--- a/deps/uv/src/win/dl.c
+++ b/deps/uv/src/win/dl.c
@@ -89,9 +89,9 @@ static void uv__format_fallback_error(uv_lib_t* lib, int errorno){
static int uv__dlerror(uv_lib_t* lib, const char* filename, DWORD errorno) {
- static const char not_win32_app_msg[] = "%1 is not a valid Win32 application";
DWORD_PTR arg;
DWORD res;
+ char* msg;
if (lib->errmsg) {
LocalFree(lib->errmsg);
@@ -114,16 +114,16 @@ static int uv__dlerror(uv_lib_t* lib, const char* filename, DWORD errorno) {
0, (LPSTR) &lib->errmsg, 0, NULL);
}
- /* Inexpert hack to get the filename into the error message. */
- if (res && strstr(lib->errmsg, not_win32_app_msg)) {
- LocalFree(lib->errmsg);
+ if (res && errorno == ERROR_BAD_EXE_FORMAT && strstr(lib->errmsg, "%1")) {
+ msg = lib->errmsg;
lib->errmsg = NULL;
arg = (DWORD_PTR) filename;
res = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_ARGUMENT_ARRAY |
FORMAT_MESSAGE_FROM_STRING,
- not_win32_app_msg,
+ msg,
0, 0, (LPSTR) &lib->errmsg, 0, (va_list*) &arg);
+ LocalFree(msg);
}
if (!res)
diff --git a/deps/uv/src/win/fs.c b/deps/uv/src/win/fs.c
index c374a82ca0..b90eaa7548 100644
--- a/deps/uv/src/win/fs.c
+++ b/deps/uv/src/win/fs.c
@@ -415,21 +415,21 @@ void fs__open(uv_fs_t* req) {
umask(current_umask);
/* convert flags and mode to CreateFile parameters */
- switch (flags & (_O_RDONLY | _O_WRONLY | _O_RDWR)) {
- case _O_RDONLY:
+ switch (flags & (UV_FS_O_RDONLY | UV_FS_O_WRONLY | UV_FS_O_RDWR)) {
+ case UV_FS_O_RDONLY:
access = FILE_GENERIC_READ;
break;
- case _O_WRONLY:
+ case UV_FS_O_WRONLY:
access = FILE_GENERIC_WRITE;
break;
- case _O_RDWR:
+ case UV_FS_O_RDWR:
access = FILE_GENERIC_READ | FILE_GENERIC_WRITE;
break;
default:
goto einval;
}
- if (flags & _O_APPEND) {
+ if (flags & UV_FS_O_APPEND) {
access &= ~FILE_WRITE_DATA;
access |= FILE_APPEND_DATA;
}
@@ -442,23 +442,23 @@ void fs__open(uv_fs_t* req) {
*/
share = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE;
- switch (flags & (_O_CREAT | _O_EXCL | _O_TRUNC)) {
+ switch (flags & (UV_FS_O_CREAT | UV_FS_O_EXCL | UV_FS_O_TRUNC)) {
case 0:
- case _O_EXCL:
+ case UV_FS_O_EXCL:
disposition = OPEN_EXISTING;
break;
- case _O_CREAT:
+ case UV_FS_O_CREAT:
disposition = OPEN_ALWAYS;
break;
- case _O_CREAT | _O_EXCL:
- case _O_CREAT | _O_TRUNC | _O_EXCL:
+ case UV_FS_O_CREAT | UV_FS_O_EXCL:
+ case UV_FS_O_CREAT | UV_FS_O_TRUNC | UV_FS_O_EXCL:
disposition = CREATE_NEW;
break;
- case _O_TRUNC:
- case _O_TRUNC | _O_EXCL:
+ case UV_FS_O_TRUNC:
+ case UV_FS_O_TRUNC | UV_FS_O_EXCL:
disposition = TRUNCATE_EXISTING;
break;
- case _O_CREAT | _O_TRUNC:
+ case UV_FS_O_CREAT | UV_FS_O_TRUNC:
disposition = CREATE_ALWAYS;
break;
default:
@@ -466,34 +466,49 @@ void fs__open(uv_fs_t* req) {
}
attributes |= FILE_ATTRIBUTE_NORMAL;
- if (flags & _O_CREAT) {
+ if (flags & UV_FS_O_CREAT) {
if (!((req->fs.info.mode & ~current_umask) & _S_IWRITE)) {
attributes |= FILE_ATTRIBUTE_READONLY;
}
}
- if (flags & _O_TEMPORARY ) {
+ if (flags & UV_FS_O_TEMPORARY ) {
attributes |= FILE_FLAG_DELETE_ON_CLOSE | FILE_ATTRIBUTE_TEMPORARY;
access |= DELETE;
}
- if (flags & _O_SHORT_LIVED) {
+ if (flags & UV_FS_O_SHORT_LIVED) {
attributes |= FILE_ATTRIBUTE_TEMPORARY;
}
- switch (flags & (_O_SEQUENTIAL | _O_RANDOM)) {
+ switch (flags & (UV_FS_O_SEQUENTIAL | UV_FS_O_RANDOM)) {
case 0:
break;
- case _O_SEQUENTIAL:
+ case UV_FS_O_SEQUENTIAL:
attributes |= FILE_FLAG_SEQUENTIAL_SCAN;
break;
- case _O_RANDOM:
+ case UV_FS_O_RANDOM:
attributes |= FILE_FLAG_RANDOM_ACCESS;
break;
default:
goto einval;
}
+ if (flags & UV_FS_O_DIRECT) {
+ attributes |= FILE_FLAG_NO_BUFFERING;
+ }
+
+ switch (flags & (UV_FS_O_DSYNC | UV_FS_O_SYNC)) {
+ case 0:
+ break;
+ case UV_FS_O_DSYNC:
+ case UV_FS_O_SYNC:
+ attributes |= FILE_FLAG_WRITE_THROUGH;
+ break;
+ default:
+ goto einval;
+ }
+
/* Setting this flag makes it possible to open a directory. */
attributes |= FILE_FLAG_BACKUP_SEMANTICS;
@@ -506,9 +521,9 @@ void fs__open(uv_fs_t* req) {
NULL);
if (file == INVALID_HANDLE_VALUE) {
DWORD error = GetLastError();
- if (error == ERROR_FILE_EXISTS && (flags & _O_CREAT) &&
- !(flags & _O_EXCL)) {
- /* Special case: when ERROR_FILE_EXISTS happens and O_CREAT was */
+ if (error == ERROR_FILE_EXISTS && (flags & UV_FS_O_CREAT) &&
+ !(flags & UV_FS_O_EXCL)) {
+ /* Special case: when ERROR_FILE_EXISTS happens and UV_FS_O_CREAT was */
/* specified, it means the path referred to a directory. */
SET_REQ_UV_ERROR(req, UV_EISDIR, error);
} else {
@@ -1070,7 +1085,8 @@ cleanup:
}
-INLINE static int fs__stat_handle(HANDLE handle, uv_stat_t* statbuf) {
+INLINE static int fs__stat_handle(HANDLE handle, uv_stat_t* statbuf,
+ int do_lstat) {
FILE_ALL_INFORMATION file_info;
FILE_FS_VOLUME_INFORMATION volume_info;
NTSTATUS nt_status;
@@ -1125,17 +1141,25 @@ INLINE static int fs__stat_handle(HANDLE handle, uv_stat_t* statbuf) {
*/
statbuf->st_mode = 0;
- if (file_info.BasicInformation.FileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) {
+ /*
+ * On Windows, FILE_ATTRIBUTE_REPARSE_POINT is a general purpose mechanism
+ * by which filesystem drivers can intercept and alter file system requests.
+ *
+ * The only reparse points we care about are symlinks and mount points, both
+ * of which are treated as POSIX symlinks. Further, we only care when
+ * invoked via lstat, which seeks information about the link instead of its
+ * target. Otherwise, reparse points must be treated as regular files.
+ */
+ if (do_lstat &&
+ (file_info.BasicInformation.FileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)) {
/*
- * It is possible for a file to have FILE_ATTRIBUTE_REPARSE_POINT but not have
- * any link data. In that case DeviceIoControl() in fs__readlink_handle() sets
- * the last error to ERROR_NOT_A_REPARSE_POINT. Then the stat result mode
- * calculated below will indicate a normal directory or file, as if
- * FILE_ATTRIBUTE_REPARSE_POINT was not present.
+ * If reading the link fails, the reparse point is not a symlink and needs
+ * to be treated as a regular file. The higher level lstat function will
+ * detect this failure and retry without do_lstat if appropriate.
*/
- if (fs__readlink_handle(handle, NULL, &statbuf->st_size) == 0) {
- statbuf->st_mode |= S_IFLNK;
- }
+ if (fs__readlink_handle(handle, NULL, &statbuf->st_size) != 0)
+ return -1;
+ statbuf->st_mode |= S_IFLNK;
}
if (statbuf->st_mode == 0) {
@@ -1178,8 +1202,12 @@ INLINE static int fs__stat_handle(HANDLE handle, uv_stat_t* statbuf) {
*
* Therefore we'll just report a sensible value that's quite commonly okay
* on modern hardware.
+ *
+ * 4096 is the minimum required to be compatible with newer Advanced Format
+ * drives (which have 4096 bytes per physical sector), and to be backwards
+ * compatible with older drives (which have 512 bytes per physical sector).
*/
- statbuf->st_blksize = 2048;
+ statbuf->st_blksize = 4096;
/* Todo: set st_flags to something meaningful. Also provide a wrapper for
* chattr(2).
@@ -1230,9 +1258,11 @@ INLINE static void fs__stat_impl(uv_fs_t* req, int do_lstat) {
return;
}
- if (fs__stat_handle(handle, &req->statbuf) != 0) {
+ if (fs__stat_handle(handle, &req->statbuf, do_lstat) != 0) {
DWORD error = GetLastError();
- if (do_lstat && error == ERROR_SYMLINK_NOT_SUPPORTED) {
+ if (do_lstat &&
+ (error == ERROR_SYMLINK_NOT_SUPPORTED ||
+ error == ERROR_NOT_A_REPARSE_POINT)) {
/* We opened a reparse point but it was not a symlink. Try again. */
fs__stat_impl(req, 0);
@@ -1276,7 +1306,7 @@ static void fs__fstat(uv_fs_t* req) {
return;
}
- if (fs__stat_handle(handle, &req->statbuf) != 0) {
+ if (fs__stat_handle(handle, &req->statbuf, 0) != 0) {
SET_REQ_WIN32_ERROR(req, GetLastError());
return;
}
diff --git a/deps/uv/src/win/getaddrinfo.c b/deps/uv/src/win/getaddrinfo.c
index baab838898..282d919cf7 100644
--- a/deps/uv/src/win/getaddrinfo.c
+++ b/deps/uv/src/win/getaddrinfo.c
@@ -28,6 +28,8 @@
/* EAI_* constants. */
#include <winsock2.h>
+/* Needed for ConvertInterfaceIndexToLuid and ConvertInterfaceLuidToNameA */
+#include <iphlpapi.h>
int uv__getaddrinfo_translate_error(int sys_err) {
switch (sys_err) {
@@ -73,6 +75,9 @@ int uv__getaddrinfo_translate_error(int sys_err) {
/* Do we need different versions of this for different architectures? */
#define ALIGNED_SIZE(X) ((((X) + 3) >> 2) << 2)
+#ifndef NDIS_IF_MAX_STRING_SIZE
+#define NDIS_IF_MAX_STRING_SIZE IF_MAX_STRING_SIZE
+#endif
static void uv__getaddrinfo_work(struct uv__work* w) {
uv_getaddrinfo_t* req;
@@ -380,3 +385,69 @@ error:
}
return uv_translate_sys_error(err);
}
+
+int uv_if_indextoname(unsigned int ifindex, char* buffer, size_t* size) {
+ NET_LUID luid;
+ wchar_t wname[NDIS_IF_MAX_STRING_SIZE + 1]; /* Add one for the NUL. */
+ DWORD bufsize;
+ int r;
+
+ if (buffer == NULL || size == NULL || *size == 0)
+ return UV_EINVAL;
+
+ r = ConvertInterfaceIndexToLuid(ifindex, &luid);
+
+ if (r != 0)
+ return uv_translate_sys_error(r);
+
+ r = ConvertInterfaceLuidToNameW(&luid, wname, ARRAY_SIZE(wname));
+
+ if (r != 0)
+ return uv_translate_sys_error(r);
+
+ /* Check how much space we need */
+ bufsize = WideCharToMultiByte(CP_UTF8, 0, wname, -1, NULL, 0, NULL, NULL);
+
+ if (bufsize == 0) {
+ return uv_translate_sys_error(GetLastError());
+ } else if (bufsize > *size) {
+ *size = bufsize;
+ return UV_ENOBUFS;
+ }
+
+ /* Convert to UTF-8 */
+ bufsize = WideCharToMultiByte(CP_UTF8,
+ 0,
+ wname,
+ -1,
+ buffer,
+ *size,
+ NULL,
+ NULL);
+
+ if (bufsize == 0)
+ return uv_translate_sys_error(GetLastError());
+
+ *size = bufsize - 1;
+ return 0;
+}
+
+int uv_if_indextoiid(unsigned int ifindex, char* buffer, size_t* size) {
+ int r;
+
+ if (buffer == NULL || size == NULL || *size == 0)
+ return UV_EINVAL;
+
+ r = snprintf(buffer, *size, "%d", ifindex);
+
+ if (r < 0)
+ return uv_translate_sys_error(r);
+
+ if (r >= (int) *size) {
+ *size = r + 1;
+ return UV_ENOBUFS;
+ }
+
+ *size = r;
+ return 0;
+}
diff --git a/deps/uv/src/win/internal.h b/deps/uv/src/win/internal.h
index 444327d647..217fcdb5d7 100644
--- a/deps/uv/src/win/internal.h
+++ b/deps/uv/src/win/internal.h
@@ -326,7 +326,6 @@ void uv__fs_poll_endgame(uv_loop_t* loop, uv_fs_poll_t* handle);
void uv__util_init(void);
uint64_t uv__hrtime(double scale);
-int uv_parent_pid(void);
int uv_current_pid(void);
__declspec(noreturn) void uv_fatal_error(const int errorno, const char* syscall);
int uv__getpwuid_r(uv_passwd_t* pwd);
diff --git a/deps/uv/src/win/pipe.c b/deps/uv/src/win/pipe.c
index 5c666788fd..642213bc88 100644
--- a/deps/uv/src/win/pipe.c
+++ b/deps/uv/src/win/pipe.c
@@ -31,6 +31,9 @@
#include "stream-inl.h"
#include "req-inl.h"
+#include <AclAPI.h>
+#include <AccCtrl.h>
+
typedef struct uv__ipc_queue_item_s uv__ipc_queue_item_t;
struct uv__ipc_queue_item_s {
@@ -202,7 +205,7 @@ int uv_stdio_pipe_server(uv_loop_t* loop, uv_pipe_t* handle, DWORD access,
uv_unique_pipe_name(ptr, name, nameSize);
pipeHandle = CreateNamedPipeA(name,
- access | FILE_FLAG_OVERLAPPED | FILE_FLAG_FIRST_PIPE_INSTANCE,
+ access | FILE_FLAG_OVERLAPPED | FILE_FLAG_FIRST_PIPE_INSTANCE | WRITE_DAC,
PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT, 1, 65536, 65536, 0,
NULL);
@@ -534,7 +537,7 @@ int uv_pipe_bind(uv_pipe_t* handle, const char* name) {
*/
handle->pipe.serv.accept_reqs[0].pipeHandle = CreateNamedPipeW(handle->name,
PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED |
- FILE_FLAG_FIRST_PIPE_INSTANCE,
+ FILE_FLAG_FIRST_PIPE_INSTANCE | WRITE_DAC,
PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT,
PIPE_UNLIMITED_INSTANCES, 65536, 65536, 0, NULL);
@@ -803,7 +806,7 @@ static void uv_pipe_queue_accept(uv_loop_t* loop, uv_pipe_t* handle,
assert(req->pipeHandle == INVALID_HANDLE_VALUE);
req->pipeHandle = CreateNamedPipeW(handle->name,
- PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED,
+ PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED | WRITE_DAC,
PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT,
PIPE_UNLIMITED_INSTANCES, 65536, 65536, 0, NULL);
@@ -1969,7 +1972,7 @@ int uv_pipe_open(uv_pipe_t* pipe, uv_file file) {
if (pipe->ipc) {
assert(!(pipe->flags & UV_HANDLE_NON_OVERLAPPED_PIPE));
- pipe->pipe.conn.ipc_pid = uv_parent_pid();
+ pipe->pipe.conn.ipc_pid = uv_os_getppid();
assert(pipe->pipe.conn.ipc_pid != -1);
}
return 0;
@@ -2132,3 +2135,80 @@ uv_handle_type uv_pipe_pending_type(uv_pipe_t* handle) {
else
return UV_TCP;
}
+
+int uv_pipe_chmod(uv_pipe_t* handle, int mode) {
+ SID_IDENTIFIER_AUTHORITY sid_world = SECURITY_WORLD_SID_AUTHORITY;
+ PACL old_dacl, new_dacl;
+ PSECURITY_DESCRIPTOR sd;
+ EXPLICIT_ACCESS ea;
+ PSID everyone;
+ int error;
+
+ if (handle == NULL || handle->handle == INVALID_HANDLE_VALUE)
+ return UV_EBADF;
+
+ if (mode != UV_READABLE &&
+ mode != UV_WRITABLE &&
+ mode != (UV_WRITABLE | UV_READABLE))
+ return UV_EINVAL;
+
+ if (!AllocateAndInitializeSid(&sid_world,
+ 1,
+ SECURITY_WORLD_RID,
+ 0, 0, 0, 0, 0, 0, 0,
+ &everyone)) {
+ error = GetLastError();
+ goto done;
+ }
+
+ if (GetSecurityInfo(handle->handle,
+ SE_KERNEL_OBJECT,
+ DACL_SECURITY_INFORMATION,
+ NULL,
+ NULL,
+ &old_dacl,
+ NULL,
+ &sd)) {
+ error = GetLastError();
+ goto clean_sid;
+ }
+
+ memset(&ea, 0, sizeof(EXPLICIT_ACCESS));
+ if (mode & UV_READABLE)
+ ea.grfAccessPermissions |= GENERIC_READ | FILE_WRITE_ATTRIBUTES;
+ if (mode & UV_WRITABLE)
+ ea.grfAccessPermissions |= GENERIC_WRITE | FILE_READ_ATTRIBUTES;
+ ea.grfAccessPermissions |= SYNCHRONIZE;
+ ea.grfAccessMode = SET_ACCESS;
+ ea.grfInheritance = NO_INHERITANCE;
+ ea.Trustee.TrusteeForm = TRUSTEE_IS_SID;
+ ea.Trustee.TrusteeType = TRUSTEE_IS_WELL_KNOWN_GROUP;
+ ea.Trustee.ptstrName = (LPTSTR)everyone;
+
+ if (SetEntriesInAcl(1, &ea, old_dacl, &new_dacl)) {
+ error = GetLastError();
+ goto clean_sd;
+ }
+
+ if (SetSecurityInfo(handle->handle,
+ SE_KERNEL_OBJECT,
+ DACL_SECURITY_INFORMATION,
+ NULL,
+ NULL,
+ new_dacl,
+ NULL)) {
+ error = GetLastError();
+ goto clean_dacl;
+ }
+
+ error = 0;
+
+clean_dacl:
+ LocalFree((HLOCAL) new_dacl);
+clean_sd:
+ LocalFree((HLOCAL) sd);
+clean_sid:
+ FreeSid(everyone);
+done:
+ return uv_translate_sys_error(error);
+}
diff --git a/deps/uv/src/win/stream-inl.h b/deps/uv/src/win/stream-inl.h
index bf12148afe..dba0374704 100644
--- a/deps/uv/src/win/stream-inl.h
+++ b/deps/uv/src/win/stream-inl.h
@@ -36,6 +36,7 @@ INLINE static void uv_stream_init(uv_loop_t* loop,
uv__handle_init(loop, (uv_handle_t*) handle, type);
handle->write_queue_size = 0;
handle->activecnt = 0;
+ handle->stream.conn.shutdown_req = NULL;
}
@@ -47,8 +48,6 @@ INLINE static void uv_connection_init(uv_stream_t* handle) {
handle->read_req.event_handle = NULL;
handle->read_req.wait_handle = INVALID_HANDLE_VALUE;
handle->read_req.data = handle;
-
- handle->stream.conn.shutdown_req = NULL;
}
diff --git a/deps/uv/src/win/util.c b/deps/uv/src/win/util.c
index a2acda1152..2aec9f8dfe 100644
--- a/deps/uv/src/win/util.c
+++ b/deps/uv/src/win/util.c
@@ -331,7 +331,7 @@ uint64_t uv_get_total_memory(void) {
}
-int uv_parent_pid(void) {
+uv_pid_t uv_os_getppid(void) {
int parent_pid = -1;
HANDLE handle;
PROCESSENTRY32 pe;
diff --git a/deps/uv/test/benchmark-pump.c b/deps/uv/test/benchmark-pump.c
index 88f2dc5c65..8685258e05 100644
--- a/deps/uv/test/benchmark-pump.c
+++ b/deps/uv/test/benchmark-pump.c
@@ -36,9 +36,9 @@ static int TARGET_CONNECTIONS;
static void do_write(uv_stream_t*);
-static void maybe_connect_some();
+static void maybe_connect_some(void);
-static uv_req_t* req_alloc();
+static uv_req_t* req_alloc(void);
static void req_free(uv_req_t* uv_req);
static void buf_alloc(uv_handle_t* handle, size_t size, uv_buf_t* buf);
diff --git a/deps/uv/test/runner.c b/deps/uv/test/runner.c
index 5e44118775..f017902a04 100644
--- a/deps/uv/test/runner.c
+++ b/deps/uv/test/runner.c
@@ -81,6 +81,7 @@ int run_tests(int benchmark_output) {
int skipped;
int current;
int test_result;
+ int skip;
task_entry_t* task;
/* Count the number of tests. */
@@ -92,7 +93,9 @@ int run_tests(int benchmark_output) {
}
}
- qsort(TASKS, actual, sizeof(TASKS[0]), compare_task);
+ /* Keep platform_output first. */
+ skip = (actual > 0 && 0 == strcmp(TASKS[0].task_name, "platform_output"));
+ qsort(TASKS + skip, actual - skip, sizeof(TASKS[0]), compare_task);
fprintf(stderr, "1..%d\n", total);
fflush(stderr);
@@ -127,6 +130,7 @@ void log_tap_result(int test_count,
const char* result;
const char* directive;
char reason[1024];
+ int reason_length;
switch (status) {
case TEST_OK:
@@ -144,6 +148,9 @@ void log_tap_result(int test_count,
if (status == TEST_SKIP && process_output_size(process) > 0) {
process_read_last_line(process, reason, sizeof reason);
+ reason_length = strlen(reason);
+ if (reason_length > 0 && reason[reason_length - 1] == '\n')
+ reason[reason_length - 1] = '\0';
} else {
reason[0] = '\0';
}
diff --git a/deps/uv/test/test-fork.c b/deps/uv/test/test-fork.c
index 3716a3ad97..ba85b53106 100644
--- a/deps/uv/test/test-fork.c
+++ b/deps/uv/test/test-fork.c
@@ -636,6 +636,7 @@ static void assert_run_work(uv_loop_t* const loop) {
}
+#ifndef __MVS__
TEST_IMPL(fork_threadpool_queue_work_simple) {
/* The threadpool works in a child process. */
@@ -672,6 +673,7 @@ TEST_IMPL(fork_threadpool_queue_work_simple) {
MAKE_VALGRIND_HAPPY();
return 0;
}
+#endif /* !__MVS__ */
#endif /* !_WIN32 */
diff --git a/deps/uv/test/test-fs.c b/deps/uv/test/test-fs.c
index 0000e563a7..6afa650793 100644
--- a/deps/uv/test/test-fs.c
+++ b/deps/uv/test/test-fs.c
@@ -115,6 +115,17 @@ static char test_buf[] = "test-buffer\n";
static char test_buf2[] = "second-buffer\n";
static uv_buf_t iov;
+#ifdef _WIN32
+/*
+ * This tag and guid have no special meaning, and don't conflict with
+ * reserved ids.
+*/
+static unsigned REPARSE_TAG = 0x9913;
+static GUID REPARSE_GUID = {
+ 0x1bf6205f, 0x46ae, 0x4527,
+ 0xb1, 0x0c, 0xc5, 0x09, 0xb7, 0x55, 0x22, 0x80 };
+#endif
+
static void check_permission(const char* filename, unsigned int mode) {
int r;
uv_fs_t req;
@@ -1991,6 +2002,109 @@ TEST_IMPL(fs_symlink_dir) {
}
+#ifdef _WIN32
+TEST_IMPL(fs_non_symlink_reparse_point) {
+ uv_fs_t req;
+ int r;
+ HANDLE file_handle;
+ REPARSE_GUID_DATA_BUFFER reparse_buffer;
+ DWORD bytes_returned;
+ uv_dirent_t dent;
+
+ /* set-up */
+ unlink("test_dir/test_file");
+ rmdir("test_dir");
+
+ loop = uv_default_loop();
+
+ uv_fs_mkdir(NULL, &req, "test_dir", 0777, NULL);
+ uv_fs_req_cleanup(&req);
+
+ file_handle = CreateFile("test_dir/test_file",
+ GENERIC_WRITE | FILE_WRITE_ATTRIBUTES,
+ 0,
+ NULL,
+ CREATE_ALWAYS,
+ FILE_FLAG_OPEN_REPARSE_POINT |
+ FILE_FLAG_BACKUP_SEMANTICS,
+ NULL);
+ ASSERT(file_handle != INVALID_HANDLE_VALUE);
+
+ memset(&reparse_buffer, 0, REPARSE_GUID_DATA_BUFFER_HEADER_SIZE);
+ reparse_buffer.ReparseTag = REPARSE_TAG;
+ reparse_buffer.ReparseDataLength = 0;
+ reparse_buffer.ReparseGuid = REPARSE_GUID;
+
+ r = DeviceIoControl(file_handle,
+ FSCTL_SET_REPARSE_POINT,
+ &reparse_buffer,
+ REPARSE_GUID_DATA_BUFFER_HEADER_SIZE,
+ NULL,
+ 0,
+ &bytes_returned,
+ NULL);
+ ASSERT(r != 0);
+
+ CloseHandle(file_handle);
+
+ r = uv_fs_readlink(NULL, &req, "test_dir/test_file", NULL);
+ ASSERT(r == UV_EINVAL && GetLastError() == ERROR_SYMLINK_NOT_SUPPORTED);
+ uv_fs_req_cleanup(&req);
+
+/*
+ Placeholder tests for exercising the behavior fixed in issue #995.
+ To run, update the path with the IP address of a Mac with the hard drive
+ shared via SMB as "Macintosh HD".
+
+ r = uv_fs_stat(NULL, &req, "\\\\<mac_ip>\\Macintosh HD\\.DS_Store", NULL);
+ ASSERT(r == 0);
+ uv_fs_req_cleanup(&req);
+
+ r = uv_fs_lstat(NULL, &req, "\\\\<mac_ip>\\Macintosh HD\\.DS_Store", NULL);
+ ASSERT(r == 0);
+ uv_fs_req_cleanup(&req);
+*/
+
+/*
+ uv_fs_stat and uv_fs_lstat can only work on non-symlink reparse
+ points when a minifilter driver is registered which intercepts
+ associated filesystem requests. Installing a driver is beyond
+ the scope of this test.
+
+ r = uv_fs_stat(NULL, &req, "test_dir/test_file", NULL);
+ ASSERT(r == 0);
+ uv_fs_req_cleanup(&req);
+
+ r = uv_fs_lstat(NULL, &req, "test_dir/test_file", NULL);
+ ASSERT(r == 0);
+ uv_fs_req_cleanup(&req);
+*/
+
+ r = uv_fs_scandir(NULL, &scandir_req, "test_dir", 0, NULL);
+ ASSERT(r == 1);
+ ASSERT(scandir_req.result == 1);
+ ASSERT(scandir_req.ptr);
+ while (UV_EOF != uv_fs_scandir_next(&scandir_req, &dent)) {
+ ASSERT(strcmp(dent.name, "test_file") == 0);
+ /* uv_fs_scandir incorrectly identifies non-symlink reparse points
+ as links because it doesn't open the file and verify the reparse
+ point tag. The PowerShell Get-ChildItem command shares this
+ behavior, so it's reasonable to leave it as is. */
+ ASSERT(dent.type == UV_DIRENT_LINK);
+ }
+ uv_fs_req_cleanup(&scandir_req);
+ ASSERT(!scandir_req.ptr);
+
+ /* clean-up */
+ unlink("test_dir/test_file");
+ rmdir("test_dir");
+
+ MAKE_VALGRIND_HAPPY();
+ return 0;
+}
+#endif
+
+
TEST_IMPL(fs_utime) {
utime_check_t checkme;
const char* path = "test_file";
diff --git a/deps/uv/test/test-ip6-addr.c b/deps/uv/test/test-ip6-addr.c
index 156fccde39..25570dcacd 100644
--- a/deps/uv/test/test-ip6-addr.c
+++ b/deps/uv/test/test-ip6-addr.c
@@ -44,8 +44,12 @@ TEST_IMPL(ip6_addr_link_local) {
const char* device_name;
/* 40 bytes address, 16 bytes device name, plus reserve. */
char scoped_addr[128];
+ size_t scoped_addr_len;
+ char interface_id[UV_IF_NAMESIZE];
+ size_t interface_id_len;
int count;
int ix;
+ int r;
ASSERT(0 == uv_interface_addresses(&addresses, &count));
@@ -67,19 +71,29 @@ TEST_IMPL(ip6_addr_link_local) {
iface_index = address->address.address6.sin6_scope_id;
device_name = address->name;
+ scoped_addr_len = sizeof(scoped_addr);
+ ASSERT(0 == uv_if_indextoname(iface_index, scoped_addr, &scoped_addr_len));
+#ifndef _WIN32
+ /* This assert fails on Windows, as Windows semantics are different. */
+ ASSERT(0 == strcmp(device_name, scoped_addr));
+#endif
+
+ interface_id_len = sizeof(interface_id);
+ r = uv_if_indextoiid(iface_index, interface_id, &interface_id_len);
+ ASSERT(0 == r);
#ifdef _WIN32
- snprintf(scoped_addr,
- sizeof(scoped_addr),
- "%s%%%d",
- string_address,
- iface_index);
+ /* On Windows, the interface identifier is the numeric string of the index. */
+ ASSERT(strtol(interface_id, NULL, 10) == iface_index);
#else
+ /* On Unix/Linux, the interface identifier is the interface device name. */
+ ASSERT(0 == strcmp(device_name, interface_id));
+#endif
+
snprintf(scoped_addr,
sizeof(scoped_addr),
"%s%%%s",
string_address,
- device_name);
-#endif
+ interface_id);
fprintf(stderr, "Testing link-local address %s "
"(iface_index: 0x%02x, device_name: %s)\n",
@@ -96,6 +110,9 @@ TEST_IMPL(ip6_addr_link_local) {
uv_free_interface_addresses(addresses, count);
+ scoped_addr_len = sizeof(scoped_addr);
+ ASSERT(0 != uv_if_indextoname((unsigned int)-1, scoped_addr, &scoped_addr_len));
+
MAKE_VALGRIND_HAPPY();
return 0;
}
diff --git a/deps/uv/test/test-list.h b/deps/uv/test/test-list.h
index 0dde57c2ed..3e88e6c928 100644
--- a/deps/uv/test/test-list.h
+++ b/deps/uv/test/test-list.h
@@ -204,6 +204,7 @@ TEST_DECLARE (pipe_ref4)
TEST_DECLARE (pipe_close_stdout_read_stdin)
#endif
TEST_DECLARE (pipe_set_non_blocking)
+TEST_DECLARE (pipe_set_chmod)
TEST_DECLARE (process_ref)
TEST_DECLARE (has_ref)
TEST_DECLARE (active)
@@ -282,6 +283,9 @@ TEST_DECLARE (fs_readlink)
TEST_DECLARE (fs_realpath)
TEST_DECLARE (fs_symlink)
TEST_DECLARE (fs_symlink_dir)
+#ifdef _WIN32
+TEST_DECLARE (fs_non_symlink_reparse_point)
+#endif
TEST_DECLARE (fs_utime)
TEST_DECLARE (fs_futime)
TEST_DECLARE (fs_file_open_append)
@@ -398,8 +402,10 @@ TEST_DECLARE (fork_signal_to_child_closed)
TEST_DECLARE (fork_fs_events_child)
TEST_DECLARE (fork_fs_events_child_dir)
TEST_DECLARE (fork_fs_events_file_parent_child)
+#ifndef __MVS__
TEST_DECLARE (fork_threadpool_queue_work_simple)
#endif
+#endif
TASK_LIST_START
TEST_ENTRY_CUSTOM (platform_output, 0, 1, 5000)
@@ -438,6 +444,7 @@ TASK_LIST_START
TEST_ENTRY (pipe_close_stdout_read_stdin)
#endif
TEST_ENTRY (pipe_set_non_blocking)
+ TEST_ENTRY (pipe_set_chmod)
TEST_ENTRY (tty)
#ifdef _WIN32
TEST_ENTRY (tty_raw)
@@ -790,6 +797,9 @@ TASK_LIST_START
TEST_ENTRY (fs_realpath)
TEST_ENTRY (fs_symlink)
TEST_ENTRY (fs_symlink_dir)
+#ifdef _WIN32
+ TEST_ENTRY (fs_non_symlink_reparse_point)
+#endif
TEST_ENTRY (fs_stat_missing_path)
TEST_ENTRY (fs_read_file_eof)
TEST_ENTRY (fs_file_open_append)
@@ -861,8 +871,10 @@ TASK_LIST_START
TEST_ENTRY (fork_fs_events_child)
TEST_ENTRY (fork_fs_events_child_dir)
TEST_ENTRY (fork_fs_events_file_parent_child)
+#ifndef __MVS__
TEST_ENTRY (fork_threadpool_queue_work_simple)
#endif
+#endif
#if 0
/* These are for testing the test runner. */
diff --git a/deps/uv/test/test-pipe-set-fchmod.c b/deps/uv/test/test-pipe-set-fchmod.c
new file mode 100644
index 0000000000..59f0e6f545
--- /dev/null
+++ b/deps/uv/test/test-pipe-set-fchmod.c
@@ -0,0 +1,66 @@
+/* Copyright libuv project contributors. All rights reserved.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the "Software"), to
+* deal in the Software without restriction, including without limitation the
+* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+* sell copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+* IN THE SOFTWARE.
+*/
+
+
+#include "uv.h"
+#include "task.h"
+
+TEST_IMPL(pipe_set_chmod) {
+ uv_pipe_t pipe_handle;
+ uv_loop_t* loop;
+ int r;
+
+ loop = uv_default_loop();
+
+ r = uv_pipe_init(loop, &pipe_handle, 0);
+ ASSERT(r == 0);
+
+ r = uv_pipe_bind(&pipe_handle, TEST_PIPENAME);
+ ASSERT(r == 0);
+
+ /* No easy way to test if this works, we will only make sure that */
+ /* the call is successful. */
+ r = uv_pipe_chmod(&pipe_handle, UV_READABLE);
+ if (r == UV_EPERM) {
+ MAKE_VALGRIND_HAPPY();
+ RETURN_SKIP("Insufficient privileges to alter pipe fmode");
+ }
+ ASSERT(r == 0);
+
+ r = uv_pipe_chmod(&pipe_handle, UV_WRITABLE);
+ ASSERT(r == 0);
+
+ r = uv_pipe_chmod(&pipe_handle, UV_WRITABLE | UV_READABLE);
+ ASSERT(r == 0);
+
+ r = uv_pipe_chmod(NULL, UV_WRITABLE | UV_READABLE);
+ ASSERT(r == UV_EBADF);
+
+ r = uv_pipe_chmod(&pipe_handle, 12345678);
+ ASSERT(r == UV_EINVAL);
+
+ uv_close((uv_handle_t*)&pipe_handle, NULL);
+ r = uv_pipe_chmod(&pipe_handle, UV_WRITABLE | UV_READABLE);
+ ASSERT(r == UV_EBADF);
+
+ MAKE_VALGRIND_HAPPY();
+ return 0;
+}
diff --git a/deps/uv/test/test-platform-output.c b/deps/uv/test/test-platform-output.c
index 72c176edc4..50ed59a6d2 100644
--- a/deps/uv/test/test-platform-output.c
+++ b/deps/uv/test/test-platform-output.c
@@ -29,6 +29,7 @@ TEST_IMPL(platform_output) {
size_t rss;
size_t size;
double uptime;
+ uv_pid_t ppid;
uv_rusage_t rusage;
uv_cpu_info_t* cpus;
uv_interface_address_t* interfaces;
@@ -144,5 +145,9 @@ TEST_IMPL(platform_output) {
printf(" shell: %s\n", pwd.shell);
printf(" home directory: %s\n", pwd.homedir);
+ ppid = uv_os_getppid();
+ ASSERT(ppid > 0);
+ printf("uv_os_getppid: %d\n", (int) ppid);
+
return 0;
}
diff --git a/deps/uv/test/test-spawn.c b/deps/uv/test/test-spawn.c
index 91d831e19b..d3958fe216 100644
--- a/deps/uv/test/test-spawn.c
+++ b/deps/uv/test/test-spawn.c
@@ -1721,9 +1721,9 @@ TEST_IMPL(spawn_quoted_path) {
RETURN_SKIP("Test for Windows");
#else
char* quoted_path_env[2];
- options.file = "not_existing";
- args[0] = options.file;
+ args[0] = "not_existing";
args[1] = NULL;
+ options.file = args[0];
options.args = args;
options.exit_cb = exit_cb;
options.flags = 0;
diff --git a/deps/uv/uv.gyp b/deps/uv/uv.gyp
index 38765eefd1..9d9bb4b735 100644
--- a/deps/uv/uv.gyp
+++ b/deps/uv/uv.gyp
@@ -393,6 +393,7 @@
'test/test-pipe-server-close.c',
'test/test-pipe-close-stdout-read-stdin.c',
'test/test-pipe-set-non-blocking.c',
+ 'test/test-pipe-set-fchmod.c',
'test/test-platform-output.c',
'test/test-poll.c',
'test/test-poll-close.c',