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>
This commit is contained in:
cjihrig 2017-11-10 12:15:10 -05:00
parent 6f02da255f
commit 766cd1f59d
No known key found for this signature in database
GPG Key ID: 7434390BDBE9B9C5
39 changed files with 1035 additions and 77 deletions

1
deps/uv/.mailmap vendored
View File

@ -26,6 +26,7 @@ Marc Schlaich <marc.schlaich@googlemail.com> <marc.schlaich@gmail.com>
Michael <michael_dawson@ca.ibm.com> Michael <michael_dawson@ca.ibm.com>
Michael Neumann <mneumann@think.localnet> <mneumann@ntecs.de> Michael Neumann <mneumann@think.localnet> <mneumann@ntecs.de>
Nicholas Vavilov <vvnicholas@gmail.com> 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>
Rasmus Christian Pedersen <zerhacken@yahoo.com> <ruysch@outlook.com> Rasmus Christian Pedersen <zerhacken@yahoo.com> <ruysch@outlook.com>
Robert Mustacchi <rm@joyent.com> <rm@fingolfin.org> Robert Mustacchi <rm@joyent.com> <rm@fingolfin.org>

3
deps/uv/AUTHORS vendored
View File

@ -315,3 +315,6 @@ darobs <darobs@microsoft.com>
Zheng, Lei <realthunder.dev@gmail.com> Zheng, Lei <realthunder.dev@gmail.com>
Carlo Marcelo Arenas Belón <carenas@gmail.com> Carlo Marcelo Arenas Belón <carenas@gmail.com>
Scott Parker <scott.parker087@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>

52
deps/uv/ChangeLog vendored
View File

@ -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 2017.10.03, Version 1.15.0 (Stable), 8b69ce1419d2958011d415a636810705c36c2cc2
Changes since version 1.14.1: Changes since version 1.14.1:

1
deps/uv/Makefile.am vendored
View File

@ -212,6 +212,7 @@ test_run_tests_SOURCES = test/blackhole-server.c \
test/test-pipe-server-close.c \ test/test-pipe-server-close.c \
test/test-pipe-close-stdout-read-stdin.c \ test/test-pipe-close-stdout-read-stdin.c \
test/test-pipe-set-non-blocking.c \ test/test-pipe-set-non-blocking.c \
test/test-pipe-set-fchmod.c \
test/test-platform-output.c \ test/test-platform-output.c \
test/test-poll.c \ test/test-poll.c \
test/test-poll-close.c \ test/test-poll-close.c \

View File

@ -1,4 +1,4 @@
version: v1.15.0.build{build} version: v1.16.1.build{build}
init: init:
- git config --global core.autocrlf true - git config --global core.autocrlf true

View File

@ -13,7 +13,7 @@
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
AC_PREREQ(2.57) 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]) AC_CONFIG_MACRO_DIR([m4])
m4_include([m4/libuv-extra-automake-flags.m4]) m4_include([m4/libuv-extra-automake-flags.m4])
m4_include([m4/as_case.m4]) m4_include([m4/as_case.m4])

View File

@ -353,3 +353,154 @@ Helper functions
any attempts to close it or to use it after closing the fd may lead to malfunction. any attempts to close it or to use it after closing the fd may lead to malfunction.
.. versionadded:: 1.12.0 .. 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.

View File

@ -86,6 +86,9 @@ API
should) be closed with :c:func:`uv_loop_close` so the resources associated should) be closed with :c:func:`uv_loop_close` so the resources associated
with it are freed. with it are freed.
.. warning::
This function is not thread safe.
.. c:function:: int uv_run(uv_loop_t* loop, uv_run_mode mode) .. 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 This function runs the event loop. It will act differently depending on the

View File

@ -59,6 +59,12 @@ Data types
Abstract representation of a file descriptor. On Unix systems this is a Abstract representation of a file descriptor. On Unix systems this is a
`typedef` of `int` and on Windows a `HANDLE`. `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 .. c:type:: uv_rusage_t
Data type for resource usage results. 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. On Windows not all fields are set, the unsupported fields are filled with zeroes.
See :c:type:`uv_rusage_t` for more details. 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) .. 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 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 and :man:`inet_pton(3)`. On success they return 0. In case of error
the target `dst` pointer is unmodified. 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) .. c:function:: int uv_exepath(char* buffer, size_t* size)
Gets the executable path. Gets the executable path.

View File

@ -102,3 +102,12 @@ API
and call ``uv_accept(pipe, handle)``. and call ``uv_accept(pipe, handle)``.
.. seealso:: The :c:type:`uv_stream_t` API functions also apply. .. 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

View File

@ -422,4 +422,10 @@
# define UV__EREMOTEIO (-4030) # define UV__EREMOTEIO (-4030)
#endif #endif
#if defined(ENOTTY) && !defined(_WIN32)
# define UV__ENOTTY (-ENOTTY)
#else
# define UV__ENOTTY (-4029)
#endif
#endif /* UV_ERRNO_H_ */ #endif /* UV_ERRNO_H_ */

View File

@ -123,6 +123,7 @@ typedef struct uv_buf_t {
typedef int uv_file; typedef int uv_file;
typedef int uv_os_sock_t; typedef int uv_os_sock_t;
typedef int uv_os_fd_t; typedef int uv_os_fd_t;
typedef pid_t uv_pid_t;
#define UV_ONCE_INIT PTHREAD_ONCE_INIT #define UV_ONCE_INIT PTHREAD_ONCE_INIT
@ -365,4 +366,97 @@ typedef struct {
uv_fs_event_cb cb; \ uv_fs_event_cb cb; \
UV_PLATFORM_FS_EVENT_FIELDS \ 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 */ #endif /* UV_UNIX_H */

View File

@ -31,8 +31,8 @@
*/ */
#define UV_VERSION_MAJOR 1 #define UV_VERSION_MAJOR 1
#define UV_VERSION_MINOR 15 #define UV_VERSION_MINOR 16
#define UV_VERSION_PATCH 0 #define UV_VERSION_PATCH 1
#define UV_VERSION_IS_RELEASE 1 #define UV_VERSION_IS_RELEASE 1
#define UV_VERSION_SUFFIX "" #define UV_VERSION_SUFFIX ""

View File

@ -222,6 +222,7 @@ typedef struct uv_buf_t {
typedef int uv_file; typedef int uv_file;
typedef SOCKET uv_os_sock_t; typedef SOCKET uv_os_sock_t;
typedef HANDLE uv_os_fd_t; typedef HANDLE uv_os_fd_t;
typedef int uv_pid_t;
typedef HANDLE uv_thread_t; typedef HANDLE uv_thread_t;
@ -648,3 +649,28 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s);
#ifndef X_OK #ifndef X_OK
#define X_OK 1 #define X_OK 1
#endif #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 */

18
deps/uv/include/uv.h vendored
View File

@ -141,6 +141,7 @@ extern "C" {
XX(EMLINK, "too many links") \ XX(EMLINK, "too many links") \
XX(EHOSTDOWN, "host is down") \ XX(EHOSTDOWN, "host is down") \
XX(EREMOTEIO, "remote I/O error") \ XX(EREMOTEIO, "remote I/O error") \
XX(ENOTTY, "inappropriate ioctl for device") \
#define UV_HANDLE_TYPE_MAP(XX) \ #define UV_HANDLE_TYPE_MAP(XX) \
XX(ASYNC, async) \ 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 void uv_pipe_pending_instances(uv_pipe_t* handle, int count);
UV_EXTERN int uv_pipe_pending_count(uv_pipe_t* handle); 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 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 { 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_tmpdir(char* buffer, size_t* size);
UV_EXTERN int uv_os_get_passwd(uv_passwd_t* pwd); UV_EXTERN int uv_os_get_passwd(uv_passwd_t* pwd);
UV_EXTERN void uv_os_free_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 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); 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_ntop(int af, const void* src, char* dst, size_t size);
UV_EXTERN int uv_inet_pton(int af, const char* src, void* dst); 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_exepath(char* buffer, size_t* size);
UV_EXTERN int uv_cwd(char* buffer, size_t* size); UV_EXTERN int uv_cwd(char* buffer, size_t* size);

View File

@ -1343,3 +1343,8 @@ int uv_os_gethostname(char* buffer, size_t* size) {
uv_os_fd_t uv_get_osfhandle(int fd) { uv_os_fd_t uv_get_osfhandle(int fd) {
return fd; return fd;
} }
uv_pid_t uv_os_getppid(void) {
return getppid();
}

27
deps/uv/src/unix/fs.c vendored
View File

@ -132,26 +132,33 @@
while (0) while (0)
static ssize_t uv__fs_fdatasync(uv_fs_t* req) { static ssize_t uv__fs_fsync(uv_fs_t* req) {
#if defined(__linux__) || defined(__sun) || defined(__NetBSD__) #if defined(__APPLE__)
return fdatasync(req->file);
#elif defined(__APPLE__)
/* Apple's fdatasync and fsync explicitly do NOT flush the drive write cache /* 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 * 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 * 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 #else
return fsync(req->file); return fsync(req->file);
#endif #endif
} }
static ssize_t uv__fs_fsync(uv_fs_t* req) { static ssize_t uv__fs_fdatasync(uv_fs_t* req) {
#if defined(__APPLE__) #if defined(__linux__) || defined(__sun) || defined(__NetBSD__)
/* See the comment in uv__fs_fdatasync. */ return fdatasync(req->file);
return fcntl(req->file, F_FULLFSYNC); #elif defined(__APPLE__)
/* See the comment in uv__fs_fsync. */
return uv__fs_fsync(req);
#else #else
return fsync(req->file); return fsync(req->file);
#endif #endif

View File

@ -32,6 +32,7 @@
#include <stddef.h> /* NULL */ #include <stddef.h> /* NULL */
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <net/if.h> /* if_indextoname() */
/* EAI_* constants. */ /* EAI_* constants. */
#include <netdb.h> #include <netdb.h>
@ -200,3 +201,32 @@ void uv_freeaddrinfo(struct addrinfo* ai) {
if (ai) if (ai)
freeaddrinfo(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);
}

View File

@ -65,7 +65,6 @@ static int uv__has_forked_with_cfrunloop;
int uv__io_fork(uv_loop_t* loop) { int uv__io_fork(uv_loop_t* loop) {
int err; int err;
uv__close(loop->backend_fd);
loop->backend_fd = -1; loop->backend_fd = -1;
err = uv__kqueue_init(loop); err = uv__kqueue_init(loop);
if (err) if (err)

View File

@ -31,7 +31,6 @@ int uv_loop_init(uv_loop_t* loop) {
void* saved_data; void* saved_data;
int err; int err;
uv__signal_global_once_init();
saved_data = loop->data; saved_data = loop->data;
memset(loop, 0, sizeof(*loop)); memset(loop, 0, sizeof(*loop));
@ -68,6 +67,7 @@ int uv_loop_init(uv_loop_t* loop) {
if (err) if (err)
return err; return err;
uv__signal_global_once_init();
err = uv_signal_init(loop, &loop->child_watcher); err = uv_signal_init(loop, &loop->child_watcher);
if (err) if (err)
goto fail_signal_init; goto fail_signal_init;

View File

@ -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) { static void epoll_init(void) {
QUEUE_INIT(&global_epoll_queue); QUEUE_INIT(&global_epoll_queue);
if (uv_mutex_init(&global_epoll_lock)) if (uv_mutex_init(&global_epoll_lock))
abort(); abort();
if (pthread_atfork(&before_fork, &after_fork, &child_fork))
abort();
} }

View File

@ -302,3 +302,56 @@ uv_handle_type uv_pipe_pending_type(uv_pipe_t* handle) {
else else
return uv__handle_type(handle->accepted_fd); 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;
}

10
deps/uv/src/win/dl.c vendored
View File

@ -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 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_PTR arg;
DWORD res; DWORD res;
char* msg;
if (lib->errmsg) { if (lib->errmsg) {
LocalFree(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); 0, (LPSTR) &lib->errmsg, 0, NULL);
} }
/* Inexpert hack to get the filename into the error message. */ if (res && errorno == ERROR_BAD_EXE_FORMAT && strstr(lib->errmsg, "%1")) {
if (res && strstr(lib->errmsg, not_win32_app_msg)) { msg = lib->errmsg;
LocalFree(lib->errmsg);
lib->errmsg = NULL; lib->errmsg = NULL;
arg = (DWORD_PTR) filename; arg = (DWORD_PTR) filename;
res = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | res = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_ARGUMENT_ARRAY | FORMAT_MESSAGE_ARGUMENT_ARRAY |
FORMAT_MESSAGE_FROM_STRING, FORMAT_MESSAGE_FROM_STRING,
not_win32_app_msg, msg,
0, 0, (LPSTR) &lib->errmsg, 0, (va_list*) &arg); 0, 0, (LPSTR) &lib->errmsg, 0, (va_list*) &arg);
LocalFree(msg);
} }
if (!res) if (!res)

102
deps/uv/src/win/fs.c vendored
View File

@ -415,21 +415,21 @@ void fs__open(uv_fs_t* req) {
umask(current_umask); umask(current_umask);
/* convert flags and mode to CreateFile parameters */ /* convert flags and mode to CreateFile parameters */
switch (flags & (_O_RDONLY | _O_WRONLY | _O_RDWR)) { switch (flags & (UV_FS_O_RDONLY | UV_FS_O_WRONLY | UV_FS_O_RDWR)) {
case _O_RDONLY: case UV_FS_O_RDONLY:
access = FILE_GENERIC_READ; access = FILE_GENERIC_READ;
break; break;
case _O_WRONLY: case UV_FS_O_WRONLY:
access = FILE_GENERIC_WRITE; access = FILE_GENERIC_WRITE;
break; break;
case _O_RDWR: case UV_FS_O_RDWR:
access = FILE_GENERIC_READ | FILE_GENERIC_WRITE; access = FILE_GENERIC_READ | FILE_GENERIC_WRITE;
break; break;
default: default:
goto einval; goto einval;
} }
if (flags & _O_APPEND) { if (flags & UV_FS_O_APPEND) {
access &= ~FILE_WRITE_DATA; access &= ~FILE_WRITE_DATA;
access |= FILE_APPEND_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; 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 0:
case _O_EXCL: case UV_FS_O_EXCL:
disposition = OPEN_EXISTING; disposition = OPEN_EXISTING;
break; break;
case _O_CREAT: case UV_FS_O_CREAT:
disposition = OPEN_ALWAYS; disposition = OPEN_ALWAYS;
break; break;
case _O_CREAT | _O_EXCL: case UV_FS_O_CREAT | UV_FS_O_EXCL:
case _O_CREAT | _O_TRUNC | _O_EXCL: case UV_FS_O_CREAT | UV_FS_O_TRUNC | UV_FS_O_EXCL:
disposition = CREATE_NEW; disposition = CREATE_NEW;
break; break;
case _O_TRUNC: case UV_FS_O_TRUNC:
case _O_TRUNC | _O_EXCL: case UV_FS_O_TRUNC | UV_FS_O_EXCL:
disposition = TRUNCATE_EXISTING; disposition = TRUNCATE_EXISTING;
break; break;
case _O_CREAT | _O_TRUNC: case UV_FS_O_CREAT | UV_FS_O_TRUNC:
disposition = CREATE_ALWAYS; disposition = CREATE_ALWAYS;
break; break;
default: default:
@ -466,34 +466,49 @@ void fs__open(uv_fs_t* req) {
} }
attributes |= FILE_ATTRIBUTE_NORMAL; attributes |= FILE_ATTRIBUTE_NORMAL;
if (flags & _O_CREAT) { if (flags & UV_FS_O_CREAT) {
if (!((req->fs.info.mode & ~current_umask) & _S_IWRITE)) { if (!((req->fs.info.mode & ~current_umask) & _S_IWRITE)) {
attributes |= FILE_ATTRIBUTE_READONLY; attributes |= FILE_ATTRIBUTE_READONLY;
} }
} }
if (flags & _O_TEMPORARY ) { if (flags & UV_FS_O_TEMPORARY ) {
attributes |= FILE_FLAG_DELETE_ON_CLOSE | FILE_ATTRIBUTE_TEMPORARY; attributes |= FILE_FLAG_DELETE_ON_CLOSE | FILE_ATTRIBUTE_TEMPORARY;
access |= DELETE; access |= DELETE;
} }
if (flags & _O_SHORT_LIVED) { if (flags & UV_FS_O_SHORT_LIVED) {
attributes |= FILE_ATTRIBUTE_TEMPORARY; attributes |= FILE_ATTRIBUTE_TEMPORARY;
} }
switch (flags & (_O_SEQUENTIAL | _O_RANDOM)) { switch (flags & (UV_FS_O_SEQUENTIAL | UV_FS_O_RANDOM)) {
case 0: case 0:
break; break;
case _O_SEQUENTIAL: case UV_FS_O_SEQUENTIAL:
attributes |= FILE_FLAG_SEQUENTIAL_SCAN; attributes |= FILE_FLAG_SEQUENTIAL_SCAN;
break; break;
case _O_RANDOM: case UV_FS_O_RANDOM:
attributes |= FILE_FLAG_RANDOM_ACCESS; attributes |= FILE_FLAG_RANDOM_ACCESS;
break; break;
default: default:
goto einval; 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. */ /* Setting this flag makes it possible to open a directory. */
attributes |= FILE_FLAG_BACKUP_SEMANTICS; attributes |= FILE_FLAG_BACKUP_SEMANTICS;
@ -506,9 +521,9 @@ void fs__open(uv_fs_t* req) {
NULL); NULL);
if (file == INVALID_HANDLE_VALUE) { if (file == INVALID_HANDLE_VALUE) {
DWORD error = GetLastError(); DWORD error = GetLastError();
if (error == ERROR_FILE_EXISTS && (flags & _O_CREAT) && if (error == ERROR_FILE_EXISTS && (flags & UV_FS_O_CREAT) &&
!(flags & _O_EXCL)) { !(flags & UV_FS_O_EXCL)) {
/* Special case: when ERROR_FILE_EXISTS happens and O_CREAT was */ /* Special case: when ERROR_FILE_EXISTS happens and UV_FS_O_CREAT was */
/* specified, it means the path referred to a directory. */ /* specified, it means the path referred to a directory. */
SET_REQ_UV_ERROR(req, UV_EISDIR, error); SET_REQ_UV_ERROR(req, UV_EISDIR, error);
} else { } 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_ALL_INFORMATION file_info;
FILE_FS_VOLUME_INFORMATION volume_info; FILE_FS_VOLUME_INFORMATION volume_info;
NTSTATUS nt_status; NTSTATUS nt_status;
@ -1125,17 +1141,25 @@ INLINE static int fs__stat_handle(HANDLE handle, uv_stat_t* statbuf) {
*/ */
statbuf->st_mode = 0; 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 * If reading the link fails, the reparse point is not a symlink and needs
* any link data. In that case DeviceIoControl() in fs__readlink_handle() sets * to be treated as a regular file. The higher level lstat function will
* the last error to ERROR_NOT_A_REPARSE_POINT. Then the stat result mode * detect this failure and retry without do_lstat if appropriate.
* calculated below will indicate a normal directory or file, as if
* FILE_ATTRIBUTE_REPARSE_POINT was not present.
*/ */
if (fs__readlink_handle(handle, NULL, &statbuf->st_size) == 0) { if (fs__readlink_handle(handle, NULL, &statbuf->st_size) != 0)
statbuf->st_mode |= S_IFLNK; return -1;
} statbuf->st_mode |= S_IFLNK;
} }
if (statbuf->st_mode == 0) { 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 * Therefore we'll just report a sensible value that's quite commonly okay
* on modern hardware. * 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 /* Todo: set st_flags to something meaningful. Also provide a wrapper for
* chattr(2). * chattr(2).
@ -1230,9 +1258,11 @@ INLINE static void fs__stat_impl(uv_fs_t* req, int do_lstat) {
return; return;
} }
if (fs__stat_handle(handle, &req->statbuf) != 0) { if (fs__stat_handle(handle, &req->statbuf, do_lstat) != 0) {
DWORD error = GetLastError(); 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. */ /* We opened a reparse point but it was not a symlink. Try again. */
fs__stat_impl(req, 0); fs__stat_impl(req, 0);
@ -1276,7 +1306,7 @@ static void fs__fstat(uv_fs_t* req) {
return; return;
} }
if (fs__stat_handle(handle, &req->statbuf) != 0) { if (fs__stat_handle(handle, &req->statbuf, 0) != 0) {
SET_REQ_WIN32_ERROR(req, GetLastError()); SET_REQ_WIN32_ERROR(req, GetLastError());
return; return;
} }

View File

@ -28,6 +28,8 @@
/* EAI_* constants. */ /* EAI_* constants. */
#include <winsock2.h> #include <winsock2.h>
/* Needed for ConvertInterfaceIndexToLuid and ConvertInterfaceLuidToNameA */
#include <iphlpapi.h>
int uv__getaddrinfo_translate_error(int sys_err) { int uv__getaddrinfo_translate_error(int sys_err) {
switch (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? */ /* Do we need different versions of this for different architectures? */
#define ALIGNED_SIZE(X) ((((X) + 3) >> 2) << 2) #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) { static void uv__getaddrinfo_work(struct uv__work* w) {
uv_getaddrinfo_t* req; uv_getaddrinfo_t* req;
@ -380,3 +385,69 @@ error:
} }
return uv_translate_sys_error(err); 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;
}

View File

@ -326,7 +326,6 @@ void uv__fs_poll_endgame(uv_loop_t* loop, uv_fs_poll_t* handle);
void uv__util_init(void); void uv__util_init(void);
uint64_t uv__hrtime(double scale); uint64_t uv__hrtime(double scale);
int uv_parent_pid(void);
int uv_current_pid(void); int uv_current_pid(void);
__declspec(noreturn) void uv_fatal_error(const int errorno, const char* syscall); __declspec(noreturn) void uv_fatal_error(const int errorno, const char* syscall);
int uv__getpwuid_r(uv_passwd_t* pwd); int uv__getpwuid_r(uv_passwd_t* pwd);

View File

@ -31,6 +31,9 @@
#include "stream-inl.h" #include "stream-inl.h"
#include "req-inl.h" #include "req-inl.h"
#include <AclAPI.h>
#include <AccCtrl.h>
typedef struct uv__ipc_queue_item_s uv__ipc_queue_item_t; typedef struct uv__ipc_queue_item_s uv__ipc_queue_item_t;
struct uv__ipc_queue_item_s { 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); uv_unique_pipe_name(ptr, name, nameSize);
pipeHandle = CreateNamedPipeA(name, 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, PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT, 1, 65536, 65536, 0,
NULL); 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, handle->pipe.serv.accept_reqs[0].pipeHandle = CreateNamedPipeW(handle->name,
PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED | 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_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT,
PIPE_UNLIMITED_INSTANCES, 65536, 65536, 0, NULL); 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); assert(req->pipeHandle == INVALID_HANDLE_VALUE);
req->pipeHandle = CreateNamedPipeW(handle->name, 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_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT,
PIPE_UNLIMITED_INSTANCES, 65536, 65536, 0, NULL); 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) { if (pipe->ipc) {
assert(!(pipe->flags & UV_HANDLE_NON_OVERLAPPED_PIPE)); 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); assert(pipe->pipe.conn.ipc_pid != -1);
} }
return 0; return 0;
@ -2132,3 +2135,80 @@ uv_handle_type uv_pipe_pending_type(uv_pipe_t* handle) {
else else
return UV_TCP; 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);
}

View File

@ -36,6 +36,7 @@ INLINE static void uv_stream_init(uv_loop_t* loop,
uv__handle_init(loop, (uv_handle_t*) handle, type); uv__handle_init(loop, (uv_handle_t*) handle, type);
handle->write_queue_size = 0; handle->write_queue_size = 0;
handle->activecnt = 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.event_handle = NULL;
handle->read_req.wait_handle = INVALID_HANDLE_VALUE; handle->read_req.wait_handle = INVALID_HANDLE_VALUE;
handle->read_req.data = handle; handle->read_req.data = handle;
handle->stream.conn.shutdown_req = NULL;
} }

View File

@ -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; int parent_pid = -1;
HANDLE handle; HANDLE handle;
PROCESSENTRY32 pe; PROCESSENTRY32 pe;

View File

@ -36,9 +36,9 @@ static int TARGET_CONNECTIONS;
static void do_write(uv_stream_t*); 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 req_free(uv_req_t* uv_req);
static void buf_alloc(uv_handle_t* handle, size_t size, uv_buf_t* buf); static void buf_alloc(uv_handle_t* handle, size_t size, uv_buf_t* buf);

View File

@ -81,6 +81,7 @@ int run_tests(int benchmark_output) {
int skipped; int skipped;
int current; int current;
int test_result; int test_result;
int skip;
task_entry_t* task; task_entry_t* task;
/* Count the number of tests. */ /* 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); fprintf(stderr, "1..%d\n", total);
fflush(stderr); fflush(stderr);
@ -127,6 +130,7 @@ void log_tap_result(int test_count,
const char* result; const char* result;
const char* directive; const char* directive;
char reason[1024]; char reason[1024];
int reason_length;
switch (status) { switch (status) {
case TEST_OK: case TEST_OK:
@ -144,6 +148,9 @@ void log_tap_result(int test_count,
if (status == TEST_SKIP && process_output_size(process) > 0) { if (status == TEST_SKIP && process_output_size(process) > 0) {
process_read_last_line(process, reason, sizeof reason); 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 { } else {
reason[0] = '\0'; reason[0] = '\0';
} }

View File

@ -636,6 +636,7 @@ static void assert_run_work(uv_loop_t* const loop) {
} }
#ifndef __MVS__
TEST_IMPL(fork_threadpool_queue_work_simple) { TEST_IMPL(fork_threadpool_queue_work_simple) {
/* The threadpool works in a child process. */ /* The threadpool works in a child process. */
@ -672,6 +673,7 @@ TEST_IMPL(fork_threadpool_queue_work_simple) {
MAKE_VALGRIND_HAPPY(); MAKE_VALGRIND_HAPPY();
return 0; return 0;
} }
#endif /* !__MVS__ */
#endif /* !_WIN32 */ #endif /* !_WIN32 */

114
deps/uv/test/test-fs.c vendored
View File

@ -115,6 +115,17 @@ static char test_buf[] = "test-buffer\n";
static char test_buf2[] = "second-buffer\n"; static char test_buf2[] = "second-buffer\n";
static uv_buf_t iov; 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) { static void check_permission(const char* filename, unsigned int mode) {
int r; int r;
uv_fs_t req; 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) { TEST_IMPL(fs_utime) {
utime_check_t checkme; utime_check_t checkme;
const char* path = "test_file"; const char* path = "test_file";

View File

@ -44,8 +44,12 @@ TEST_IMPL(ip6_addr_link_local) {
const char* device_name; const char* device_name;
/* 40 bytes address, 16 bytes device name, plus reserve. */ /* 40 bytes address, 16 bytes device name, plus reserve. */
char scoped_addr[128]; char scoped_addr[128];
size_t scoped_addr_len;
char interface_id[UV_IF_NAMESIZE];
size_t interface_id_len;
int count; int count;
int ix; int ix;
int r;
ASSERT(0 == uv_interface_addresses(&addresses, &count)); 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; iface_index = address->address.address6.sin6_scope_id;
device_name = address->name; 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 #ifdef _WIN32
snprintf(scoped_addr, /* On Windows, the interface identifier is the numeric string of the index. */
sizeof(scoped_addr), ASSERT(strtol(interface_id, NULL, 10) == iface_index);
"%s%%%d",
string_address,
iface_index);
#else #else
/* On Unix/Linux, the interface identifier is the interface device name. */
ASSERT(0 == strcmp(device_name, interface_id));
#endif
snprintf(scoped_addr, snprintf(scoped_addr,
sizeof(scoped_addr), sizeof(scoped_addr),
"%s%%%s", "%s%%%s",
string_address, string_address,
device_name); interface_id);
#endif
fprintf(stderr, "Testing link-local address %s " fprintf(stderr, "Testing link-local address %s "
"(iface_index: 0x%02x, device_name: %s)\n", "(iface_index: 0x%02x, device_name: %s)\n",
@ -96,6 +110,9 @@ TEST_IMPL(ip6_addr_link_local) {
uv_free_interface_addresses(addresses, count); 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(); MAKE_VALGRIND_HAPPY();
return 0; return 0;
} }

View File

@ -204,6 +204,7 @@ TEST_DECLARE (pipe_ref4)
TEST_DECLARE (pipe_close_stdout_read_stdin) TEST_DECLARE (pipe_close_stdout_read_stdin)
#endif #endif
TEST_DECLARE (pipe_set_non_blocking) TEST_DECLARE (pipe_set_non_blocking)
TEST_DECLARE (pipe_set_chmod)
TEST_DECLARE (process_ref) TEST_DECLARE (process_ref)
TEST_DECLARE (has_ref) TEST_DECLARE (has_ref)
TEST_DECLARE (active) TEST_DECLARE (active)
@ -282,6 +283,9 @@ TEST_DECLARE (fs_readlink)
TEST_DECLARE (fs_realpath) TEST_DECLARE (fs_realpath)
TEST_DECLARE (fs_symlink) TEST_DECLARE (fs_symlink)
TEST_DECLARE (fs_symlink_dir) TEST_DECLARE (fs_symlink_dir)
#ifdef _WIN32
TEST_DECLARE (fs_non_symlink_reparse_point)
#endif
TEST_DECLARE (fs_utime) TEST_DECLARE (fs_utime)
TEST_DECLARE (fs_futime) TEST_DECLARE (fs_futime)
TEST_DECLARE (fs_file_open_append) 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)
TEST_DECLARE (fork_fs_events_child_dir) TEST_DECLARE (fork_fs_events_child_dir)
TEST_DECLARE (fork_fs_events_file_parent_child) TEST_DECLARE (fork_fs_events_file_parent_child)
#ifndef __MVS__
TEST_DECLARE (fork_threadpool_queue_work_simple) TEST_DECLARE (fork_threadpool_queue_work_simple)
#endif #endif
#endif
TASK_LIST_START TASK_LIST_START
TEST_ENTRY_CUSTOM (platform_output, 0, 1, 5000) TEST_ENTRY_CUSTOM (platform_output, 0, 1, 5000)
@ -438,6 +444,7 @@ TASK_LIST_START
TEST_ENTRY (pipe_close_stdout_read_stdin) TEST_ENTRY (pipe_close_stdout_read_stdin)
#endif #endif
TEST_ENTRY (pipe_set_non_blocking) TEST_ENTRY (pipe_set_non_blocking)
TEST_ENTRY (pipe_set_chmod)
TEST_ENTRY (tty) TEST_ENTRY (tty)
#ifdef _WIN32 #ifdef _WIN32
TEST_ENTRY (tty_raw) TEST_ENTRY (tty_raw)
@ -790,6 +797,9 @@ TASK_LIST_START
TEST_ENTRY (fs_realpath) TEST_ENTRY (fs_realpath)
TEST_ENTRY (fs_symlink) TEST_ENTRY (fs_symlink)
TEST_ENTRY (fs_symlink_dir) TEST_ENTRY (fs_symlink_dir)
#ifdef _WIN32
TEST_ENTRY (fs_non_symlink_reparse_point)
#endif
TEST_ENTRY (fs_stat_missing_path) TEST_ENTRY (fs_stat_missing_path)
TEST_ENTRY (fs_read_file_eof) TEST_ENTRY (fs_read_file_eof)
TEST_ENTRY (fs_file_open_append) 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)
TEST_ENTRY (fork_fs_events_child_dir) TEST_ENTRY (fork_fs_events_child_dir)
TEST_ENTRY (fork_fs_events_file_parent_child) TEST_ENTRY (fork_fs_events_file_parent_child)
#ifndef __MVS__
TEST_ENTRY (fork_threadpool_queue_work_simple) TEST_ENTRY (fork_threadpool_queue_work_simple)
#endif #endif
#endif
#if 0 #if 0
/* These are for testing the test runner. */ /* These are for testing the test runner. */

66
deps/uv/test/test-pipe-set-fchmod.c vendored Normal file
View File

@ -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;
}

View File

@ -29,6 +29,7 @@ TEST_IMPL(platform_output) {
size_t rss; size_t rss;
size_t size; size_t size;
double uptime; double uptime;
uv_pid_t ppid;
uv_rusage_t rusage; uv_rusage_t rusage;
uv_cpu_info_t* cpus; uv_cpu_info_t* cpus;
uv_interface_address_t* interfaces; uv_interface_address_t* interfaces;
@ -144,5 +145,9 @@ TEST_IMPL(platform_output) {
printf(" shell: %s\n", pwd.shell); printf(" shell: %s\n", pwd.shell);
printf(" home directory: %s\n", pwd.homedir); printf(" home directory: %s\n", pwd.homedir);
ppid = uv_os_getppid();
ASSERT(ppid > 0);
printf("uv_os_getppid: %d\n", (int) ppid);
return 0; return 0;
} }

View File

@ -1721,9 +1721,9 @@ TEST_IMPL(spawn_quoted_path) {
RETURN_SKIP("Test for Windows"); RETURN_SKIP("Test for Windows");
#else #else
char* quoted_path_env[2]; char* quoted_path_env[2];
options.file = "not_existing"; args[0] = "not_existing";
args[0] = options.file;
args[1] = NULL; args[1] = NULL;
options.file = args[0];
options.args = args; options.args = args;
options.exit_cb = exit_cb; options.exit_cb = exit_cb;
options.flags = 0; options.flags = 0;

1
deps/uv/uv.gyp vendored
View File

@ -393,6 +393,7 @@
'test/test-pipe-server-close.c', 'test/test-pipe-server-close.c',
'test/test-pipe-close-stdout-read-stdin.c', 'test/test-pipe-close-stdout-read-stdin.c',
'test/test-pipe-set-non-blocking.c', 'test/test-pipe-set-non-blocking.c',
'test/test-pipe-set-fchmod.c',
'test/test-platform-output.c', 'test/test-platform-output.c',
'test/test-poll.c', 'test/test-poll.c',
'test/test-poll-close.c', 'test/test-poll-close.c',