deps: upgrade to libuv 1.20.2
PR-URL: https://github.com/nodejs/node/pull/20129 Fixes: https://github.com/nodejs/node/issues/20112 Fixes: https://github.com/nodejs/node/issues/19903 Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Richard Lau <riclau@uk.ibm.com>
This commit is contained in:
parent
7fcb52c7b2
commit
63d991b7cf
5
deps/uv/AUTHORS
vendored
5
deps/uv/AUTHORS
vendored
@ -332,3 +332,8 @@ Ryuichi KAWAMATA <ryuichi.kawamata@dena.jp>
|
|||||||
Joyee Cheung <joyeec9h3@gmail.com>
|
Joyee Cheung <joyeec9h3@gmail.com>
|
||||||
Michael Kilburn <crusader.mike@gmail.com>
|
Michael Kilburn <crusader.mike@gmail.com>
|
||||||
Ruslan Bekenev <furyinbox@gmail.com>
|
Ruslan Bekenev <furyinbox@gmail.com>
|
||||||
|
Bob Burger <rgburger@beckman.com>
|
||||||
|
Thomas Versteeg <thomasversteeg@gmx.com>
|
||||||
|
zzzjim <zzzjim@users.noreply.github.com>
|
||||||
|
Alex Arslan <ararslan@comcast.net>
|
||||||
|
Kyle Farnung <kfarnung@microsoft.com>
|
||||||
|
36
deps/uv/ChangeLog
vendored
36
deps/uv/ChangeLog
vendored
@ -1,3 +1,39 @@
|
|||||||
|
2018.04.23, Version 1.20.2 (Stable), c51fd3f66bbb386a1efdeba6812789f35a372d1e
|
||||||
|
|
||||||
|
Changes since version 1.20.1:
|
||||||
|
|
||||||
|
* zos: use custom semaphore (jBarz)
|
||||||
|
|
||||||
|
* win: fix registry API error handling (Kyle Farnung)
|
||||||
|
|
||||||
|
* build: add support for 64-bit AIX (Richard Lau)
|
||||||
|
|
||||||
|
* aix: guard STATIC_ASSERT for glibc work around (Richard Lau)
|
||||||
|
|
||||||
|
|
||||||
|
2018.04.19, Version 1.20.1 (Stable), 36ac2fc8edfd5ff3e9be529be1d4a3f0d5364e94
|
||||||
|
|
||||||
|
Changes since version 1.20.0:
|
||||||
|
|
||||||
|
* doc,fs: improve documentation (Bob Burger)
|
||||||
|
|
||||||
|
* win: return a floored double from uv_uptime() (Refael Ackermann)
|
||||||
|
|
||||||
|
* doc: clarify platform specific pipe naming (Thomas Versteeg)
|
||||||
|
|
||||||
|
* unix: fix uv_pipe_chmod() on macOS (zzzjim)
|
||||||
|
|
||||||
|
* unix: work around glibc semaphore race condition (Anna Henningsen)
|
||||||
|
|
||||||
|
* tcp,openbsd: disable Unix TCP check for IPV6_ONLY (Alex Arslan)
|
||||||
|
|
||||||
|
* test,openbsd: use RETURN_SKIP in UDP IPv6 tests (Alex Arslan)
|
||||||
|
|
||||||
|
* test,openbsd: fix multicast test (Alex Arslan)
|
||||||
|
|
||||||
|
* Revert "win, fs: use FILE_WRITE_ATTRIBUTES when opening files" (cjihrig)
|
||||||
|
|
||||||
|
|
||||||
2018.04.03, Version 1.20.0 (Stable), 0012178ee2b04d9e4a2c66c27cf8891ad8325ceb
|
2018.04.03, Version 1.20.0 (Stable), 0012178ee2b04d9e4a2c66c27cf8891ad8325ceb
|
||||||
|
|
||||||
Changes since version 1.19.2:
|
Changes since version 1.19.2:
|
||||||
|
6
deps/uv/common.gypi
vendored
6
deps/uv/common.gypi
vendored
@ -134,7 +134,7 @@
|
|||||||
}]
|
}]
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
['OS in "freebsd dragonflybsd linux openbsd solaris android"', {
|
['OS in "freebsd dragonflybsd linux openbsd solaris android aix"', {
|
||||||
'cflags': [ '-Wall' ],
|
'cflags': [ '-Wall' ],
|
||||||
'cflags_cc': [ '-fno-rtti', '-fno-exceptions' ],
|
'cflags_cc': [ '-fno-rtti', '-fno-exceptions' ],
|
||||||
'target_conditions': [
|
'target_conditions': [
|
||||||
@ -162,6 +162,10 @@
|
|||||||
'cflags': [ '-pthread' ],
|
'cflags': [ '-pthread' ],
|
||||||
'ldflags': [ '-pthread' ],
|
'ldflags': [ '-pthread' ],
|
||||||
}],
|
}],
|
||||||
|
[ 'OS=="aix" and target_arch=="ppc64"', {
|
||||||
|
'cflags': [ '-maix64' ],
|
||||||
|
'ldflags': [ '-maix64' ],
|
||||||
|
}],
|
||||||
],
|
],
|
||||||
}],
|
}],
|
||||||
['OS=="mac"', {
|
['OS=="mac"', {
|
||||||
|
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.20.0], [https://github.com/libuv/libuv/issues])
|
AC_INIT([libuv], [1.20.2], [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])
|
||||||
|
6
deps/uv/docs/src/fs.rst
vendored
6
deps/uv/docs/src/fs.rst
vendored
@ -148,8 +148,8 @@ Public members
|
|||||||
|
|
||||||
.. c:member:: void* uv_fs_t.ptr
|
.. c:member:: void* uv_fs_t.ptr
|
||||||
|
|
||||||
Stores the result of :c:func:`uv_fs_readlink` and serves as an alias to
|
Stores the result of :c:func:`uv_fs_readlink` and
|
||||||
`statbuf`.
|
:c:func:`uv_fs_realpath` and serves as an alias to `statbuf`.
|
||||||
|
|
||||||
.. seealso:: The :c:type:`uv_req_t` members also apply.
|
.. seealso:: The :c:type:`uv_req_t` members also apply.
|
||||||
|
|
||||||
@ -311,10 +311,12 @@ API
|
|||||||
.. c:function:: int uv_fs_readlink(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb)
|
.. c:function:: int uv_fs_readlink(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb)
|
||||||
|
|
||||||
Equivalent to :man:`readlink(2)`.
|
Equivalent to :man:`readlink(2)`.
|
||||||
|
The resulting string is stored in `req->ptr`.
|
||||||
|
|
||||||
.. c:function:: int uv_fs_realpath(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb)
|
.. 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://msdn.microsoft.com/en-us/library/windows/desktop/aa364962(v=vs.85).aspx>`_.
|
||||||
|
The resulting string is stored in `req->ptr`.
|
||||||
|
|
||||||
.. warning::
|
.. warning::
|
||||||
This function has certain platform-specific caveats that were discovered when used in Node.
|
This function has certain platform-specific caveats that were discovered when used in Node.
|
||||||
|
2
deps/uv/include/uv-os390.h
vendored
2
deps/uv/include/uv-os390.h
vendored
@ -22,7 +22,7 @@
|
|||||||
#ifndef UV_MVS_H
|
#ifndef UV_MVS_H
|
||||||
#define UV_MVS_H
|
#define UV_MVS_H
|
||||||
|
|
||||||
#define UV_PLATFORM_SEM_T int
|
#define UV_PLATFORM_SEM_T long
|
||||||
|
|
||||||
#define UV_PLATFORM_LOOP_FIELDS \
|
#define UV_PLATFORM_LOOP_FIELDS \
|
||||||
void* ep; \
|
void* ep; \
|
||||||
|
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 20
|
#define UV_VERSION_MINOR 20
|
||||||
#define UV_VERSION_PATCH 0
|
#define UV_VERSION_PATCH 2
|
||||||
#define UV_VERSION_IS_RELEASE 1
|
#define UV_VERSION_IS_RELEASE 1
|
||||||
#define UV_VERSION_SUFFIX ""
|
#define UV_VERSION_SUFFIX ""
|
||||||
|
|
||||||
|
35
deps/uv/src/unix/pipe.c
vendored
35
deps/uv/src/unix/pipe.c
vendored
@ -319,21 +319,6 @@ int uv_pipe_chmod(uv_pipe_t* handle, int mode) {
|
|||||||
mode != (UV_WRITABLE | UV_READABLE))
|
mode != (UV_WRITABLE | UV_READABLE))
|
||||||
return UV_EINVAL;
|
return UV_EINVAL;
|
||||||
|
|
||||||
if (fstat(uv__stream_fd(handle), &pipe_stat) == -1)
|
|
||||||
return UV__ERR(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. */
|
/* Unfortunately fchmod does not work on all platforms, we will use chmod. */
|
||||||
name_len = 0;
|
name_len = 0;
|
||||||
r = uv_pipe_getsockname(handle, NULL, &name_len);
|
r = uv_pipe_getsockname(handle, NULL, &name_len);
|
||||||
@ -350,6 +335,26 @@ int uv_pipe_chmod(uv_pipe_t* handle, int mode) {
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* stat must be used as fstat has a bug on Darwin */
|
||||||
|
if (stat(name_buffer, &pipe_stat) == -1) {
|
||||||
|
uv__free(name_buffer);
|
||||||
|
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) {
|
||||||
|
uv__free(name_buffer);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
pipe_stat.st_mode |= desired_mode;
|
||||||
|
|
||||||
r = chmod(name_buffer, pipe_stat.st_mode);
|
r = chmod(name_buffer, pipe_stat.st_mode);
|
||||||
uv__free(name_buffer);
|
uv__free(name_buffer);
|
||||||
|
|
||||||
|
2
deps/uv/src/unix/tcp.c
vendored
2
deps/uv/src/unix/tcp.c
vendored
@ -164,6 +164,7 @@ int uv__tcp_bind(uv_tcp_t* tcp,
|
|||||||
if (setsockopt(tcp->io_watcher.fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)))
|
if (setsockopt(tcp->io_watcher.fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)))
|
||||||
return UV__ERR(errno);
|
return UV__ERR(errno);
|
||||||
|
|
||||||
|
#ifndef __OpenBSD__
|
||||||
#ifdef IPV6_V6ONLY
|
#ifdef IPV6_V6ONLY
|
||||||
if (addr->sa_family == AF_INET6) {
|
if (addr->sa_family == AF_INET6) {
|
||||||
on = (flags & UV_TCP_IPV6ONLY) != 0;
|
on = (flags & UV_TCP_IPV6ONLY) != 0;
|
||||||
@ -179,6 +180,7 @@ int uv__tcp_bind(uv_tcp_t* tcp,
|
|||||||
return UV__ERR(errno);
|
return UV__ERR(errno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
|
255
deps/uv/src/unix/thread.c
vendored
255
deps/uv/src/unix/thread.c
vendored
@ -37,6 +37,10 @@
|
|||||||
#include <sys/sem.h>
|
#include <sys/sem.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __GLIBC__
|
||||||
|
#include <gnu/libc-version.h> /* gnu_get_libc_version() */
|
||||||
|
#endif
|
||||||
|
|
||||||
#undef NANOSEC
|
#undef NANOSEC
|
||||||
#define NANOSEC ((uint64_t) 1e9)
|
#define NANOSEC ((uint64_t) 1e9)
|
||||||
|
|
||||||
@ -419,109 +423,145 @@ int uv_sem_trywait(uv_sem_t* sem) {
|
|||||||
return UV_EINVAL; /* Satisfy the compiler. */
|
return UV_EINVAL; /* Satisfy the compiler. */
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(__MVS__)
|
|
||||||
|
|
||||||
int uv_sem_init(uv_sem_t* sem, unsigned int value) {
|
|
||||||
uv_sem_t semid;
|
|
||||||
int err;
|
|
||||||
union {
|
|
||||||
int val;
|
|
||||||
struct semid_ds* buf;
|
|
||||||
unsigned short* array;
|
|
||||||
} arg;
|
|
||||||
|
|
||||||
|
|
||||||
semid = semget(IPC_PRIVATE, 1, S_IRUSR | S_IWUSR);
|
|
||||||
if (semid == -1)
|
|
||||||
return UV__ERR(errno);
|
|
||||||
|
|
||||||
arg.val = value;
|
|
||||||
if (-1 == semctl(semid, 0, SETVAL, arg)) {
|
|
||||||
err = errno;
|
|
||||||
if (-1 == semctl(*sem, 0, IPC_RMID))
|
|
||||||
abort();
|
|
||||||
return UV__ERR(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
*sem = semid;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void uv_sem_destroy(uv_sem_t* sem) {
|
|
||||||
if (-1 == semctl(*sem, 0, IPC_RMID))
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
|
|
||||||
void uv_sem_post(uv_sem_t* sem) {
|
|
||||||
struct sembuf buf;
|
|
||||||
|
|
||||||
buf.sem_num = 0;
|
|
||||||
buf.sem_op = 1;
|
|
||||||
buf.sem_flg = 0;
|
|
||||||
|
|
||||||
if (-1 == semop(*sem, &buf, 1))
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
|
|
||||||
void uv_sem_wait(uv_sem_t* sem) {
|
|
||||||
struct sembuf buf;
|
|
||||||
int op_status;
|
|
||||||
|
|
||||||
buf.sem_num = 0;
|
|
||||||
buf.sem_op = -1;
|
|
||||||
buf.sem_flg = 0;
|
|
||||||
|
|
||||||
do
|
|
||||||
op_status = semop(*sem, &buf, 1);
|
|
||||||
while (op_status == -1 && errno == EINTR);
|
|
||||||
|
|
||||||
if (op_status)
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
|
|
||||||
int uv_sem_trywait(uv_sem_t* sem) {
|
|
||||||
struct sembuf buf;
|
|
||||||
int op_status;
|
|
||||||
|
|
||||||
buf.sem_num = 0;
|
|
||||||
buf.sem_op = -1;
|
|
||||||
buf.sem_flg = IPC_NOWAIT;
|
|
||||||
|
|
||||||
do
|
|
||||||
op_status = semop(*sem, &buf, 1);
|
|
||||||
while (op_status == -1 && errno == EINTR);
|
|
||||||
|
|
||||||
if (op_status) {
|
|
||||||
if (errno == EAGAIN)
|
|
||||||
return UV_EAGAIN;
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else /* !(defined(__APPLE__) && defined(__MACH__)) */
|
#else /* !(defined(__APPLE__) && defined(__MACH__)) */
|
||||||
|
|
||||||
int uv_sem_init(uv_sem_t* sem, unsigned int value) {
|
#ifdef __GLIBC__
|
||||||
|
|
||||||
|
/* Hack around https://sourceware.org/bugzilla/show_bug.cgi?id=12674
|
||||||
|
* by providing a custom implementation for glibc < 2.21 in terms of other
|
||||||
|
* concurrency primitives.
|
||||||
|
* Refs: https://github.com/nodejs/node/issues/19903 */
|
||||||
|
|
||||||
|
/* To preserve ABI compatibility, we treat the uv_sem_t as storage for
|
||||||
|
* a pointer to the actual struct we're using underneath. */
|
||||||
|
|
||||||
|
static uv_once_t glibc_version_check_once = UV_ONCE_INIT;
|
||||||
|
static int platform_needs_custom_semaphore = 0;
|
||||||
|
|
||||||
|
static void glibc_version_check(void) {
|
||||||
|
const char* version = gnu_get_libc_version();
|
||||||
|
platform_needs_custom_semaphore =
|
||||||
|
version[0] == '2' && version[1] == '.' &&
|
||||||
|
atoi(version + 2) < 21;
|
||||||
|
}
|
||||||
|
|
||||||
|
#elif defined(__MVS__)
|
||||||
|
|
||||||
|
#define platform_needs_custom_semaphore 1
|
||||||
|
|
||||||
|
#else /* !defined(__GLIBC__) && !defined(__MVS__) */
|
||||||
|
|
||||||
|
#define platform_needs_custom_semaphore 0
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct uv_semaphore_s {
|
||||||
|
uv_mutex_t mutex;
|
||||||
|
uv_cond_t cond;
|
||||||
|
unsigned int value;
|
||||||
|
} uv_semaphore_t;
|
||||||
|
|
||||||
|
#if defined(__GLIBC__) || platform_needs_custom_semaphore
|
||||||
|
STATIC_ASSERT(sizeof(uv_sem_t) >= sizeof(uv_semaphore_t*));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static int uv__custom_sem_init(uv_sem_t* sem_, unsigned int value) {
|
||||||
|
int err;
|
||||||
|
uv_semaphore_t* sem;
|
||||||
|
|
||||||
|
sem = uv__malloc(sizeof(*sem));
|
||||||
|
if (sem == NULL)
|
||||||
|
return UV_ENOMEM;
|
||||||
|
|
||||||
|
if ((err = uv_mutex_init(&sem->mutex)) != 0) {
|
||||||
|
uv__free(sem);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((err = uv_cond_init(&sem->cond)) != 0) {
|
||||||
|
uv_mutex_destroy(&sem->mutex);
|
||||||
|
uv__free(sem);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
sem->value = value;
|
||||||
|
*(uv_semaphore_t**)sem_ = sem;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void uv__custom_sem_destroy(uv_sem_t* sem_) {
|
||||||
|
uv_semaphore_t* sem;
|
||||||
|
|
||||||
|
sem = *(uv_semaphore_t**)sem_;
|
||||||
|
uv_cond_destroy(&sem->cond);
|
||||||
|
uv_mutex_destroy(&sem->mutex);
|
||||||
|
uv__free(sem);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void uv__custom_sem_post(uv_sem_t* sem_) {
|
||||||
|
uv_semaphore_t* sem;
|
||||||
|
|
||||||
|
sem = *(uv_semaphore_t**)sem_;
|
||||||
|
uv_mutex_lock(&sem->mutex);
|
||||||
|
sem->value++;
|
||||||
|
if (sem->value == 1)
|
||||||
|
uv_cond_signal(&sem->cond);
|
||||||
|
uv_mutex_unlock(&sem->mutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void uv__custom_sem_wait(uv_sem_t* sem_) {
|
||||||
|
uv_semaphore_t* sem;
|
||||||
|
|
||||||
|
sem = *(uv_semaphore_t**)sem_;
|
||||||
|
uv_mutex_lock(&sem->mutex);
|
||||||
|
while (sem->value == 0)
|
||||||
|
uv_cond_wait(&sem->cond, &sem->mutex);
|
||||||
|
sem->value--;
|
||||||
|
uv_mutex_unlock(&sem->mutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int uv__custom_sem_trywait(uv_sem_t* sem_) {
|
||||||
|
uv_semaphore_t* sem;
|
||||||
|
|
||||||
|
sem = *(uv_semaphore_t**)sem_;
|
||||||
|
if (uv_mutex_trylock(&sem->mutex) != 0)
|
||||||
|
return UV_EAGAIN;
|
||||||
|
|
||||||
|
if (sem->value == 0) {
|
||||||
|
uv_mutex_unlock(&sem->mutex);
|
||||||
|
return UV_EAGAIN;
|
||||||
|
}
|
||||||
|
|
||||||
|
sem->value--;
|
||||||
|
uv_mutex_unlock(&sem->mutex);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int uv__sem_init(uv_sem_t* sem, unsigned int value) {
|
||||||
if (sem_init(sem, 0, value))
|
if (sem_init(sem, 0, value))
|
||||||
return UV__ERR(errno);
|
return UV__ERR(errno);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void uv_sem_destroy(uv_sem_t* sem) {
|
static void uv__sem_destroy(uv_sem_t* sem) {
|
||||||
if (sem_destroy(sem))
|
if (sem_destroy(sem))
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void uv_sem_post(uv_sem_t* sem) {
|
static void uv__sem_post(uv_sem_t* sem) {
|
||||||
if (sem_post(sem))
|
if (sem_post(sem))
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void uv_sem_wait(uv_sem_t* sem) {
|
static void uv__sem_wait(uv_sem_t* sem) {
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
do
|
do
|
||||||
@ -533,7 +573,7 @@ void uv_sem_wait(uv_sem_t* sem) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int uv_sem_trywait(uv_sem_t* sem) {
|
static int uv__sem_trywait(uv_sem_t* sem) {
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
do
|
do
|
||||||
@ -549,6 +589,49 @@ int uv_sem_trywait(uv_sem_t* sem) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int uv_sem_init(uv_sem_t* sem, unsigned int value) {
|
||||||
|
#ifdef __GLIBC__
|
||||||
|
uv_once(&glibc_version_check_once, glibc_version_check);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (platform_needs_custom_semaphore)
|
||||||
|
return uv__custom_sem_init(sem, value);
|
||||||
|
else
|
||||||
|
return uv__sem_init(sem, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void uv_sem_destroy(uv_sem_t* sem) {
|
||||||
|
if (platform_needs_custom_semaphore)
|
||||||
|
uv__custom_sem_destroy(sem);
|
||||||
|
else
|
||||||
|
uv__sem_destroy(sem);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void uv_sem_post(uv_sem_t* sem) {
|
||||||
|
if (platform_needs_custom_semaphore)
|
||||||
|
uv__custom_sem_post(sem);
|
||||||
|
else
|
||||||
|
uv__sem_post(sem);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void uv_sem_wait(uv_sem_t* sem) {
|
||||||
|
if (platform_needs_custom_semaphore)
|
||||||
|
uv__custom_sem_wait(sem);
|
||||||
|
else
|
||||||
|
uv__sem_wait(sem);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int uv_sem_trywait(uv_sem_t* sem) {
|
||||||
|
if (platform_needs_custom_semaphore)
|
||||||
|
return uv__custom_sem_trywait(sem);
|
||||||
|
else
|
||||||
|
return uv__sem_trywait(sem);
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* defined(__APPLE__) && defined(__MACH__) */
|
#endif /* defined(__APPLE__) && defined(__MACH__) */
|
||||||
|
|
||||||
|
|
||||||
|
2
deps/uv/src/win/fs.c
vendored
2
deps/uv/src/win/fs.c
vendored
@ -434,8 +434,6 @@ void fs__open(uv_fs_t* req) {
|
|||||||
access |= FILE_APPEND_DATA;
|
access |= FILE_APPEND_DATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
access |= FILE_WRITE_ATTRIBUTES;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Here is where we deviate significantly from what CRT's _open()
|
* Here is where we deviate significantly from what CRT's _open()
|
||||||
* does. We indiscriminately use all the sharing modes, to match
|
* does. We indiscriminately use all the sharing modes, to match
|
||||||
|
47
deps/uv/src/win/util.c
vendored
47
deps/uv/src/win/util.c
vendored
@ -587,8 +587,8 @@ int uv_uptime(double* uptime) {
|
|||||||
BYTE* address = (BYTE*) object_type + object_type->DefinitionLength +
|
BYTE* address = (BYTE*) object_type + object_type->DefinitionLength +
|
||||||
counter_definition->CounterOffset;
|
counter_definition->CounterOffset;
|
||||||
uint64_t value = *((uint64_t*) address);
|
uint64_t value = *((uint64_t*) address);
|
||||||
*uptime = (double) (object_type->PerfTime.QuadPart - value) /
|
*uptime = floor((double) (object_type->PerfTime.QuadPart - value) /
|
||||||
(double) object_type->PerfFreq.QuadPart;
|
(double) object_type->PerfFreq.QuadPart);
|
||||||
uv__free(malloced_buffer);
|
uv__free(malloced_buffer);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -615,7 +615,7 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos_ptr, int* cpu_count_ptr) {
|
|||||||
SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION* sppi;
|
SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION* sppi;
|
||||||
DWORD sppi_size;
|
DWORD sppi_size;
|
||||||
SYSTEM_INFO system_info;
|
SYSTEM_INFO system_info;
|
||||||
DWORD cpu_count, r, i;
|
DWORD cpu_count, i;
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
ULONG result_size;
|
ULONG result_size;
|
||||||
int err;
|
int err;
|
||||||
@ -670,34 +670,33 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos_ptr, int* cpu_count_ptr) {
|
|||||||
|
|
||||||
assert(len > 0 && len < ARRAY_SIZE(key_name));
|
assert(len > 0 && len < ARRAY_SIZE(key_name));
|
||||||
|
|
||||||
r = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
|
err = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
|
||||||
key_name,
|
key_name,
|
||||||
0,
|
0,
|
||||||
KEY_QUERY_VALUE,
|
KEY_QUERY_VALUE,
|
||||||
&processor_key);
|
&processor_key);
|
||||||
if (r != ERROR_SUCCESS) {
|
if (err != ERROR_SUCCESS) {
|
||||||
err = GetLastError();
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RegQueryValueExW(processor_key,
|
err = RegQueryValueExW(processor_key,
|
||||||
L"~MHz",
|
L"~MHz",
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
(BYTE*) &cpu_speed,
|
(BYTE*)&cpu_speed,
|
||||||
&cpu_speed_size) != ERROR_SUCCESS) {
|
&cpu_speed_size);
|
||||||
err = GetLastError();
|
if (err != ERROR_SUCCESS) {
|
||||||
RegCloseKey(processor_key);
|
RegCloseKey(processor_key);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RegQueryValueExW(processor_key,
|
err = RegQueryValueExW(processor_key,
|
||||||
L"ProcessorNameString",
|
L"ProcessorNameString",
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
(BYTE*) &cpu_brand,
|
(BYTE*)&cpu_brand,
|
||||||
&cpu_brand_size) != ERROR_SUCCESS) {
|
&cpu_brand_size);
|
||||||
err = GetLastError();
|
if (err != ERROR_SUCCESS) {
|
||||||
RegCloseKey(processor_key);
|
RegCloseKey(processor_key);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
22
deps/uv/test/test-fs.c
vendored
22
deps/uv/test/test-fs.c
vendored
@ -1367,28 +1367,6 @@ TEST_IMPL(fs_chmod) {
|
|||||||
|
|
||||||
check_permission("test_file", 0600);
|
check_permission("test_file", 0600);
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
/* Test clearing read-only flag from files with Archive flag cleared */
|
|
||||||
/* Make the file read-only and clear archive flag */
|
|
||||||
r = SetFileAttributes("test_file", FILE_ATTRIBUTE_READONLY);
|
|
||||||
ASSERT(r != 0);
|
|
||||||
check_permission("test_file", 0400);
|
|
||||||
|
|
||||||
r = uv_fs_open(NULL, &req, "test_file", 0, 0, NULL);
|
|
||||||
ASSERT(r >= 0);
|
|
||||||
ASSERT(req.result >= 0);
|
|
||||||
uv_fs_req_cleanup(&req);
|
|
||||||
|
|
||||||
r = uv_fs_fchmod(NULL, &req, file, 0600, NULL);
|
|
||||||
ASSERT(r == 0);
|
|
||||||
ASSERT(req.result == 0);
|
|
||||||
uv_fs_req_cleanup(&req);
|
|
||||||
|
|
||||||
check_permission("test_file", 0600);
|
|
||||||
/* Restore Archive flag for rest of the tests */
|
|
||||||
r = SetFileAttributes("test_file", FILE_ATTRIBUTE_ARCHIVE);
|
|
||||||
ASSERT(r != 0);
|
|
||||||
#endif
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
/* async chmod */
|
/* async chmod */
|
||||||
{
|
{
|
||||||
|
24
deps/uv/test/test-pipe-set-fchmod.c
vendored
24
deps/uv/test/test-pipe-set-fchmod.c
vendored
@ -27,6 +27,9 @@ TEST_IMPL(pipe_set_chmod) {
|
|||||||
uv_pipe_t pipe_handle;
|
uv_pipe_t pipe_handle;
|
||||||
uv_loop_t* loop;
|
uv_loop_t* loop;
|
||||||
int r;
|
int r;
|
||||||
|
#ifndef _WIN32
|
||||||
|
struct stat stat_buf;
|
||||||
|
#endif
|
||||||
|
|
||||||
loop = uv_default_loop();
|
loop = uv_default_loop();
|
||||||
|
|
||||||
@ -44,12 +47,33 @@ TEST_IMPL(pipe_set_chmod) {
|
|||||||
RETURN_SKIP("Insufficient privileges to alter pipe fmode");
|
RETURN_SKIP("Insufficient privileges to alter pipe fmode");
|
||||||
}
|
}
|
||||||
ASSERT(r == 0);
|
ASSERT(r == 0);
|
||||||
|
#ifndef _WIN32
|
||||||
|
stat(TEST_PIPENAME, &stat_buf);
|
||||||
|
ASSERT(stat_buf.st_mode & S_IRUSR);
|
||||||
|
ASSERT(stat_buf.st_mode & S_IRGRP);
|
||||||
|
ASSERT(stat_buf.st_mode & S_IROTH);
|
||||||
|
#endif
|
||||||
|
|
||||||
r = uv_pipe_chmod(&pipe_handle, UV_WRITABLE);
|
r = uv_pipe_chmod(&pipe_handle, UV_WRITABLE);
|
||||||
ASSERT(r == 0);
|
ASSERT(r == 0);
|
||||||
|
#ifndef _WIN32
|
||||||
|
stat(TEST_PIPENAME, &stat_buf);
|
||||||
|
ASSERT(stat_buf.st_mode & S_IWUSR);
|
||||||
|
ASSERT(stat_buf.st_mode & S_IWGRP);
|
||||||
|
ASSERT(stat_buf.st_mode & S_IWOTH);
|
||||||
|
#endif
|
||||||
|
|
||||||
r = uv_pipe_chmod(&pipe_handle, UV_WRITABLE | UV_READABLE);
|
r = uv_pipe_chmod(&pipe_handle, UV_WRITABLE | UV_READABLE);
|
||||||
ASSERT(r == 0);
|
ASSERT(r == 0);
|
||||||
|
#ifndef _WIN32
|
||||||
|
stat(TEST_PIPENAME, &stat_buf);
|
||||||
|
ASSERT(stat_buf.st_mode & S_IRUSR);
|
||||||
|
ASSERT(stat_buf.st_mode & S_IRGRP);
|
||||||
|
ASSERT(stat_buf.st_mode & S_IROTH);
|
||||||
|
ASSERT(stat_buf.st_mode & S_IWUSR);
|
||||||
|
ASSERT(stat_buf.st_mode & S_IWGRP);
|
||||||
|
ASSERT(stat_buf.st_mode & S_IWOTH);
|
||||||
|
#endif
|
||||||
|
|
||||||
r = uv_pipe_chmod(NULL, UV_WRITABLE | UV_READABLE);
|
r = uv_pipe_chmod(NULL, UV_WRITABLE | UV_READABLE);
|
||||||
ASSERT(r == UV_EBADF);
|
ASSERT(r == UV_EBADF);
|
||||||
|
2
deps/uv/test/test-udp-ipv6.c
vendored
2
deps/uv/test/test-udp-ipv6.c
vendored
@ -174,6 +174,8 @@ TEST_IMPL(udp_dual_stack) {
|
|||||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__)
|
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__)
|
||||||
if (!can_ipv6_ipv4_dual())
|
if (!can_ipv6_ipv4_dual())
|
||||||
RETURN_SKIP("IPv6-IPv4 dual stack not supported");
|
RETURN_SKIP("IPv6-IPv4 dual stack not supported");
|
||||||
|
#elif defined(__OpenBSD__)
|
||||||
|
RETURN_SKIP("IPv6-IPv4 dual stack not supported");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
do_test(ipv6_recv_ok, 0);
|
do_test(ipv6_recv_ok, 0);
|
||||||
|
3
deps/uv/test/test-udp-multicast-join6.c
vendored
3
deps/uv/test/test-udp-multicast-join6.c
vendored
@ -123,7 +123,8 @@ TEST_IMPL(udp_multicast_join6) {
|
|||||||
defined(_AIX) || \
|
defined(_AIX) || \
|
||||||
defined(__MVS__) || \
|
defined(__MVS__) || \
|
||||||
defined(__FreeBSD_kernel__) || \
|
defined(__FreeBSD_kernel__) || \
|
||||||
defined(__NetBSD__)
|
defined(__NetBSD__) || \
|
||||||
|
defined(__OpenBSD__)
|
||||||
r = uv_udp_set_membership(&client, "ff02::1", "::1%lo0", UV_JOIN_GROUP);
|
r = uv_udp_set_membership(&client, "ff02::1", "::1%lo0", UV_JOIN_GROUP);
|
||||||
#else
|
#else
|
||||||
r = uv_udp_set_membership(&client, "ff02::1", NULL, UV_JOIN_GROUP);
|
r = uv_udp_set_membership(&client, "ff02::1", NULL, UV_JOIN_GROUP);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user