Skip to content

Commit

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

- uv_fs_copyfile() now supports CIFS share destinations.
- isatty() now works on IBMi
- TTYs are opened with the O_NOCTTY flag.

Fixes: nodejs#31170

PR-URL: nodejs#31332
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
cjihrig authored and BethGriggs committed Feb 26, 2020

Unverified

The committer email address is not verified.
1 parent 111b697 commit c23e499
Showing 53 changed files with 369 additions and 2,204 deletions.
1 change: 1 addition & 0 deletions deps/uv/AUTHORS
Original file line number Diff line number Diff line change
@@ -412,3 +412,4 @@ ZYSzys <zyszys98@gmail.com>
Carl Lei <xecycle@gmail.com>
Stefan Bender <stefan.bender@ntnu.no>
nia <nia@NetBSD.org>
virtualyw <virtualyw@gmail.com>
67 changes: 67 additions & 0 deletions deps/uv/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,70 @@
2020.01.13, Version 1.34.1 (Stable), 8aa5636ec72990bb2856f81e14c95813024a5c2b

Changes since version 1.34.0:

* unix: fix -Wstrict-aliasing compiler warning (Ben Noordhuis)

* unix: cache address of dlsym("mkostemp") (Ben Noordhuis)

* build: remove -pedantic from compiler flags (Ben Noordhuis)

* Revert "darwin: assume pthread_setname_np() is available" (Ben Noordhuis)

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

* darwin: assume pthread_setname_np() is available (Ben Noordhuis)

* ibmi: fix the false isatty() issue on IBMi (Xu Meng)

* test: fix test failure under NetBSD and OpenBSD (David Carlier)

* test: skip some test cases on IBMi (Xu Meng)

* test: skip uv_(get|set)_process_title on IBMi (Xu Meng)

* doc: remove binaries for Windows from README (Richard Lau)

* unix: fix -Wunused-but-set-variable warning (George Zhao)

* unix: pass sysctl size arg using ARRAY_SIZE macro (David Carlier)

* test: disallow running the test suite as root (cjihrig)

* unix: suppress -Waddress-of-packed-member warning (Ben Noordhuis)

* misc: make more tags "not-stale" (Jameson Nash)

* test: fix pthread memory leak (Trevor Norris)

* docs: delete socks5-proxy sample (Jameson Nash)

* ibmi: fix the CMSG length issue (Xu Meng)

* docs: fix formatting (Jameson Nash)

* unix: squelch fchmod() EPERM on CIFS share (Ben Noordhuis)

* docs: fix linkcheck (Jameson Nash)

* docs: switch from linux.die.net to man7.org (Jameson Nash)

* win: remove abort when non-IFS LSP detection fails (virtualyw)

* docs: clarify that uv_pipe_t is a pipe (Jameson Nash)

* win,tty: avoid regressions in utf-8 handling (Jameson Nash)

* win: remove bad assert in uv_loop_close (Jameson Nash)

* test: fix -fno-common build errors (Ben Noordhuis)

* build: turn on -fno-common to catch regressions (Ben Noordhuis)

* test: fix fs birth time test failure (Ben Noordhuis)

* tty,unix: avoid affecting controlling TTY (Jameson Nash)


2019.12.05, Version 1.34.0 (Stable), 15ae750151ac9341e5945eb38f8982d59fb99201

Changes since version 1.33.1:
1 change: 0 additions & 1 deletion deps/uv/Makefile.am
Original file line number Diff line number Diff line change
@@ -123,7 +123,6 @@ EXTRA_DIST = test/fixtures/empty_file \
include \
docs \
img \
samples \
android-configure-arm \
android-configure-arm64 \
android-configure-x86 \
3 changes: 0 additions & 3 deletions deps/uv/README.md
Original file line number Diff line number Diff line change
@@ -116,9 +116,6 @@ libuv can be downloaded either from the
[GitHub repository](https://github.com/libuv/libuv)
or from the [downloads site](http://dist.libuv.org/dist/).

Starting with libuv 1.7.0, binaries for Windows are also provided. This is to
be considered EXPERIMENTAL.

Before verifying the git tags or signature files, importing the relevant keys
is necessary. Key IDs are listed in the
[MAINTAINERS](https://github.com/libuv/libuv/blob/master/MAINTAINERS.md)
5 changes: 3 additions & 2 deletions deps/uv/common.gypi
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@
},
'conditions': [
['OS != "zos"', {
'cflags': [ '-O0', '-fwrapv' ]
'cflags': [ '-O0', '-fno-common', '-fwrapv' ]
}],
['OS == "android"', {
'cflags': [ '-fPIE' ],
@@ -80,9 +80,10 @@
'conditions': [
['OS != "zos"', {
'cflags': [
'-fomit-frame-pointer',
'-fdata-sections',
'-ffunction-sections',
'-fno-common',
'-fomit-frame-pointer',
],
}],
]
5 changes: 1 addition & 4 deletions deps/uv/configure.ac
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

AC_PREREQ(2.57)
AC_INIT([libuv], [1.34.0], [https://github.com/libuv/libuv/issues])
AC_INIT([libuv], [1.34.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])
@@ -24,9 +24,6 @@ AC_ENABLE_SHARED
AC_ENABLE_STATIC
AC_PROG_CC
AM_PROG_CC_C_O
AS_IF([AS_CASE([$host_os],[openedition*], [false], [true])], [
CC_CHECK_CFLAGS_APPEND([-pedantic])
])
CC_FLAG_VISIBILITY #[-fvisibility=hidden]
CC_CHECK_CFLAGS_APPEND([-g])
CC_CHECK_CFLAGS_APPEND([-std=gnu89])
2 changes: 1 addition & 1 deletion deps/uv/docs/src/design.rst
Original file line number Diff line number Diff line change
@@ -126,7 +126,7 @@ Unlike network I/O, there are no platform-specific file I/O primitives libuv cou
so the current approach is to run blocking file I/O operations in a thread pool.

For a thorough explanation of the cross-platform file I/O landscape, checkout
`this post <http://blog.libtorrent.org/2012/10/asynchronous-disk-io/>`_.
`this post <https://blog.libtorrent.org/2012/10/asynchronous-disk-io/>`_.

libuv currently uses a global thread pool on which all loops can queue work. 3 types of
operations are currently run on this pool:
22 changes: 11 additions & 11 deletions deps/uv/docs/src/fs.rst
Original file line number Diff line number Diff line change
@@ -403,7 +403,7 @@ API
.. c:function:: int uv_fs_utime(uv_loop_t* loop, uv_fs_t* req, const char* path, double atime, double mtime, uv_fs_cb cb)
.. c:function:: int uv_fs_futime(uv_loop_t* loop, uv_fs_t* req, uv_file file, double atime, double mtime, uv_fs_cb cb)
Equivalent to :man:`utime(2)` and :man:`futime(2)` respectively.
Equivalent to :man:`utime(2)` and :man:`futimes(3)` respectively.
.. note::
AIX: This function only works for AIX 7.1 and newer. It can still be called on older
@@ -435,7 +435,7 @@ API
.. c:function:: int uv_fs_realpath(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb)
Equivalent to :man:`realpath(3)` on Unix. Windows uses `GetFinalPathNameByHandle <https://msdn.microsoft.com/en-us/library/windows/desktop/aa364962(v=vs.85).aspx>`_.
Equivalent to :man:`realpath(3)` on Unix. Windows uses `GetFinalPathNameByHandle <https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getfinalpathnamebyhandlea>`_.
The resulting string is stored in `req->ptr`.
.. warning::
@@ -512,7 +512,7 @@ Helper functions
.. c:function:: uv_os_fd_t uv_get_osfhandle(int fd)
For a file descriptor in the C runtime, get the OS-dependent handle.
On UNIX, returns the ``fd`` intact. On Windows, this calls `_get_osfhandle <https://msdn.microsoft.com/en-us/library/ks2530z6.aspx>`_.
On UNIX, returns the ``fd`` intact. On Windows, this calls `_get_osfhandle <https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/get-osfhandle?view=vs-2019>`_.
Note that the return value is still owned by the C runtime,
any attempts to close it or to use it after closing the fd may lead to malfunction.
@@ -521,7 +521,7 @@ Helper functions
.. c:function:: int uv_open_osfhandle(uv_os_fd_t os_fd)
For a OS-dependent handle, get the file descriptor in the C runtime.
On UNIX, returns the ``os_fd`` intact. On Windows, this calls `_open_osfhandle <https://msdn.microsoft.com/en-us/library/bdts1c9x.aspx>`_.
On UNIX, returns the ``os_fd`` intact. On Windows, this calls `_open_osfhandle <https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/open-osfhandle?view=vs-2019>`_.
Note that the return value is still owned by the CRT,
any attempts to close it or to use it after closing the handle may lead to malfunction.
@@ -547,7 +547,7 @@ File open constants
.. 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>`_.
`FILE_FLAG_NO_BUFFERING <https://docs.microsoft.com/en-us/windows/win32/fileio/file-buffering>`_.
`UV_FS_O_DIRECT` is not supported on macOS.
.. c:macro:: UV_FS_O_DIRECTORY
@@ -564,7 +564,7 @@ File open constants
.. 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>`_.
`FILE_FLAG_WRITE_THROUGH <https://docs.microsoft.com/en-us/windows/win32/fileio/file-buffering>`_.
.. c:macro:: UV_FS_O_EXCL
@@ -631,7 +631,7 @@ File open constants
.. 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>`_.
`FILE_FLAG_RANDOM_ACCESS <https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilea>`_.
.. c:macro:: UV_FS_O_RDONLY
@@ -648,15 +648,15 @@ File open constants
.. 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>`_.
`FILE_FLAG_SEQUENTIAL_SCAN <https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilea>`_.
.. 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>`_.
`FILE_ATTRIBUTE_TEMPORARY <https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilea>`_.
.. c:macro:: UV_FS_O_SYMLINK
@@ -669,15 +669,15 @@ File open constants
.. 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>`_.
`FILE_FLAG_WRITE_THROUGH <https://docs.microsoft.com/en-us/windows/win32/fileio/file-buffering>`_.
.. 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>`_.
`FILE_ATTRIBUTE_TEMPORARY <https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilea>`_.
.. c:macro:: UV_FS_O_TRUNC
2 changes: 1 addition & 1 deletion deps/uv/docs/src/fs_event.rst
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ the best backend for the job on each platform.
creation/deletion within a directory that is being monitored.
See the `IBM Knowledge centre`_ for more details.

.. _documentation: http://www.ibm.com/developerworks/aix/library/au-aix_event_infrastructure/
.. _documentation: https://developer.ibm.com/articles/au-aix_event_infrastructure/
.. _`IBM Knowledge centre`: https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.2.0/com.ibm.zos.v2r1.bpxb100/ioc.htm


8 changes: 4 additions & 4 deletions deps/uv/docs/src/index.rst
Original file line number Diff line number Diff line change
@@ -13,9 +13,9 @@ was primarily developed for use by `Node.js`_, but it's also used by `Luvit`_,
In case you find errors in this documentation you can help by sending
`pull requests <https://github.com/libuv/libuv>`_!

.. _Node.js: http://nodejs.org
.. _Luvit: http://luvit.io
.. _Julia: http://julialang.org
.. _Node.js: https://nodejs.org
.. _Luvit: https://luvit.io
.. _Julia: https://julialang.org
.. _pyuv: https://github.com/saghul/pyuv
.. _others: https://github.com/libuv/libuv/wiki/Projects-that-use-libuv

@@ -52,7 +52,7 @@ Documentation
Downloads
---------

libuv can be downloaded from `here <http://dist.libuv.org/dist/>`_.
libuv can be downloaded from `here <https://dist.libuv.org/dist/>`_.


Installation
14 changes: 7 additions & 7 deletions deps/uv/docs/src/misc.rst
Original file line number Diff line number Diff line change
@@ -192,10 +192,10 @@ Data types

::

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

.. c:type:: uv_random_t
@@ -314,7 +314,7 @@ API
.. c:function:: void uv_loadavg(double avg[3])
Gets the load average. See: `<http://en.wikipedia.org/wiki/Load_(computing)>`_
Gets the load average. See: `<https://en.wikipedia.org/wiki/Load_(computing)>`_
.. note::
Returns [0,0,0] on Windows (i.e., it's not implemented).
@@ -646,7 +646,7 @@ API
Retrieves system information in `buffer`. The populated data includes the
operating system name, release, version, and machine. On non-Windows
systems, `uv_os_uname()` is a thin wrapper around :man:`uname(3)`. Returns
systems, `uv_os_uname()` is a thin wrapper around :man:`uname(2)`. Returns
zero on success, and a non-zero error value otherwise.
.. versionadded:: 1.25.0
@@ -687,7 +687,7 @@ API
- Other UNIX: `/dev/urandom` after reading from `/dev/random` once.
:returns: 0 on success, or an error code < 0 on failure. The contents of
`buf` is undefined after an error.
`buf` is undefined after an error.
.. note::
When using the synchronous version, both `loop` and `req` parameters
7 changes: 4 additions & 3 deletions deps/uv/docs/src/pipe.rst
Original file line number Diff line number Diff line change
@@ -4,8 +4,8 @@
:c:type:`uv_pipe_t` --- Pipe handle
===================================

Pipe handles provide an abstraction over local domain sockets on Unix and named
pipes on Windows.
Pipe handles provide an abstraction over streaming files on Unix (including
local domain sockets, pipes, and FIFOs) and named pipes on Windows.

:c:type:`uv_pipe_t` is a 'subclass' of :c:type:`uv_stream_t`.

@@ -34,7 +34,8 @@ API
.. c:function:: int uv_pipe_init(uv_loop_t* loop, uv_pipe_t* handle, int ipc)
Initialize a pipe handle. The `ipc` argument is a boolean to indicate if
this pipe will be used for handle passing between processes.
this pipe will be used for handle passing between processes (which may
change the bytes on the wire).
.. c:function:: int uv_pipe_open(uv_pipe_t* handle, uv_file file)
2 changes: 1 addition & 1 deletion deps/uv/docs/src/sphinx-plugins/manpage.py
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@
def make_link_node(rawtext, app, name, manpage_num, options):
ref = app.config.man_url_regex
if not ref:
ref = "http://linux.die.net/man/%s/%s" % (manpage_num, name)
ref = "http://man7.org/linux/man-pages/man%s/%s.%s.html" %(manpage_num, name, manpage_num)
else:
s = Template(ref)
ref = s.substitute(num=manpage_num, topic=name)
2 changes: 1 addition & 1 deletion deps/uv/docs/src/version.rst
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ a major release. In this section you'll find all macros and functions that
will allow you to write or compile code conditionally, in order to work with
multiple libuv versions.

.. _semantic versioning: http://semver.org
.. _semantic versioning: https://semver.org


Macros
2 changes: 1 addition & 1 deletion deps/uv/include/uv/version.h
Original file line number Diff line number Diff line change
@@ -32,7 +32,7 @@

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

22 changes: 0 additions & 22 deletions deps/uv/samples/.gitignore

This file was deleted.

21 changes: 0 additions & 21 deletions deps/uv/samples/socks5-proxy/.gitignore

This file was deleted.

53 changes: 0 additions & 53 deletions deps/uv/samples/socks5-proxy/LICENSE

This file was deleted.

46 changes: 0 additions & 46 deletions deps/uv/samples/socks5-proxy/build.gyp

This file was deleted.

736 changes: 0 additions & 736 deletions deps/uv/samples/socks5-proxy/client.c

This file was deleted.

139 changes: 0 additions & 139 deletions deps/uv/samples/socks5-proxy/defs.h

This file was deleted.

131 changes: 0 additions & 131 deletions deps/uv/samples/socks5-proxy/getopt.c

This file was deleted.

99 changes: 0 additions & 99 deletions deps/uv/samples/socks5-proxy/main.c

This file was deleted.

271 changes: 0 additions & 271 deletions deps/uv/samples/socks5-proxy/s5.c

This file was deleted.

94 changes: 0 additions & 94 deletions deps/uv/samples/socks5-proxy/s5.h

This file was deleted.

241 changes: 0 additions & 241 deletions deps/uv/samples/socks5-proxy/server.c

This file was deleted.

72 changes: 0 additions & 72 deletions deps/uv/samples/socks5-proxy/util.c

This file was deleted.

130 changes: 68 additions & 62 deletions deps/uv/src/unix/darwin-proctitle.c
Original file line number Diff line number Diff line change
@@ -34,52 +34,53 @@
# include <ApplicationServices/ApplicationServices.h>
#endif

#define S(s) pCFStringCreateWithCString(NULL, (s), kCFStringEncodingUTF8)

static int uv__pthread_setname_np(const char* name) {
char namebuf[64]; /* MAXTHREADNAMESIZE */
int err;

#if !TARGET_OS_IPHONE
static CFStringRef (*pCFStringCreateWithCString)(CFAllocatorRef,
const char*,
CFStringEncoding);
static CFBundleRef (*pCFBundleGetBundleWithIdentifier)(CFStringRef);
static void *(*pCFBundleGetDataPointerForName)(CFBundleRef, CFStringRef);
static void *(*pCFBundleGetFunctionPointerForName)(CFBundleRef, CFStringRef);
static CFTypeRef (*pLSGetCurrentApplicationASN)(void);
static OSStatus (*pLSSetApplicationInformationItem)(int,
CFTypeRef,
CFStringRef,
CFStringRef,
CFDictionaryRef*);
static void* application_services_handle;
static void* core_foundation_handle;
static CFBundleRef launch_services_bundle;
static CFStringRef* display_name_key;
static CFDictionaryRef (*pCFBundleGetInfoDictionary)(CFBundleRef);
static CFBundleRef (*pCFBundleGetMainBundle)(void);
static CFBundleRef hi_services_bundle;
static CFDictionaryRef (*pLSApplicationCheckIn)(int, CFDictionaryRef);
static void (*pLSSetApplicationLaunchServicesServerConnectionStatus)(uint64_t,
void*);


UV_DESTRUCTOR(static void uv__set_process_title_platform_fini(void)) {
if (core_foundation_handle != NULL) {
dlclose(core_foundation_handle);
core_foundation_handle = NULL;
}
strncpy(namebuf, name, sizeof(namebuf) - 1);
namebuf[sizeof(namebuf) - 1] = '\0';

if (application_services_handle != NULL) {
dlclose(application_services_handle);
application_services_handle = NULL;
}
err = pthread_setname_np(namebuf);
if (err)
return UV__ERR(err);

return 0;
}
#endif /* !TARGET_OS_IPHONE */


void uv__set_process_title_platform_init(void) {
#if !TARGET_OS_IPHONE
int uv__set_process_title(const char* title) {
#if TARGET_OS_IPHONE
return uv__pthread_setname_np(title);
#else
CFStringRef (*pCFStringCreateWithCString)(CFAllocatorRef,
const char*,
CFStringEncoding);
CFBundleRef (*pCFBundleGetBundleWithIdentifier)(CFStringRef);
void *(*pCFBundleGetDataPointerForName)(CFBundleRef, CFStringRef);
void *(*pCFBundleGetFunctionPointerForName)(CFBundleRef, CFStringRef);
CFTypeRef (*pLSGetCurrentApplicationASN)(void);
OSStatus (*pLSSetApplicationInformationItem)(int,
CFTypeRef,
CFStringRef,
CFStringRef,
CFDictionaryRef*);
void* application_services_handle;
void* core_foundation_handle;
CFBundleRef launch_services_bundle;
CFStringRef* display_name_key;
CFDictionaryRef (*pCFBundleGetInfoDictionary)(CFBundleRef);
CFBundleRef (*pCFBundleGetMainBundle)(void);
CFBundleRef hi_services_bundle;
OSStatus (*pSetApplicationIsDaemon)(int);
CFDictionaryRef (*pLSApplicationCheckIn)(int, CFDictionaryRef);
void (*pLSSetApplicationLaunchServicesServerConnectionStatus)(uint64_t,
void*);
CFTypeRef asn;
int err;

err = UV_ENOENT;
application_services_handle = dlopen("/System/Library/Frameworks/"
"ApplicationServices.framework/"
"Versions/A/ApplicationServices",
@@ -108,6 +109,8 @@ void uv__set_process_title_platform_init(void) {
goto out;
}

#define S(s) pCFStringCreateWithCString(NULL, (s), kCFStringEncodingUTF8)

launch_services_bundle =
pCFBundleGetBundleWithIdentifier(S("com.apple.LaunchServices"));

@@ -138,14 +141,13 @@ void uv__set_process_title_platform_init(void) {
"CFBundleGetInfoDictionary");
*(void **)(&pCFBundleGetMainBundle) = dlsym(core_foundation_handle,
"CFBundleGetMainBundle");

if (pCFBundleGetInfoDictionary == NULL || pCFBundleGetMainBundle == NULL)
goto out;

/* Black 10.9 magic, to remove (Not responding) mark in Activity Monitor */
hi_services_bundle =
pCFBundleGetBundleWithIdentifier(S("com.apple.HIServices"));

err = UV_ENOENT;
if (hi_services_bundle == NULL)
goto out;

@@ -159,38 +161,42 @@ void uv__set_process_title_platform_init(void) {
pCFBundleGetFunctionPointerForName(
launch_services_bundle,
S("_LSSetApplicationLaunchServicesServerConnectionStatus"));

if (pSetApplicationIsDaemon == NULL ||
pLSApplicationCheckIn == NULL ||
pLSSetApplicationLaunchServicesServerConnectionStatus == NULL) {
goto out;
}

/* Prevent crash when LaunchServices cannot be connected to. */
pSetApplicationIsDaemon(1);
return;
if (pSetApplicationIsDaemon(1) != noErr)
goto out;

out:
uv__set_process_title_platform_fini();
#endif /* !TARGET_OS_IPHONE */
}
pLSSetApplicationLaunchServicesServerConnectionStatus(0, NULL);

/* Check into process manager?! */
pLSApplicationCheckIn(-2,
pCFBundleGetInfoDictionary(pCFBundleGetMainBundle()));

void uv__set_process_title(const char* title) {
char namebuf[64 /* MAXTHREADNAMESIZE */];
asn = pLSGetCurrentApplicationASN();

#if !TARGET_OS_IPHONE
if (core_foundation_handle != NULL) {
CFTypeRef asn;
pLSSetApplicationLaunchServicesServerConnectionStatus(0, NULL);
pLSApplicationCheckIn(/* Magic value */ -2,
pCFBundleGetInfoDictionary(pCFBundleGetMainBundle()));
asn = pLSGetCurrentApplicationASN();
pLSSetApplicationInformationItem(/* Magic value */ -2, asn,
*display_name_key, S(title), NULL);
err = UV_EINVAL;
if (pLSSetApplicationInformationItem(-2, /* Magic value. */
asn,
*display_name_key,
S(title),
NULL) != noErr) {
goto out;
}
#endif /* !TARGET_OS_IPHONE */

uv__strscpy(namebuf, title, sizeof(namebuf));
pthread_setname_np(namebuf);
uv__pthread_setname_np(title); /* Don't care if it fails. */
err = 0;

out:
if (core_foundation_handle != NULL)
dlclose(core_foundation_handle);

if (application_services_handle != NULL)
dlclose(application_services_handle);

return err;
#endif /* !TARGET_OS_IPHONE */
}
6 changes: 3 additions & 3 deletions deps/uv/src/unix/darwin.c
Original file line number Diff line number Diff line change
@@ -110,7 +110,7 @@ uint64_t uv_get_total_memory(void) {
int which[] = {CTL_HW, HW_MEMSIZE};
size_t size = sizeof(info);

if (sysctl(which, 2, &info, &size, NULL, 0))
if (sysctl(which, ARRAY_SIZE(which), &info, &size, NULL, 0))
return UV__ERR(errno);

return (uint64_t) info;
@@ -127,7 +127,7 @@ void uv_loadavg(double avg[3]) {
size_t size = sizeof(info);
int which[] = {CTL_VM, VM_LOADAVG};

if (sysctl(which, 2, &info, &size, NULL, 0) < 0) return;
if (sysctl(which, ARRAY_SIZE(which), &info, &size, NULL, 0) < 0) return;

avg[0] = (double) info.ldavg[0] / info.fscale;
avg[1] = (double) info.ldavg[1] / info.fscale;
@@ -162,7 +162,7 @@ int uv_uptime(double* uptime) {
size_t size = sizeof(info);
static int which[] = {CTL_KERN, KERN_BOOTTIME};

if (sysctl(which, 2, &info, &size, NULL, 0))
if (sysctl(which, ARRAY_SIZE(which), &info, &size, NULL, 0))
return UV__ERR(errno);

now = time(NULL);
8 changes: 4 additions & 4 deletions deps/uv/src/unix/freebsd.c
Original file line number Diff line number Diff line change
@@ -95,7 +95,7 @@ int uv_exepath(char* buffer, size_t* size) {
mib[3] = -1;

abspath_size = sizeof abspath;
if (sysctl(mib, 4, abspath, &abspath_size, NULL, 0))
if (sysctl(mib, ARRAY_SIZE(mib), abspath, &abspath_size, NULL, 0))
return UV__ERR(errno);

assert(abspath_size > 0);
@@ -130,7 +130,7 @@ uint64_t uv_get_total_memory(void) {

size_t size = sizeof(info);

if (sysctl(which, 2, &info, &size, NULL, 0))
if (sysctl(which, ARRAY_SIZE(which), &info, &size, NULL, 0))
return UV__ERR(errno);

return (uint64_t) info;
@@ -147,7 +147,7 @@ void uv_loadavg(double avg[3]) {
size_t size = sizeof(info);
int which[] = {CTL_VM, VM_LOADAVG};

if (sysctl(which, 2, &info, &size, NULL, 0) < 0) return;
if (sysctl(which, ARRAY_SIZE(which), &info, &size, NULL, 0) < 0) return;

avg[0] = (double) info.ldavg[0] / info.fscale;
avg[1] = (double) info.ldavg[1] / info.fscale;
@@ -168,7 +168,7 @@ int uv_resident_set_memory(size_t* rss) {

kinfo_size = sizeof(kinfo);

if (sysctl(mib, 4, &kinfo, &kinfo_size, NULL, 0))
if (sysctl(mib, ARRAY_SIZE(mib), &kinfo, &kinfo_size, NULL, 0))
return UV__ERR(errno);

page_size = getpagesize();
75 changes: 54 additions & 21 deletions deps/uv/src/unix/fs.c
Original file line number Diff line number Diff line change
@@ -259,10 +259,29 @@ static ssize_t uv__fs_mkdtemp(uv_fs_t* req) {
}


static int (*uv__mkostemp)(char*, int);


static void uv__mkostemp_initonce(void) {
/* z/os doesn't have RTLD_DEFAULT but that's okay
* because it doesn't have mkostemp(O_CLOEXEC) either.
*/
#ifdef RTLD_DEFAULT
uv__mkostemp = (int (*)(char*, int)) dlsym(RTLD_DEFAULT, "mkostemp");

/* We don't care about errors, but we do want to clean them up.
* If there has been no error, then dlerror() will just return
* NULL.
*/
dlerror();
#endif /* RTLD_DEFAULT */
}


static int uv__fs_mkstemp(uv_fs_t* req) {
static uv_once_t once = UV_ONCE_INIT;
int r;
#ifdef O_CLOEXEC
int (*mkostemp_function)(char*, int);
static int no_cloexec_support;
#endif
static const char pattern[] = "XXXXXX";
@@ -284,30 +303,23 @@ static int uv__fs_mkstemp(uv_fs_t* req) {
return -1;
}

#ifdef O_CLOEXEC
if (no_cloexec_support == 0) {
*(int**)(&mkostemp_function) = dlsym(RTLD_DEFAULT, "mkostemp");

/* We don't care about errors, but we do want to clean them up.
If there has been no error, then dlerror() will just return
NULL. */
dlerror();
uv_once(&once, uv__mkostemp_initonce);

if (mkostemp_function != NULL) {
r = mkostemp_function(path, O_CLOEXEC);
#ifdef O_CLOEXEC
if (no_cloexec_support == 0 && uv__mkostemp != NULL) {
r = uv__mkostemp(path, O_CLOEXEC);

if (r >= 0)
return r;
if (r >= 0)
return r;

/* If mkostemp() returns EINVAL, it means the kernel doesn't
support O_CLOEXEC, so we just fallback to mkstemp() below. */
if (errno != EINVAL)
return r;
/* If mkostemp() returns EINVAL, it means the kernel doesn't
support O_CLOEXEC, so we just fallback to mkstemp() below. */
if (errno != EINVAL)
return r;

/* We set the static variable so that next calls don't even
try to use mkostemp. */
no_cloexec_support = 1;
}
/* We set the static variable so that next calls don't even
try to use mkostemp. */
no_cloexec_support = 1;
}
#endif /* O_CLOEXEC */

@@ -1125,7 +1137,28 @@ static ssize_t uv__fs_copyfile(uv_fs_t* req) {

if (fchmod(dstfd, src_statsbuf.st_mode) == -1) {
err = UV__ERR(errno);
#ifdef __linux__
if (err != UV_EPERM)
goto out;

{
struct statfs s;

/* fchmod() on CIFS shares always fails with EPERM unless the share is
* mounted with "noperm". As fchmod() is a meaningless operation on such
* shares anyway, detect that condition and squelch the error.
*/
if (fstatfs(dstfd, &s) == -1)
goto out;

if (s.f_type != /* CIFS */ 0xFF534D42u)
goto out;
}

err = 0;
#else /* !__linux__ */
goto out;
#endif /* !__linux__ */
}

#ifdef FICLONE
16 changes: 13 additions & 3 deletions deps/uv/src/unix/linux-core.c
Original file line number Diff line number Diff line change
@@ -359,9 +359,19 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
have_signals = 0;
nevents = 0;

assert(loop->watchers != NULL);
loop->watchers[loop->nwatchers] = (void*) events;
loop->watchers[loop->nwatchers + 1] = (void*) (uintptr_t) nfds;
{
/* Squelch a -Waddress-of-packed-member warning with gcc >= 9. */
union {
struct epoll_event* events;
uv__io_t* watchers;
} x;

x.events = events;
assert(loop->watchers != NULL);
loop->watchers[loop->nwatchers] = x.watchers;
loop->watchers[loop->nwatchers + 1] = (void*) (uintptr_t) nfds;
}

for (i = 0; i < nfds; i++) {
pe = events + i;
fd = pe->data.fd;
8 changes: 4 additions & 4 deletions deps/uv/src/unix/netbsd.c
Original file line number Diff line number Diff line change
@@ -55,7 +55,7 @@ void uv_loadavg(double avg[3]) {
size_t size = sizeof(info);
int which[] = {CTL_VM, VM_LOADAVG};

if (sysctl(which, 2, &info, &size, NULL, 0) == -1) return;
if (sysctl(which, ARRAY_SIZE(which), &info, &size, NULL, 0) == -1) return;

avg[0] = (double) info.ldavg[0] / info.fscale;
avg[1] = (double) info.ldavg[1] / info.fscale;
@@ -102,7 +102,7 @@ uint64_t uv_get_free_memory(void) {
size_t size = sizeof(info);
int which[] = {CTL_VM, VM_UVMEXP};

if (sysctl(which, 2, &info, &size, NULL, 0))
if (sysctl(which, ARRAY_SIZE(which), &info, &size, NULL, 0))
return UV__ERR(errno);

return (uint64_t) info.free * sysconf(_SC_PAGESIZE);
@@ -119,7 +119,7 @@ uint64_t uv_get_total_memory(void) {
#endif
size_t size = sizeof(info);

if (sysctl(which, 2, &info, &size, NULL, 0))
if (sysctl(which, ARRAY_SIZE(which), &info, &size, NULL, 0))
return UV__ERR(errno);

return (uint64_t) info;
@@ -167,7 +167,7 @@ int uv_uptime(double* uptime) {
size_t size = sizeof(info);
static int which[] = {CTL_KERN, KERN_BOOTTIME};

if (sysctl(which, 2, &info, &size, NULL, 0))
if (sysctl(which, ARRAY_SIZE(which), &info, &size, NULL, 0))
return UV__ERR(errno);

now = time(NULL);
30 changes: 15 additions & 15 deletions deps/uv/src/unix/openbsd.c
Original file line number Diff line number Diff line change
@@ -50,7 +50,7 @@ void uv_loadavg(double avg[3]) {
size_t size = sizeof(info);
int which[] = {CTL_VM, VM_LOADAVG};

if (sysctl(which, 2, &info, &size, NULL, 0) < 0) return;
if (sysctl(which, ARRAY_SIZE(which), &info, &size, NULL, 0) < 0) return;

avg[0] = (double) info.ldavg[0] / info.fscale;
avg[1] = (double) info.ldavg[1] / info.fscale;
@@ -81,7 +81,7 @@ int uv_exepath(char* buffer, size_t* size) {
mib[1] = KERN_PROC_ARGS;
mib[2] = mypid;
mib[3] = KERN_PROC_ARGV;
if (sysctl(mib, 4, argsbuf, &argsbuf_size, NULL, 0) == 0) {
if (sysctl(mib, ARRAY_SIZE(mib), argsbuf, &argsbuf_size, NULL, 0) == 0) {
break;
}
if (errno != ENOMEM) {
@@ -117,7 +117,7 @@ uint64_t uv_get_free_memory(void) {
size_t size = sizeof(info);
int which[] = {CTL_VM, VM_UVMEXP};

if (sysctl(which, 2, &info, &size, NULL, 0))
if (sysctl(which, ARRAY_SIZE(which), &info, &size, NULL, 0))
return UV__ERR(errno);

return (uint64_t) info.free * sysconf(_SC_PAGESIZE);
@@ -129,7 +129,7 @@ uint64_t uv_get_total_memory(void) {
int which[] = {CTL_HW, HW_PHYSMEM64};
size_t size = sizeof(info);

if (sysctl(which, 2, &info, &size, NULL, 0))
if (sysctl(which, ARRAY_SIZE(which), &info, &size, NULL, 0))
return UV__ERR(errno);

return (uint64_t) info;
@@ -154,7 +154,7 @@ int uv_resident_set_memory(size_t* rss) {
mib[4] = sizeof(struct kinfo_proc);
mib[5] = 1;

if (sysctl(mib, 6, &kinfo, &size, NULL, 0) < 0)
if (sysctl(mib, ARRAY_SIZE(mib), &kinfo, &size, NULL, 0) < 0)
return UV__ERR(errno);

*rss = kinfo.p_vm_rssize * page_size;
@@ -168,7 +168,7 @@ int uv_uptime(double* uptime) {
size_t size = sizeof(info);
static int which[] = {CTL_KERN, KERN_BOOTTIME};

if (sysctl(which, 2, &info, &size, NULL, 0))
if (sysctl(which, ARRAY_SIZE(which), &info, &size, NULL, 0))
return UV__ERR(errno);

now = time(NULL);
@@ -184,18 +184,19 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
uint64_t info[CPUSTATES];
char model[512];
int numcpus = 1;
int which[] = {CTL_HW,HW_MODEL,0};
int which[] = {CTL_HW,HW_MODEL};
int percpu[] = {CTL_HW,HW_CPUSPEED,0};
size_t size;
int i, j;
uv_cpu_info_t* cpu_info;

size = sizeof(model);
if (sysctl(which, 2, &model, &size, NULL, 0))
if (sysctl(which, ARRAY_SIZE(which), &model, &size, NULL, 0))
return UV__ERR(errno);

which[1] = HW_NCPUONLINE;
size = sizeof(numcpus);
if (sysctl(which, 2, &numcpus, &size, NULL, 0))
if (sysctl(which, ARRAY_SIZE(which), &numcpus, &size, NULL, 0))
return UV__ERR(errno);

*cpu_infos = uv__malloc(numcpus * sizeof(**cpu_infos));
@@ -205,18 +206,17 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
i = 0;
*count = numcpus;

which[1] = HW_CPUSPEED;
size = sizeof(cpuspeed);
if (sysctl(which, 2, &cpuspeed, &size, NULL, 0))
if (sysctl(which, ARRAY_SIZE(percpu), &cpuspeed, &size, NULL, 0))
goto error;

size = sizeof(info);
which[0] = CTL_KERN;
which[1] = KERN_CPTIME2;
percpu[0] = CTL_KERN;
percpu[1] = KERN_CPTIME2;
for (i = 0; i < numcpus; i++) {
which[2] = i;
percpu[2] = i;
size = sizeof(info);
if (sysctl(which, 3, &info, &size, NULL, 0))
if (sysctl(which, ARRAY_SIZE(percpu), &info, &size, NULL, 0))
goto error;

cpu_info = &(*cpu_infos)[i];
4 changes: 0 additions & 4 deletions deps/uv/src/unix/proctitle.c
Original file line number Diff line number Diff line change
@@ -24,7 +24,6 @@
#include <stdlib.h>
#include <string.h>

extern void uv__set_process_title_platform_init(void);
extern void uv__set_process_title(const char* title);

static uv_mutex_t process_title_mutex;
@@ -39,9 +38,6 @@ static struct {

static void init_process_title_mutex_once(void) {
uv_mutex_init(&process_title_mutex);
#ifdef __APPLE__
uv__set_process_title_platform_init();
#endif
}


1 change: 1 addition & 0 deletions deps/uv/src/unix/signal.c
Original file line number Diff line number Diff line change
@@ -565,6 +565,7 @@ static void uv__signal_stop(uv_signal_t* handle) {
if (first_oneshot && !rem_oneshot) {
ret = uv__signal_register_handler(handle->signum, 1);
assert(ret == 0);
(void)ret;
}
}

7 changes: 6 additions & 1 deletion deps/uv/src/unix/stream.c
Original file line number Diff line number Diff line change
@@ -1048,7 +1048,12 @@ static int uv__stream_queue_fd(uv_stream_t* stream, int fd) {
}


#define UV__CMSG_FD_COUNT 64
#if defined(__PASE__)
/* on IBMi PASE the control message length can not exceed 256. */
# define UV__CMSG_FD_COUNT 60
#else
# define UV__CMSG_FD_COUNT 64
#endif
#define UV__CMSG_FD_SIZE (UV__CMSG_FD_COUNT * sizeof(int))


9 changes: 8 additions & 1 deletion deps/uv/src/unix/tty.c
Original file line number Diff line number Diff line change
@@ -139,7 +139,7 @@ int uv_tty_init(uv_loop_t* loop, uv_tty_t* tty, int fd, int unused) {
* slave device.
*/
if (uv__tty_is_slave(fd) && ttyname_r(fd, path, sizeof(path)) == 0)
r = uv__open_cloexec(path, mode);
r = uv__open_cloexec(path, mode | O_NOCTTY);
else
r = -1;

@@ -293,7 +293,14 @@ uv_handle_type uv_guess_handle(uv_file file) {
if (file < 0)
return UV_UNKNOWN_HANDLE;

#if defined(__PASE__)
/* On IBMi PASE isatty() always returns true for stdin, stdout and stderr.
* Use ioctl() instead to identify whether it's actually a TTY.
*/
if (!ioctl(file, TXISATTY + 0x81, NULL) || errno != ENOTTY)
#else
if (isatty(file))
#endif
return UV_TTY;

if (fstat(file, &s))
9 changes: 7 additions & 2 deletions deps/uv/src/win/core.c
Original file line number Diff line number Diff line change
@@ -321,8 +321,13 @@ void uv__loop_close(uv_loop_t* loop) {

uv__loops_remove(loop);

/* close the async handle without needing an extra loop iteration */
assert(!loop->wq_async.async_sent);
/* Close the async handle without needing an extra loop iteration.
* We might have a pending message, but we're just going to destroy the IOCP
* soon, so we can just discard it now without the usual risk of a getting
* another notification from GetQueuedCompletionStatusEx after calling the
* close_cb (which we also skip defining). We'll assert later that queue was
* actually empty and all reqs handled. */
loop->wq_async.async_sent = 0;
loop->wq_async.close_cb = NULL;
uv__handle_closing(&loop->wq_async);
uv__handle_close(&loop->wq_async);
70 changes: 12 additions & 58 deletions deps/uv/src/win/tty.c
Original file line number Diff line number Diff line change
@@ -1625,28 +1625,16 @@ static int uv_tty_write_bufs(uv_tty_t* handle,
/* We can only write 8k characters at a time. Windows can't handle much more
* characters in a single console write anyway. */
WCHAR utf16_buf[MAX_CONSOLE_CHAR];
WCHAR* utf16_buffer;
DWORD utf16_buf_used = 0;
unsigned int i, len, max_len, pos;
int allocate = 0;

#define FLUSH_TEXT() \
do { \
pos = 0; \
do { \
len = utf16_buf_used - pos; \
if (len > MAX_CONSOLE_CHAR) \
len = MAX_CONSOLE_CHAR; \
uv_tty_emit_text(handle, &utf16_buffer[pos], len, error); \
pos += len; \
} while (pos < utf16_buf_used); \
if (allocate) { \
uv__free(utf16_buffer); \
allocate = 0; \
utf16_buffer = utf16_buf; \
} \
utf16_buf_used = 0; \
} while (0)
unsigned int i;

#define FLUSH_TEXT() \
do { \
if (utf16_buf_used > 0) { \
uv_tty_emit_text(handle, utf16_buf, utf16_buf_used, error); \
utf16_buf_used = 0; \
} \
} while (0)

#define ENSURE_BUFFER_SPACE(wchars_needed) \
if (wchars_needed > ARRAY_SIZE(utf16_buf) - utf16_buf_used) { \
@@ -1663,48 +1651,12 @@ static int uv_tty_write_bufs(uv_tty_t* handle,
* keep parsing the buffer so we leave the parser in a consistent state. */
*error = ERROR_SUCCESS;

utf16_buffer = utf16_buf;

uv_sem_wait(&uv_tty_output_lock);

for (i = 0; i < nbufs; i++) {
uv_buf_t buf = bufs[i];
unsigned int j;

if (uv__vterm_state == UV_TTY_SUPPORTED && buf.len > 0) {
utf16_buf_used = MultiByteToWideChar(CP_UTF8,
0,
buf.base,
buf.len,
NULL,
0);

if (utf16_buf_used == 0) {
*error = GetLastError();
break;
}

max_len = (utf16_buf_used + 1) * sizeof(WCHAR);
allocate = max_len > MAX_CONSOLE_CHAR;
if (allocate)
utf16_buffer = uv__malloc(max_len);
if (!MultiByteToWideChar(CP_UTF8,
0,
buf.base,
buf.len,
utf16_buffer,
utf16_buf_used)) {
if (allocate)
uv__free(utf16_buffer);
*error = GetLastError();
break;
}

FLUSH_TEXT();

continue;
}

for (j = 0; j < buf.len; j++) {
unsigned char c = buf.base[j];

@@ -1761,7 +1713,9 @@ static int uv_tty_write_bufs(uv_tty_t* handle,
}

/* Parse vt100/ansi escape codes */
if (ansi_parser_state == ANSI_NORMAL) {
if (uv__vterm_state == UV_TTY_SUPPORTED) {
/* Pass through escape codes if conhost supports them. */
} else if (ansi_parser_state == ANSI_NORMAL) {
switch (utf8_codepoint) {
case '\033':
ansi_parser_state = ANSI_ESCAPE_SEEN;
47 changes: 14 additions & 33 deletions deps/uv/src/win/winsock.c
Original file line number Diff line number Diff line change
@@ -74,11 +74,6 @@ BOOL uv_get_connectex_function(SOCKET socket, LPFN_CONNECTEX* target) {
}


static int error_means_no_support(DWORD error) {
return error == WSAEPROTONOSUPPORT || error == WSAESOCKTNOSUPPORT ||
error == WSAEPFNOSUPPORT || error == WSAEAFNOSUPPORT;
}


void uv_winsock_init(void) {
WSADATA wsa_data;
@@ -105,50 +100,36 @@ void uv_winsock_init(void) {
uv_fatal_error(errorno, "WSAStartup");
}

/* Detect non-IFS LSPs */
/* Try to detect non-IFS LSPs */
uv_tcp_non_ifs_lsp_ipv4 = 1;
dummy = socket(AF_INET, SOCK_STREAM, IPPROTO_IP);

if (dummy != INVALID_SOCKET) {
opt_len = (int) sizeof protocol_info;
if (getsockopt(dummy,
SOL_SOCKET,
SO_PROTOCOL_INFOW,
(char*) &protocol_info,
&opt_len) == SOCKET_ERROR)
uv_fatal_error(WSAGetLastError(), "getsockopt");

if (!(protocol_info.dwServiceFlags1 & XP1_IFS_HANDLES))
uv_tcp_non_ifs_lsp_ipv4 = 1;

if (closesocket(dummy) == SOCKET_ERROR)
uv_fatal_error(WSAGetLastError(), "closesocket");

} else if (!error_means_no_support(WSAGetLastError())) {
/* Any error other than "socket type not supported" is fatal. */
uv_fatal_error(WSAGetLastError(), "socket");
&opt_len) == 0) {
if (protocol_info.dwServiceFlags1 & XP1_IFS_HANDLES)
uv_tcp_non_ifs_lsp_ipv4 = 0;
}
closesocket(dummy);
}

/* Detect IPV6 support and non-IFS LSPs */
/* Try to detect IPV6 support and non-IFS LSPs */
uv_tcp_non_ifs_lsp_ipv6 = 1;
dummy = socket(AF_INET6, SOCK_STREAM, IPPROTO_IP);

if (dummy != INVALID_SOCKET) {
opt_len = (int) sizeof protocol_info;
if (getsockopt(dummy,
SOL_SOCKET,
SO_PROTOCOL_INFOW,
(char*) &protocol_info,
&opt_len) == SOCKET_ERROR)
uv_fatal_error(WSAGetLastError(), "getsockopt");

if (!(protocol_info.dwServiceFlags1 & XP1_IFS_HANDLES))
uv_tcp_non_ifs_lsp_ipv6 = 1;

if (closesocket(dummy) == SOCKET_ERROR)
uv_fatal_error(WSAGetLastError(), "closesocket");

} else if (!error_means_no_support(WSAGetLastError())) {
/* Any error other than "socket type not supported" is fatal. */
uv_fatal_error(WSAGetLastError(), "socket");
&opt_len) == 0) {
if (protocol_info.dwServiceFlags1 & XP1_IFS_HANDLES)
uv_tcp_non_ifs_lsp_ipv6 = 0;
}
closesocket(dummy);
}
}

7 changes: 7 additions & 0 deletions deps/uv/test/run-tests.c
Original file line number Diff line number Diff line change
@@ -51,6 +51,13 @@ static int maybe_run_test(int argc, char **argv);


int main(int argc, char **argv) {
#ifndef _WIN32
if (0 == geteuid() && NULL == getenv("UV_RUN_AS_ROOT")) {
fprintf(stderr, "The libuv test suite cannot be run as root.\n");
return EXIT_FAILURE;
}
#endif

if (platform_init(argc, argv))
return EXIT_FAILURE;

2 changes: 1 addition & 1 deletion deps/uv/test/task.h
Original file line number Diff line number Diff line change
@@ -215,7 +215,7 @@ UNUSED static int can_ipv6(void) {
return supported;
}

#if defined(__CYGWIN__) || defined(__MSYS__)
#if defined(__CYGWIN__) || defined(__MSYS__) || defined(__PASE__)
# define NO_FS_EVENTS "Filesystem watching not supported on this platform."
#endif

4 changes: 4 additions & 0 deletions deps/uv/test/test-dlerror.c
Original file line number Diff line number Diff line change
@@ -42,13 +42,17 @@ TEST_IMPL(dlerror) {

msg = uv_dlerror(&lib);
ASSERT(msg != NULL);
#ifndef __OpenBSD__
ASSERT(strstr(msg, path) != NULL);
#endif
ASSERT(strstr(msg, dlerror_no_error) == NULL);

/* Should return the same error twice in a row. */
msg = uv_dlerror(&lib);
ASSERT(msg != NULL);
#ifndef __OpenBSD__
ASSERT(strstr(msg, path) != NULL);
#endif
ASSERT(strstr(msg, dlerror_no_error) == NULL);

uv_dlclose(&lib);
40 changes: 25 additions & 15 deletions deps/uv/test/test-fs.c
Original file line number Diff line number Diff line change
@@ -343,7 +343,8 @@ static void statfs_cb(uv_fs_t* req) {
ASSERT(req->ptr != NULL);
stats = req->ptr;

#if defined(_WIN32) || defined(__sun) || defined(_AIX) || defined(__MVS__)
#if defined(_WIN32) || defined(__sun) || defined(_AIX) || defined(__MVS__) || \
defined(__OpenBSD__) || defined(__NetBSD__)
ASSERT(stats->f_type == 0);
#else
ASSERT(stats->f_type > 0);
@@ -1322,6 +1323,25 @@ TEST_IMPL(fs_fstat) {
file = req.result;
uv_fs_req_cleanup(&req);

#ifndef _WIN32
ASSERT(0 == fstat(file, &t));
ASSERT(0 == uv_fs_fstat(NULL, &req, file, NULL));
ASSERT(req.result == 0);
s = req.ptr;
# if defined(__APPLE__)
ASSERT(s->st_birthtim.tv_sec == t.st_birthtimespec.tv_sec);
ASSERT(s->st_birthtim.tv_nsec == t.st_birthtimespec.tv_nsec);
# elif defined(__linux__)
/* If statx() is supported, the birth time should be equal to the change time
* because we just created the file. On older kernels, it's set to zero.
*/
ASSERT(s->st_birthtim.tv_sec == 0 ||
s->st_birthtim.tv_sec == t.st_ctim.tv_sec);
ASSERT(s->st_birthtim.tv_nsec == 0 ||
s->st_birthtim.tv_nsec == t.st_ctim.tv_nsec);
# endif
#endif

iov = uv_buf_init(test_buf, sizeof(test_buf));
r = uv_fs_write(NULL, &req, file, &iov, 1, -1, NULL);
ASSERT(r == sizeof(test_buf));
@@ -1356,10 +1376,6 @@ TEST_IMPL(fs_fstat) {
ASSERT(s->st_mtim.tv_nsec == t.st_mtimespec.tv_nsec);
ASSERT(s->st_ctim.tv_sec == t.st_ctimespec.tv_sec);
ASSERT(s->st_ctim.tv_nsec == t.st_ctimespec.tv_nsec);
ASSERT(s->st_birthtim.tv_sec == t.st_birthtimespec.tv_sec);
ASSERT(s->st_birthtim.tv_nsec == t.st_birthtimespec.tv_nsec);
ASSERT(s->st_flags == t.st_flags);
ASSERT(s->st_gen == t.st_gen);
#elif defined(_AIX)
ASSERT(s->st_atim.tv_sec == t.st_atime);
ASSERT(s->st_atim.tv_nsec == 0);
@@ -1394,8 +1410,6 @@ TEST_IMPL(fs_fstat) {
defined(__NetBSD__)
ASSERT(s->st_birthtim.tv_sec == t.st_birthtim.tv_sec);
ASSERT(s->st_birthtim.tv_nsec == t.st_birthtim.tv_nsec);
ASSERT(s->st_flags == t.st_flags);
ASSERT(s->st_gen == t.st_gen);
# endif
#else
ASSERT(s->st_atim.tv_sec == t.st_atime);
@@ -1407,14 +1421,10 @@ TEST_IMPL(fs_fstat) {
#endif
#endif

#if defined(__linux__)
/* If statx() is supported, the birth time should be equal to the change time
* because we just created the file. On older kernels, it's set to zero.
*/
ASSERT(s->st_birthtim.tv_sec == 0 ||
s->st_birthtim.tv_sec == t.st_ctim.tv_sec);
ASSERT(s->st_birthtim.tv_nsec == 0 ||
s->st_birthtim.tv_nsec == t.st_ctim.tv_nsec);
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__)
ASSERT(s->st_flags == t.st_flags);
ASSERT(s->st_gen == t.st_gen);
#else
ASSERT(s->st_flags == 0);
ASSERT(s->st_gen == 0);
#endif
4 changes: 4 additions & 0 deletions deps/uv/test/test-platform-output.c
Original file line number Diff line number Diff line change
@@ -58,9 +58,13 @@ TEST_IMPL(platform_output) {
#endif

err = uv_uptime(&uptime);
#if defined(__PASE__)
ASSERT(err == UV_ENOSYS);
#else
ASSERT(err == 0);
ASSERT(uptime > 0);
printf("uv_uptime: %f\n", uptime);
#endif

err = uv_getrusage(&rusage);
ASSERT(err == 0);
6 changes: 2 additions & 4 deletions deps/uv/test/test-poll-close-doesnt-corrupt-stack.c
Original file line number Diff line number Diff line change
@@ -31,11 +31,9 @@
# define NO_INLINE __attribute__ ((noinline))
#endif


uv_os_sock_t sock;
uv_poll_t handle;

#ifdef _WIN32
static uv_os_sock_t sock;
static uv_poll_t handle;
static int close_cb_called = 0;


5 changes: 2 additions & 3 deletions deps/uv/test/test-poll-closesocket.c
Original file line number Diff line number Diff line change
@@ -25,10 +25,9 @@
#include "uv.h"
#include "task.h"

uv_os_sock_t sock;
uv_poll_t handle;

#ifdef _WIN32
static uv_os_sock_t sock;
static uv_poll_t handle;
static int close_cb_called = 0;


8 changes: 6 additions & 2 deletions deps/uv/test/test-process-title-threadsafe.c
Original file line number Diff line number Diff line change
@@ -25,7 +25,11 @@

#include <string.h>

#define NUM_ITERATIONS 50
#ifdef __APPLE__
# define NUM_ITERATIONS 5
#else
# define NUM_ITERATIONS 50
#endif

static const char* titles[] = {
"8L2NY0Kdj0XyNFZnmUZigIOfcWjyNr0SkMmUhKw99VLUsZFrvCQQC3XIRfNR8pjyMjXObllled",
@@ -68,7 +72,7 @@ TEST_IMPL(process_title_threadsafe) {
int i;

#if defined(__sun) || defined(__CYGWIN__) || defined(__MSYS__) || \
defined(__MVS__)
defined(__MVS__) || defined(__PASE__)
RETURN_SKIP("uv_(get|set)_process_title is not implemented.");
#endif

3 changes: 2 additions & 1 deletion deps/uv/test/test-process-title.c
Original file line number Diff line number Diff line change
@@ -60,7 +60,8 @@ static void uv_get_process_title_edge_cases(void) {


TEST_IMPL(process_title) {
#if defined(__sun) || defined(__CYGWIN__) || defined(__MSYS__)
#if defined(__sun) || defined(__CYGWIN__) || defined(__MSYS__) || \
defined(__PASE__)
RETURN_SKIP("uv_(get|set)_process_title is not implemented.");
#endif

1 change: 1 addition & 0 deletions deps/uv/test/test-thread.c
Original file line number Diff line number Diff line change
@@ -232,6 +232,7 @@ static void thread_check_stack(void* arg) {
if (expected == 0)
expected = (size_t)lim.rlim_cur;
ASSERT(stack_size >= expected);
ASSERT(0 == pthread_attr_destroy(&attr));
#endif
}

2 changes: 2 additions & 0 deletions deps/uv/test/test-udp-multicast-join.c
Original file line number Diff line number Diff line change
@@ -126,8 +126,10 @@ static void cl_recv_cb(uv_udp_t* handle,
r = uv_udp_set_membership(&server, MULTICAST_ADDR, NULL, UV_LEAVE_GROUP);
ASSERT(r == 0);

#if !defined(__OpenBSD__) && !defined(__NetBSD__)
r = uv_udp_set_source_membership(&server, MULTICAST_ADDR, NULL, source_addr, UV_JOIN_GROUP);
ASSERT(r == 0);
#endif

r = do_send(&req_ss);
ASSERT(r == 0);
3 changes: 1 addition & 2 deletions deps/uv/uv.gyp
Original file line number Diff line number Diff line change
@@ -93,7 +93,7 @@
'-Wno-unused-parameter',
'-Wstrict-prototypes',
],
'OTHER_CFLAGS': [ '-g', '--std=gnu89', '-pedantic' ],
'OTHER_CFLAGS': [ '-g', '--std=gnu89' ],
},
'conditions': [
[ 'OS=="win"', {
@@ -217,7 +217,6 @@
'-fvisibility=hidden',
'-g',
'--std=gnu89',
'-pedantic',
'-Wall',
'-Wextra',
'-Wno-unused-parameter',

0 comments on commit c23e499

Please sign in to comment.