deps: update libuv to version 1.7.4
PR-URL: https://github.com/nodejs/node/pull/2817 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
parent
958a94e19d
commit
68dc69a382
5
deps/uv/AUTHORS
vendored
5
deps/uv/AUTHORS
vendored
@ -219,3 +219,8 @@ Zachary Hamm <zsh@imipolexg.org>
|
|||||||
Karl Skomski <karl@skomski.com>
|
Karl Skomski <karl@skomski.com>
|
||||||
Jeremy Whitlock <jwhitlock@apache.org>
|
Jeremy Whitlock <jwhitlock@apache.org>
|
||||||
Willem Thiart <himself@willemthiart.com>
|
Willem Thiart <himself@willemthiart.com>
|
||||||
|
Ben Trask <bentrask@comcast.net>
|
||||||
|
Jianghua Yang <jianghua.yjh@alibaba-inc.com>
|
||||||
|
Colin Snover <github.com@zetafleet.com>
|
||||||
|
Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
|
||||||
|
Eli Skeggs <skeggse@gmail.com>
|
||||||
|
2
deps/uv/CONTRIBUTING.md
vendored
2
deps/uv/CONTRIBUTING.md
vendored
@ -49,7 +49,7 @@ the [Google C/C++ style guide]. Some of the key points, as well as some
|
|||||||
additional guidelines, are enumerated below.
|
additional guidelines, are enumerated below.
|
||||||
|
|
||||||
* Code that is specific to unix-y platforms should be placed in `src/unix`, and
|
* Code that is specific to unix-y platforms should be placed in `src/unix`, and
|
||||||
declarations go into `src/uv-unix.h`.
|
declarations go into `include/uv-unix.h`.
|
||||||
|
|
||||||
* Source code that is Windows-specific goes into `src/win`, and related
|
* Source code that is Windows-specific goes into `src/win`, and related
|
||||||
publicly exported types, functions and macro declarations should generally
|
publicly exported types, functions and macro declarations should generally
|
||||||
|
31
deps/uv/ChangeLog
vendored
31
deps/uv/ChangeLog
vendored
@ -1,3 +1,34 @@
|
|||||||
|
2015.09.12, Version 1.7.4 (Stable), a7ad4f52189d89cfcba35f78bfc5ff3b1f4105c4
|
||||||
|
|
||||||
|
Changes since version 1.7.3:
|
||||||
|
|
||||||
|
* doc: uv_read_start and uv_read_cb clarifications (Ben Trask)
|
||||||
|
|
||||||
|
* freebsd: obtain true uptime through clock_gettime() (Jianghua Yang)
|
||||||
|
|
||||||
|
* win, tty: do not convert \r to \r\n (Colin Snover)
|
||||||
|
|
||||||
|
* build,gyp: add DragonFly to the list of OSes (Michael Neumann)
|
||||||
|
|
||||||
|
* fs: fix bug in sendfile for DragonFly (Michael Neumann)
|
||||||
|
|
||||||
|
* doc: add uv_dlsym() return type (Brian White)
|
||||||
|
|
||||||
|
* tests: fix fs tests run w/o full getdents support (Jeremy Whitlock)
|
||||||
|
|
||||||
|
* doc: fix typo (Devchandra Meetei Leishangthem)
|
||||||
|
|
||||||
|
* doc: fix uv-unix.h location (Sakthipriyan Vairamani)
|
||||||
|
|
||||||
|
* unix: fix error check when closing process pipe fd (Ben Noordhuis)
|
||||||
|
|
||||||
|
* test,freebsd: fix ipc_listen_xx_write tests (Santiago Gimeno)
|
||||||
|
|
||||||
|
* win: fix unsavory rwlock fallback implementation (Bert Belder)
|
||||||
|
|
||||||
|
* doc: clarify repeat timer behavior (Eli Skeggs)
|
||||||
|
|
||||||
|
|
||||||
2015.08.28, Version 1.7.3 (Stable), 93877b11c8b86e0a6befcda83a54555c1e36e4f0
|
2015.08.28, Version 1.7.3 (Stable), 93877b11c8b86e0a6befcda83a54555c1e36e4f0
|
||||||
|
|
||||||
Changes since version 1.7.2:
|
Changes since version 1.7.2:
|
||||||
|
2
deps/uv/appveyor.yml
vendored
2
deps/uv/appveyor.yml
vendored
@ -1,4 +1,4 @@
|
|||||||
version: v1.7.3.build{build}
|
version: v1.7.4.build{build}
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- cinst -y nsis
|
- cinst -y nsis
|
||||||
|
2
deps/uv/common.gypi
vendored
2
deps/uv/common.gypi
vendored
@ -129,7 +129,7 @@
|
|||||||
}]
|
}]
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
['OS in "freebsd linux openbsd solaris android"', {
|
['OS in "freebsd dragonflybsd linux openbsd solaris android"', {
|
||||||
'cflags': [ '-Wall' ],
|
'cflags': [ '-Wall' ],
|
||||||
'cflags_cc': [ '-fno-rtti', '-fno-exceptions' ],
|
'cflags_cc': [ '-fno-rtti', '-fno-exceptions' ],
|
||||||
'target_conditions': [
|
'target_conditions': [
|
||||||
|
2
deps/uv/configure.ac
vendored
2
deps/uv/configure.ac
vendored
@ -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.7.3], [https://github.com/libuv/libuv/issues])
|
AC_INIT([libuv], [1.7.4], [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])
|
||||||
|
2
deps/uv/docs/src/dll.rst
vendored
2
deps/uv/docs/src/dll.rst
vendored
@ -34,7 +34,7 @@ API
|
|||||||
|
|
||||||
Close the shared library.
|
Close the shared library.
|
||||||
|
|
||||||
.. c:function:: uv_dlsym(uv_lib_t* lib, const char* name, void** ptr)
|
.. c:function:: int uv_dlsym(uv_lib_t* lib, const char* name, void** ptr)
|
||||||
|
|
||||||
Retrieves a data pointer from a dynamic library. It is legal for a symbol
|
Retrieves a data pointer from a dynamic library. It is legal for a symbol
|
||||||
to map to NULL. Returns 0 on success and -1 if the symbol was not found.
|
to map to NULL. Returns 0 on success and -1 if the symbol was not found.
|
||||||
|
2
deps/uv/docs/src/request.rst
vendored
2
deps/uv/docs/src/request.rst
vendored
@ -25,7 +25,7 @@ Data types
|
|||||||
Public members
|
Public members
|
||||||
^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^
|
||||||
|
|
||||||
.. c:member:: void* uv_request_t.data
|
.. c:member:: void* uv_req_t.data
|
||||||
|
|
||||||
Space for user-defined arbitrary data. libuv does not use this field.
|
Space for user-defined arbitrary data. libuv does not use this field.
|
||||||
|
|
||||||
|
24
deps/uv/docs/src/stream.rst
vendored
24
deps/uv/docs/src/stream.rst
vendored
@ -32,8 +32,14 @@ Data types
|
|||||||
|
|
||||||
Callback called when data was read on a stream.
|
Callback called when data was read on a stream.
|
||||||
|
|
||||||
`nread` is > 0 if there is data available, 0 if libuv is done reading for
|
`nread` is > 0 if there is data available or < 0 on error. When we've
|
||||||
now, or < 0 on error.
|
reached EOF, `nread` will be set to ``UV_EOF``. When `nread` < 0,
|
||||||
|
the `buf` parameter might not point to a valid buffer; in that case
|
||||||
|
`buf.len` and `buf.base` are both set to 0.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
`nread` might be 0, which does *not* indicate an error or EOF. This
|
||||||
|
is equivalent to ``EAGAIN`` or ``EWOULDBLOCK`` under ``read(2)``.
|
||||||
|
|
||||||
The callee is responsible for stopping closing the stream when an error happens
|
The callee is responsible for stopping closing the stream when an error happens
|
||||||
by calling :c:func:`uv_read_stop` or :c:func:`uv_close`. Trying to read
|
by calling :c:func:`uv_read_stop` or :c:func:`uv_close`. Trying to read
|
||||||
@ -125,17 +131,9 @@ API
|
|||||||
|
|
||||||
.. c:function:: int uv_read_start(uv_stream_t* stream, uv_alloc_cb alloc_cb, uv_read_cb read_cb)
|
.. c:function:: int uv_read_start(uv_stream_t* stream, uv_alloc_cb alloc_cb, uv_read_cb read_cb)
|
||||||
|
|
||||||
Read data from an incoming stream. The callback will be made several
|
Read data from an incoming stream. The :c:type:`uv_read_cb` callback will
|
||||||
times until there is no more data to read or :c:func:`uv_read_stop` is called.
|
be made several times until there is no more data to read or
|
||||||
When we've reached EOF `nread` will be set to ``UV_EOF``.
|
:c:func:`uv_read_stop` is called.
|
||||||
|
|
||||||
When `nread` < 0, the `buf` parameter might not point to a valid buffer;
|
|
||||||
in that case `buf.len` and `buf.base` are both set to 0.
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
`nread` might also be 0, which does *not* indicate an error or EOF, it happens when
|
|
||||||
libuv requested a buffer through the alloc callback but then decided that it didn't
|
|
||||||
need that buffer.
|
|
||||||
|
|
||||||
.. c:function:: int uv_read_stop(uv_stream_t*)
|
.. c:function:: int uv_read_stop(uv_stream_t*)
|
||||||
|
|
||||||
|
10
deps/uv/docs/src/timer.rst
vendored
10
deps/uv/docs/src/timer.rst
vendored
@ -54,7 +54,15 @@ API
|
|||||||
|
|
||||||
.. c:function:: void uv_timer_set_repeat(uv_timer_t* handle, uint64_t repeat)
|
.. c:function:: void uv_timer_set_repeat(uv_timer_t* handle, uint64_t repeat)
|
||||||
|
|
||||||
Set the repeat value in milliseconds.
|
Set the repeat interval value in milliseconds. The timer will be scheduled
|
||||||
|
to run on the given interval, regardless of the callback execution
|
||||||
|
duration, and will follow normal timer semantics in the case of a
|
||||||
|
time-slice overrun.
|
||||||
|
|
||||||
|
For example, if a 50ms repeating timer first runs for 17ms, it will be
|
||||||
|
scheduled to run again 33ms later. If other tasks consume more than the
|
||||||
|
33ms following the first timer callback, then the callback will run as soon
|
||||||
|
as possible.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
If the repeat value is set from a timer callback it does not immediately take effect.
|
If the repeat value is set from a timer callback it does not immediately take effect.
|
||||||
|
2
deps/uv/include/uv-version.h
vendored
2
deps/uv/include/uv-version.h
vendored
@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
#define UV_VERSION_MAJOR 1
|
#define UV_VERSION_MAJOR 1
|
||||||
#define UV_VERSION_MINOR 7
|
#define UV_VERSION_MINOR 7
|
||||||
#define UV_VERSION_PATCH 3
|
#define UV_VERSION_PATCH 4
|
||||||
#define UV_VERSION_IS_RELEASE 1
|
#define UV_VERSION_IS_RELEASE 1
|
||||||
#define UV_VERSION_SUFFIX ""
|
#define UV_VERSION_SUFFIX ""
|
||||||
|
|
||||||
|
12
deps/uv/include/uv-win.h
vendored
12
deps/uv/include/uv-win.h
vendored
@ -250,8 +250,16 @@ typedef union {
|
|||||||
/* windows.h. */
|
/* windows.h. */
|
||||||
SRWLOCK srwlock_;
|
SRWLOCK srwlock_;
|
||||||
struct {
|
struct {
|
||||||
uv_mutex_t read_mutex_;
|
union {
|
||||||
uv_mutex_t write_mutex_;
|
CRITICAL_SECTION cs;
|
||||||
|
/* TODO: remove me in v2.x. */
|
||||||
|
uv_mutex_t unused;
|
||||||
|
} read_lock_;
|
||||||
|
union {
|
||||||
|
HANDLE sem;
|
||||||
|
/* TODO: remove me in v2.x. */
|
||||||
|
uv_mutex_t unused;
|
||||||
|
} write_lock_;
|
||||||
unsigned int num_readers_;
|
unsigned int num_readers_;
|
||||||
} fallback_;
|
} fallback_;
|
||||||
} uv_rwlock_t;
|
} uv_rwlock_t;
|
||||||
|
14
deps/uv/src/unix/freebsd.c
vendored
14
deps/uv/src/unix/freebsd.c
vendored
@ -240,17 +240,13 @@ error:
|
|||||||
|
|
||||||
|
|
||||||
int uv_uptime(double* uptime) {
|
int uv_uptime(double* uptime) {
|
||||||
time_t now;
|
int r;
|
||||||
struct timeval info;
|
struct timespec sp;
|
||||||
size_t size = sizeof(info);
|
r = clock_gettime(CLOCK_MONOTONIC, &sp);
|
||||||
static int which[] = {CTL_KERN, KERN_BOOTTIME};
|
if (r)
|
||||||
|
|
||||||
if (sysctl(which, 2, &info, &size, NULL, 0))
|
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
now = time(NULL);
|
*uptime = sp.tv_sec;
|
||||||
|
|
||||||
*uptime = (double)(now - info.tv_sec);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
9
deps/uv/src/unix/fs.c
vendored
9
deps/uv/src/unix/fs.c
vendored
@ -574,7 +574,14 @@ static ssize_t uv__fs_sendfile(uv_fs_t* req) {
|
|||||||
r = sendfile(in_fd, out_fd, req->off, &len, NULL, 0);
|
r = sendfile(in_fd, out_fd, req->off, &len, NULL, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (r != -1 || len != 0) {
|
/*
|
||||||
|
* The man page for sendfile(2) on DragonFly states that `len` contains
|
||||||
|
* a meaningful value ONLY in case of EAGAIN and EINTR.
|
||||||
|
* Nothing is said about it's value in case of other errors, so better
|
||||||
|
* not depend on the potential wrong assumption that is was not modified
|
||||||
|
* by the syscall.
|
||||||
|
*/
|
||||||
|
if (r == 0 || ((errno == EAGAIN || errno == EINTR) && len != 0)) {
|
||||||
req->off += len;
|
req->off += len;
|
||||||
return (ssize_t) len;
|
return (ssize_t) len;
|
||||||
}
|
}
|
||||||
|
5
deps/uv/src/unix/process.c
vendored
5
deps/uv/src/unix/process.c
vendored
@ -226,12 +226,13 @@ static int uv__process_open_stream(uv_stdio_container_t* container,
|
|||||||
int pipefds[2],
|
int pipefds[2],
|
||||||
int writable) {
|
int writable) {
|
||||||
int flags;
|
int flags;
|
||||||
|
int err;
|
||||||
|
|
||||||
if (!(container->flags & UV_CREATE_PIPE) || pipefds[0] < 0)
|
if (!(container->flags & UV_CREATE_PIPE) || pipefds[0] < 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (uv__close(pipefds[1]))
|
err = uv__close(pipefds[1]);
|
||||||
if (errno != EINTR && errno != EINPROGRESS)
|
if (err != 0 && err != -EINPROGRESS)
|
||||||
abort();
|
abort();
|
||||||
|
|
||||||
pipefds[1] = -1;
|
pipefds[1] = -1;
|
||||||
|
88
deps/uv/src/win/thread.c
vendored
88
deps/uv/src/win/thread.c
vendored
@ -396,18 +396,16 @@ static void uv__rwlock_srwlock_wrunlock(uv_rwlock_t* rwlock) {
|
|||||||
|
|
||||||
|
|
||||||
static int uv__rwlock_fallback_init(uv_rwlock_t* rwlock) {
|
static int uv__rwlock_fallback_init(uv_rwlock_t* rwlock) {
|
||||||
int err;
|
/* Initialize the semaphore that acts as the write lock. */
|
||||||
|
HANDLE handle = CreateSemaphoreW(NULL, 1, 1, NULL);
|
||||||
|
if (handle == NULL)
|
||||||
|
return uv_translate_sys_error(GetLastError());
|
||||||
|
rwlock->fallback_.write_lock_.sem = handle;
|
||||||
|
|
||||||
err = uv_mutex_init(&rwlock->fallback_.read_mutex_);
|
/* Initialize the critical section protecting the reader count. */
|
||||||
if (err)
|
InitializeCriticalSection(&rwlock->fallback_.read_lock_.cs);
|
||||||
return err;
|
|
||||||
|
|
||||||
err = uv_mutex_init(&rwlock->fallback_.write_mutex_);
|
|
||||||
if (err) {
|
|
||||||
uv_mutex_destroy(&rwlock->fallback_.read_mutex_);
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/* Initialize the reader count. */
|
||||||
rwlock->fallback_.num_readers_ = 0;
|
rwlock->fallback_.num_readers_ = 0;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -415,64 +413,88 @@ static int uv__rwlock_fallback_init(uv_rwlock_t* rwlock) {
|
|||||||
|
|
||||||
|
|
||||||
static void uv__rwlock_fallback_destroy(uv_rwlock_t* rwlock) {
|
static void uv__rwlock_fallback_destroy(uv_rwlock_t* rwlock) {
|
||||||
uv_mutex_destroy(&rwlock->fallback_.read_mutex_);
|
DeleteCriticalSection(&rwlock->fallback_.read_lock_.cs);
|
||||||
uv_mutex_destroy(&rwlock->fallback_.write_mutex_);
|
CloseHandle(rwlock->fallback_.write_lock_.sem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void uv__rwlock_fallback_rdlock(uv_rwlock_t* rwlock) {
|
static void uv__rwlock_fallback_rdlock(uv_rwlock_t* rwlock) {
|
||||||
uv_mutex_lock(&rwlock->fallback_.read_mutex_);
|
/* Acquire the lock that protects the reader count. */
|
||||||
|
EnterCriticalSection(&rwlock->fallback_.read_lock_.cs);
|
||||||
|
|
||||||
if (++rwlock->fallback_.num_readers_ == 1)
|
/* Increase the reader count, and lock for write if this is the first
|
||||||
uv_mutex_lock(&rwlock->fallback_.write_mutex_);
|
* reader.
|
||||||
|
*/
|
||||||
|
if (++rwlock->fallback_.num_readers_ == 1) {
|
||||||
|
DWORD r = WaitForSingleObject(rwlock->fallback_.write_lock_.sem, INFINITE);
|
||||||
|
if (r != WAIT_OBJECT_0)
|
||||||
|
uv_fatal_error(GetLastError(), "WaitForSingleObject");
|
||||||
|
}
|
||||||
|
|
||||||
uv_mutex_unlock(&rwlock->fallback_.read_mutex_);
|
/* Release the lock that protects the reader count. */
|
||||||
|
LeaveCriticalSection(&rwlock->fallback_.read_lock_.cs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int uv__rwlock_fallback_tryrdlock(uv_rwlock_t* rwlock) {
|
static int uv__rwlock_fallback_tryrdlock(uv_rwlock_t* rwlock) {
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
err = uv_mutex_trylock(&rwlock->fallback_.read_mutex_);
|
if (!TryEnterCriticalSection(&rwlock->fallback_.read_lock_.cs))
|
||||||
if (err)
|
return UV_EAGAIN;
|
||||||
goto out;
|
|
||||||
|
|
||||||
err = 0;
|
err = 0;
|
||||||
if (rwlock->fallback_.num_readers_ == 0)
|
if (rwlock->fallback_.num_readers_ == 0) {
|
||||||
err = uv_mutex_trylock(&rwlock->fallback_.write_mutex_);
|
DWORD r = WaitForSingleObject(rwlock->fallback_.write_lock_.sem, 0);
|
||||||
|
if (r == WAIT_OBJECT_0)
|
||||||
if (err == 0)
|
|
||||||
rwlock->fallback_.num_readers_++;
|
rwlock->fallback_.num_readers_++;
|
||||||
|
else if (r == WAIT_TIMEOUT)
|
||||||
|
err = UV_EAGAIN;
|
||||||
|
else if (r == WAIT_FAILED)
|
||||||
|
err = uv_translate_sys_error(GetLastError());
|
||||||
|
else
|
||||||
|
err = UV_EIO;
|
||||||
|
}
|
||||||
|
|
||||||
uv_mutex_unlock(&rwlock->fallback_.read_mutex_);
|
LeaveCriticalSection(&rwlock->fallback_.read_lock_.cs);
|
||||||
|
|
||||||
out:
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void uv__rwlock_fallback_rdunlock(uv_rwlock_t* rwlock) {
|
static void uv__rwlock_fallback_rdunlock(uv_rwlock_t* rwlock) {
|
||||||
uv_mutex_lock(&rwlock->fallback_.read_mutex_);
|
EnterCriticalSection(&rwlock->fallback_.read_lock_.cs);
|
||||||
|
|
||||||
if (--rwlock->fallback_.num_readers_ == 0)
|
if (--rwlock->fallback_.num_readers_ == 0) {
|
||||||
uv_mutex_unlock(&rwlock->fallback_.write_mutex_);
|
if (!ReleaseSemaphore(rwlock->fallback_.write_lock_.sem, 1, NULL))
|
||||||
|
uv_fatal_error(GetLastError(), "ReleaseSemaphore");
|
||||||
|
}
|
||||||
|
|
||||||
uv_mutex_unlock(&rwlock->fallback_.read_mutex_);
|
LeaveCriticalSection(&rwlock->fallback_.read_lock_.cs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void uv__rwlock_fallback_wrlock(uv_rwlock_t* rwlock) {
|
static void uv__rwlock_fallback_wrlock(uv_rwlock_t* rwlock) {
|
||||||
uv_mutex_lock(&rwlock->fallback_.write_mutex_);
|
DWORD r = WaitForSingleObject(rwlock->fallback_.write_lock_.sem, INFINITE);
|
||||||
|
if (r != WAIT_OBJECT_0)
|
||||||
|
uv_fatal_error(GetLastError(), "WaitForSingleObject");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int uv__rwlock_fallback_trywrlock(uv_rwlock_t* rwlock) {
|
static int uv__rwlock_fallback_trywrlock(uv_rwlock_t* rwlock) {
|
||||||
return uv_mutex_trylock(&rwlock->fallback_.write_mutex_);
|
DWORD r = WaitForSingleObject(rwlock->fallback_.write_lock_.sem, 0);
|
||||||
|
if (r == WAIT_OBJECT_0)
|
||||||
|
return 0;
|
||||||
|
else if (r == WAIT_TIMEOUT)
|
||||||
|
return UV_EAGAIN;
|
||||||
|
else if (r == WAIT_FAILED)
|
||||||
|
return uv_translate_sys_error(GetLastError());
|
||||||
|
else
|
||||||
|
return UV_EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void uv__rwlock_fallback_wrunlock(uv_rwlock_t* rwlock) {
|
static void uv__rwlock_fallback_wrunlock(uv_rwlock_t* rwlock) {
|
||||||
uv_mutex_unlock(&rwlock->fallback_.write_mutex_);
|
if (!ReleaseSemaphore(rwlock->fallback_.write_lock_.sem, 1, NULL))
|
||||||
|
uv_fatal_error(GetLastError(), "ReleaseSemaphore");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
38
deps/uv/src/win/tty.c
vendored
38
deps/uv/src/win/tty.c
vendored
@ -1498,6 +1498,11 @@ static int uv_tty_write_bufs(uv_tty_t* handle,
|
|||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
#define ENSURE_BUFFER_SPACE(wchars_needed) \
|
||||||
|
if (wchars_needed > ARRAY_SIZE(utf16_buf) - utf16_buf_used) { \
|
||||||
|
FLUSH_TEXT(); \
|
||||||
|
}
|
||||||
|
|
||||||
/* Cache for fast access */
|
/* Cache for fast access */
|
||||||
unsigned char utf8_bytes_left = handle->tty.wr.utf8_bytes_left;
|
unsigned char utf8_bytes_left = handle->tty.wr.utf8_bytes_left;
|
||||||
unsigned int utf8_codepoint = handle->tty.wr.utf8_codepoint;
|
unsigned int utf8_codepoint = handle->tty.wr.utf8_codepoint;
|
||||||
@ -1881,32 +1886,29 @@ static int uv_tty_write_bufs(uv_tty_t* handle,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (utf8_codepoint == 0x0a || utf8_codepoint == 0x0d) {
|
if (utf8_codepoint == 0x0a || utf8_codepoint == 0x0d) {
|
||||||
/* EOL conversion - emit \r\n, when we see either \r or \n. */
|
/* EOL conversion - emit \r\n when we see \n. */
|
||||||
/* If a \n immediately follows a \r or vice versa, ignore it. */
|
|
||||||
if (previous_eol == 0 || utf8_codepoint == previous_eol) {
|
|
||||||
/* If there's no room in the utf16 buf, flush it first. */
|
|
||||||
if (2 > ARRAY_SIZE(utf16_buf) - utf16_buf_used) {
|
|
||||||
uv_tty_emit_text(handle, utf16_buf, utf16_buf_used, error);
|
|
||||||
utf16_buf_used = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (utf8_codepoint == 0x0a && previous_eol != 0x0d) {
|
||||||
|
/* \n was not preceded by \r; print \r\n. */
|
||||||
|
ENSURE_BUFFER_SPACE(2);
|
||||||
utf16_buf[utf16_buf_used++] = L'\r';
|
utf16_buf[utf16_buf_used++] = L'\r';
|
||||||
utf16_buf[utf16_buf_used++] = L'\n';
|
utf16_buf[utf16_buf_used++] = L'\n';
|
||||||
previous_eol = (char) utf8_codepoint;
|
} else if (utf8_codepoint == 0x0d && previous_eol == 0x0a) {
|
||||||
|
/* \n was followed by \r; do not print the \r, since */
|
||||||
|
/* the source was either \r\n\r (so the second \r is */
|
||||||
|
/* redundant) or was \n\r (so the \n was processed */
|
||||||
|
/* by the last case and an \r automatically inserted). */
|
||||||
} else {
|
} else {
|
||||||
/* Ignore this newline, but don't ignore later ones. */
|
/* \r without \n; print \r as-is. */
|
||||||
previous_eol = 0;
|
ENSURE_BUFFER_SPACE(1);
|
||||||
|
utf16_buf[utf16_buf_used++] = (WCHAR) utf8_codepoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
previous_eol = (char) utf8_codepoint;
|
||||||
|
|
||||||
} else if (utf8_codepoint <= 0xffff) {
|
} else if (utf8_codepoint <= 0xffff) {
|
||||||
/* Encode character into utf-16 buffer. */
|
/* Encode character into utf-16 buffer. */
|
||||||
|
ENSURE_BUFFER_SPACE(1);
|
||||||
/* If there's no room in the utf16 buf, flush it first. */
|
|
||||||
if (1 > ARRAY_SIZE(utf16_buf) - utf16_buf_used) {
|
|
||||||
uv_tty_emit_text(handle, utf16_buf, utf16_buf_used, error);
|
|
||||||
utf16_buf_used = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
utf16_buf[utf16_buf_used++] = (WCHAR) utf8_codepoint;
|
utf16_buf[utf16_buf_used++] = (WCHAR) utf8_codepoint;
|
||||||
previous_eol = 0;
|
previous_eol = 0;
|
||||||
}
|
}
|
||||||
|
47
deps/uv/test/test-fs.c
vendored
47
deps/uv/test/test-fs.c
vendored
@ -427,6 +427,28 @@ static void rmdir_cb(uv_fs_t* req) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void assert_is_file_type(uv_dirent_t dent) {
|
||||||
|
#ifdef HAVE_DIRENT_TYPES
|
||||||
|
/*
|
||||||
|
* For Apple and Windows, we know getdents is expected to work but for other
|
||||||
|
* environments, the filesystem dictates whether or not getdents supports
|
||||||
|
* returning the file type.
|
||||||
|
*
|
||||||
|
* See:
|
||||||
|
* http://man7.org/linux/man-pages/man2/getdents.2.html
|
||||||
|
* https://github.com/libuv/libuv/issues/501
|
||||||
|
*/
|
||||||
|
#if defined(__APPLE__) || defined(_WIN32)
|
||||||
|
ASSERT(dent.type == UV_DIRENT_FILE);
|
||||||
|
#else
|
||||||
|
ASSERT(dent.type == UV_DIRENT_FILE || dent.type == UV_DIRENT_UNKNOWN);
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
ASSERT(dent.type == UV_DIRENT_UNKNOWN);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void scandir_cb(uv_fs_t* req) {
|
static void scandir_cb(uv_fs_t* req) {
|
||||||
uv_dirent_t dent;
|
uv_dirent_t dent;
|
||||||
ASSERT(req == &scandir_req);
|
ASSERT(req == &scandir_req);
|
||||||
@ -436,11 +458,7 @@ static void scandir_cb(uv_fs_t* req) {
|
|||||||
|
|
||||||
while (UV_EOF != uv_fs_scandir_next(req, &dent)) {
|
while (UV_EOF != uv_fs_scandir_next(req, &dent)) {
|
||||||
ASSERT(strcmp(dent.name, "file1") == 0 || strcmp(dent.name, "file2") == 0);
|
ASSERT(strcmp(dent.name, "file1") == 0 || strcmp(dent.name, "file2") == 0);
|
||||||
#ifdef HAVE_DIRENT_TYPES
|
assert_is_file_type(dent);
|
||||||
ASSERT(dent.type == UV_DIRENT_FILE);
|
|
||||||
#else
|
|
||||||
ASSERT(dent.type == UV_DIRENT_UNKNOWN);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
scandir_cb_count++;
|
scandir_cb_count++;
|
||||||
ASSERT(req->path);
|
ASSERT(req->path);
|
||||||
@ -878,11 +896,7 @@ TEST_IMPL(fs_async_dir) {
|
|||||||
ASSERT(scandir_req.ptr);
|
ASSERT(scandir_req.ptr);
|
||||||
while (UV_EOF != uv_fs_scandir_next(&scandir_req, &dent)) {
|
while (UV_EOF != uv_fs_scandir_next(&scandir_req, &dent)) {
|
||||||
ASSERT(strcmp(dent.name, "file1") == 0 || strcmp(dent.name, "file2") == 0);
|
ASSERT(strcmp(dent.name, "file1") == 0 || strcmp(dent.name, "file2") == 0);
|
||||||
#ifdef HAVE_DIRENT_TYPES
|
assert_is_file_type(dent);
|
||||||
ASSERT(dent.type == UV_DIRENT_FILE);
|
|
||||||
#else
|
|
||||||
ASSERT(dent.type == UV_DIRENT_UNKNOWN);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
uv_fs_req_cleanup(&scandir_req);
|
uv_fs_req_cleanup(&scandir_req);
|
||||||
ASSERT(!scandir_req.ptr);
|
ASSERT(!scandir_req.ptr);
|
||||||
@ -1724,6 +1738,7 @@ TEST_IMPL(fs_symlink_dir) {
|
|||||||
|
|
||||||
r = uv_fs_symlink(NULL, &req, test_dir, "test_dir_symlink",
|
r = uv_fs_symlink(NULL, &req, test_dir, "test_dir_symlink",
|
||||||
UV_FS_SYMLINK_JUNCTION, NULL);
|
UV_FS_SYMLINK_JUNCTION, NULL);
|
||||||
|
fprintf(stderr, "r == %i\n", r);
|
||||||
ASSERT(r == 0);
|
ASSERT(r == 0);
|
||||||
ASSERT(req.result == 0);
|
ASSERT(req.result == 0);
|
||||||
uv_fs_req_cleanup(&req);
|
uv_fs_req_cleanup(&req);
|
||||||
@ -1774,11 +1789,7 @@ TEST_IMPL(fs_symlink_dir) {
|
|||||||
ASSERT(scandir_req.ptr);
|
ASSERT(scandir_req.ptr);
|
||||||
while (UV_EOF != uv_fs_scandir_next(&scandir_req, &dent)) {
|
while (UV_EOF != uv_fs_scandir_next(&scandir_req, &dent)) {
|
||||||
ASSERT(strcmp(dent.name, "file1") == 0 || strcmp(dent.name, "file2") == 0);
|
ASSERT(strcmp(dent.name, "file1") == 0 || strcmp(dent.name, "file2") == 0);
|
||||||
#ifdef HAVE_DIRENT_TYPES
|
assert_is_file_type(dent);
|
||||||
ASSERT(dent.type == UV_DIRENT_FILE);
|
|
||||||
#else
|
|
||||||
ASSERT(dent.type == UV_DIRENT_UNKNOWN);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
uv_fs_req_cleanup(&scandir_req);
|
uv_fs_req_cleanup(&scandir_req);
|
||||||
ASSERT(!scandir_req.ptr);
|
ASSERT(!scandir_req.ptr);
|
||||||
@ -1798,11 +1809,7 @@ TEST_IMPL(fs_symlink_dir) {
|
|||||||
ASSERT(scandir_req.ptr);
|
ASSERT(scandir_req.ptr);
|
||||||
while (UV_EOF != uv_fs_scandir_next(&scandir_req, &dent)) {
|
while (UV_EOF != uv_fs_scandir_next(&scandir_req, &dent)) {
|
||||||
ASSERT(strcmp(dent.name, "file1") == 0 || strcmp(dent.name, "file2") == 0);
|
ASSERT(strcmp(dent.name, "file1") == 0 || strcmp(dent.name, "file2") == 0);
|
||||||
#ifdef HAVE_DIRENT_TYPES
|
assert_is_file_type(dent);
|
||||||
ASSERT(dent.type == UV_DIRENT_FILE);
|
|
||||||
#else
|
|
||||||
ASSERT(dent.type == UV_DIRENT_UNKNOWN);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
uv_fs_req_cleanup(&scandir_req);
|
uv_fs_req_cleanup(&scandir_req);
|
||||||
ASSERT(!scandir_req.ptr);
|
ASSERT(!scandir_req.ptr);
|
||||||
|
13
deps/uv/test/test-ipc.c
vendored
13
deps/uv/test/test-ipc.c
vendored
@ -52,6 +52,7 @@ typedef struct {
|
|||||||
} tcp_conn;
|
} tcp_conn;
|
||||||
|
|
||||||
#define CONN_COUNT 100
|
#define CONN_COUNT 100
|
||||||
|
#define BACKLOG 128
|
||||||
|
|
||||||
|
|
||||||
static void close_server_conn_cb(uv_handle_t* handle) {
|
static void close_server_conn_cb(uv_handle_t* handle) {
|
||||||
@ -179,7 +180,7 @@ static void on_read(uv_stream_t* handle,
|
|||||||
r = uv_accept((uv_stream_t*)pipe, (uv_stream_t*)&tcp_server);
|
r = uv_accept((uv_stream_t*)pipe, (uv_stream_t*)&tcp_server);
|
||||||
ASSERT(r == 0);
|
ASSERT(r == 0);
|
||||||
|
|
||||||
r = uv_listen((uv_stream_t*)&tcp_server, 12, on_connection);
|
r = uv_listen((uv_stream_t*)&tcp_server, BACKLOG, on_connection);
|
||||||
ASSERT(r == 0);
|
ASSERT(r == 0);
|
||||||
|
|
||||||
tcp_server_listening = 1;
|
tcp_server_listening = 1;
|
||||||
@ -246,7 +247,7 @@ static void on_read_listen_after_bound_twice(uv_stream_t* handle,
|
|||||||
r = uv_accept((uv_stream_t*)pipe, (uv_stream_t*)&tcp_server);
|
r = uv_accept((uv_stream_t*)pipe, (uv_stream_t*)&tcp_server);
|
||||||
ASSERT(r == 0);
|
ASSERT(r == 0);
|
||||||
|
|
||||||
r = uv_listen((uv_stream_t*)&tcp_server, 12, on_connection);
|
r = uv_listen((uv_stream_t*)&tcp_server, BACKLOG, on_connection);
|
||||||
ASSERT(r == 0);
|
ASSERT(r == 0);
|
||||||
} else if (read_cb_called == 2) {
|
} else if (read_cb_called == 2) {
|
||||||
/* Accept the second TCP server, and start listening on it. */
|
/* Accept the second TCP server, and start listening on it. */
|
||||||
@ -257,7 +258,7 @@ static void on_read_listen_after_bound_twice(uv_stream_t* handle,
|
|||||||
r = uv_accept((uv_stream_t*)pipe, (uv_stream_t*)&tcp_server2);
|
r = uv_accept((uv_stream_t*)pipe, (uv_stream_t*)&tcp_server2);
|
||||||
ASSERT(r == 0);
|
ASSERT(r == 0);
|
||||||
|
|
||||||
r = uv_listen((uv_stream_t*)&tcp_server2, 12, on_connection);
|
r = uv_listen((uv_stream_t*)&tcp_server2, BACKLOG, on_connection);
|
||||||
ASSERT(r == UV_EADDRINUSE);
|
ASSERT(r == UV_EADDRINUSE);
|
||||||
|
|
||||||
uv_close((uv_handle_t*)&tcp_server, NULL);
|
uv_close((uv_handle_t*)&tcp_server, NULL);
|
||||||
@ -652,7 +653,7 @@ int ipc_helper(int listen_after_write) {
|
|||||||
ASSERT(r == 0);
|
ASSERT(r == 0);
|
||||||
|
|
||||||
if (!listen_after_write) {
|
if (!listen_after_write) {
|
||||||
r = uv_listen((uv_stream_t*)&tcp_server, 12, ipc_on_connection);
|
r = uv_listen((uv_stream_t*)&tcp_server, BACKLOG, ipc_on_connection);
|
||||||
ASSERT(r == 0);
|
ASSERT(r == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -662,7 +663,7 @@ int ipc_helper(int listen_after_write) {
|
|||||||
ASSERT(r == 0);
|
ASSERT(r == 0);
|
||||||
|
|
||||||
if (listen_after_write) {
|
if (listen_after_write) {
|
||||||
r = uv_listen((uv_stream_t*)&tcp_server, 12, ipc_on_connection);
|
r = uv_listen((uv_stream_t*)&tcp_server, BACKLOG, ipc_on_connection);
|
||||||
ASSERT(r == 0);
|
ASSERT(r == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -703,7 +704,7 @@ int ipc_helper_tcp_connection(void) {
|
|||||||
r = uv_tcp_bind(&tcp_server, (const struct sockaddr*) &addr, 0);
|
r = uv_tcp_bind(&tcp_server, (const struct sockaddr*) &addr, 0);
|
||||||
ASSERT(r == 0);
|
ASSERT(r == 0);
|
||||||
|
|
||||||
r = uv_listen((uv_stream_t*)&tcp_server, 12, ipc_on_connection_tcp_conn);
|
r = uv_listen((uv_stream_t*)&tcp_server, BACKLOG, ipc_on_connection_tcp_conn);
|
||||||
ASSERT(r == 0);
|
ASSERT(r == 0);
|
||||||
|
|
||||||
/* Make a connection to the server */
|
/* Make a connection to the server */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user