mirror of
https://github.com/nodejs/node.git
synced 2026-11-21 12:59:16 -05:00
deps: upgrade libuv to 9b61939
This commit is contained in:
1 parent
3dd7938c03
commit
e47a3e3ff4
5 files changed
+98
-16
No files matched your search
Vendored
+3
-3
@@ -18,17 +18,17 @@
|
||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
# IN THE SOFTWARE.
|
||||
|
||||
OS ?= $(shell sh -c 'uname -s | tr "[A-Z]" "[a-z]"')
|
||||
PLATFORM ?= $(shell sh -c 'uname -s | tr "[A-Z]" "[a-z]"')
|
||||
|
||||
CPPFLAGS += -I$(SRCDIR)/include -I$(SRCDIR)/include/uv-private
|
||||
|
||||
ifeq (darwin,$(OS))
|
||||
ifeq (darwin,$(PLATFORM))
|
||||
SOEXT = dylib
|
||||
else
|
||||
SOEXT = so
|
||||
endif
|
||||
|
||||
ifneq (,$(findstring mingw,$(OS)))
|
||||
ifneq (,$(findstring mingw,$(PLATFORM)))
|
||||
include $(SRCDIR)/config-mingw.mk
|
||||
else
|
||||
include $(SRCDIR)/config-unix.mk
|
||||
|
||||
Vendored
+10
-10
@@ -54,7 +54,7 @@ OBJS += src/fs-poll.o
|
||||
OBJS += src/uv-common.o
|
||||
OBJS += src/inet.o
|
||||
|
||||
ifeq (sunos,$(OS))
|
||||
ifeq (sunos,$(PLATFORM))
|
||||
CPPFLAGS += -D__EXTENSIONS__ -D_XOPEN_SOURCE=500
|
||||
LDFLAGS+=-lkstat -lnsl -lsendfile -lsocket
|
||||
# Library dependencies are not transitive.
|
||||
@@ -62,13 +62,13 @@ RUNNER_LDFLAGS += $(LDFLAGS)
|
||||
OBJS += src/unix/sunos.o
|
||||
endif
|
||||
|
||||
ifeq (aix,$(OS))
|
||||
ifeq (aix,$(PLATFORM))
|
||||
CPPFLAGS += -D_ALL_SOURCE -D_XOPEN_SOURCE=500
|
||||
LDFLAGS+= -lperfstat
|
||||
OBJS += src/unix/aix.o
|
||||
endif
|
||||
|
||||
ifeq (darwin,$(OS))
|
||||
ifeq (darwin,$(PLATFORM))
|
||||
CPPFLAGS += -D_DARWIN_USE_64_BIT_INODE=1
|
||||
LDFLAGS += -framework Foundation \
|
||||
-framework CoreServices \
|
||||
@@ -82,7 +82,7 @@ OBJS += src/unix/proctitle.o
|
||||
OBJS += src/unix/darwin-proctitle.o
|
||||
endif
|
||||
|
||||
ifeq (linux,$(OS))
|
||||
ifeq (linux,$(PLATFORM))
|
||||
CSTDFLAG += -D_GNU_SOURCE
|
||||
LDFLAGS+=-ldl -lrt
|
||||
RUNNER_CFLAGS += -D_GNU_SOURCE
|
||||
@@ -92,38 +92,38 @@ OBJS += src/unix/linux-core.o \
|
||||
src/unix/proctitle.o
|
||||
endif
|
||||
|
||||
ifeq (freebsd,$(OS))
|
||||
ifeq (freebsd,$(PLATFORM))
|
||||
LDFLAGS+=-lkvm
|
||||
OBJS += src/unix/freebsd.o
|
||||
OBJS += src/unix/kqueue.o
|
||||
endif
|
||||
|
||||
ifeq (dragonfly,$(OS))
|
||||
ifeq (dragonfly,$(PLATFORM))
|
||||
LDFLAGS+=-lkvm
|
||||
OBJS += src/unix/freebsd.o
|
||||
OBJS += src/unix/kqueue.o
|
||||
endif
|
||||
|
||||
ifeq (netbsd,$(OS))
|
||||
ifeq (netbsd,$(PLATFORM))
|
||||
LDFLAGS+=-lkvm
|
||||
OBJS += src/unix/netbsd.o
|
||||
OBJS += src/unix/kqueue.o
|
||||
endif
|
||||
|
||||
ifeq (openbsd,$(OS))
|
||||
ifeq (openbsd,$(PLATFORM))
|
||||
LDFLAGS+=-lkvm
|
||||
OBJS += src/unix/openbsd.o
|
||||
OBJS += src/unix/kqueue.o
|
||||
endif
|
||||
|
||||
ifneq (,$(findstring cygwin,$(OS)))
|
||||
ifneq (,$(findstring cygwin,$(PLATFORM)))
|
||||
# We drop the --std=c89, it hides CLOCK_MONOTONIC on cygwin
|
||||
CSTDFLAG = -D_GNU_SOURCE
|
||||
LDFLAGS+=
|
||||
OBJS += src/unix/cygwin.o
|
||||
endif
|
||||
|
||||
ifeq (sunos,$(OS))
|
||||
ifeq (sunos,$(PLATFORM))
|
||||
RUNNER_LDFLAGS += -pthreads
|
||||
else
|
||||
RUNNER_LDFLAGS += -pthread
|
||||
|
||||
Vendored
+16
-2
@@ -21,6 +21,8 @@
|
||||
#include "uv.h"
|
||||
#include "internal.h"
|
||||
#include <assert.h>
|
||||
#include <limits.h>
|
||||
|
||||
|
||||
static int uv__timer_cmp(const uv_timer_t* a, const uv_timer_t* b) {
|
||||
if (a->timeout < b->timeout)
|
||||
@@ -45,6 +47,7 @@ RB_GENERATE_STATIC(uv__timers, uv_timer_s, tree_entry, uv__timer_cmp)
|
||||
int uv_timer_init(uv_loop_t* loop, uv_timer_t* handle) {
|
||||
uv__handle_init(loop, (uv_handle_t*)handle, UV_TIMER);
|
||||
handle->timer_cb = NULL;
|
||||
handle->repeat = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -54,11 +57,17 @@ int uv_timer_start(uv_timer_t* handle,
|
||||
uv_timer_cb cb,
|
||||
uint64_t timeout,
|
||||
uint64_t repeat) {
|
||||
uint64_t clamped_timeout;
|
||||
|
||||
if (uv__is_active(handle))
|
||||
uv_timer_stop(handle);
|
||||
|
||||
clamped_timeout = handle->loop->time + timeout;
|
||||
if (clamped_timeout < timeout)
|
||||
clamped_timeout = (uint64_t) -1;
|
||||
|
||||
handle->timer_cb = cb;
|
||||
handle->timeout = handle->loop->time + timeout;
|
||||
handle->timeout = clamped_timeout;
|
||||
handle->repeat = repeat;
|
||||
/* start_id is the second index to be compared in uv__timer_cmp() */
|
||||
handle->start_id = handle->loop->timer_counter++;
|
||||
@@ -106,6 +115,7 @@ uint64_t uv_timer_get_repeat(const uv_timer_t* handle) {
|
||||
|
||||
int uv__next_timeout(const uv_loop_t* loop) {
|
||||
const uv_timer_t* handle;
|
||||
uint64_t diff;
|
||||
|
||||
/* RB_MIN expects a non-const tree root. That's okay, it doesn't modify it. */
|
||||
handle = RB_MIN(uv__timers, (struct uv__timers*) &loop->timer_handles);
|
||||
@@ -116,7 +126,11 @@ int uv__next_timeout(const uv_loop_t* loop) {
|
||||
if (handle->timeout <= loop->time)
|
||||
return 0;
|
||||
|
||||
return handle->timeout - loop->time;
|
||||
diff = handle->timeout - loop->time;
|
||||
if (diff > INT_MAX)
|
||||
diff = INT_MAX;
|
||||
|
||||
return diff;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Vendored
+6
@@ -95,9 +95,12 @@ TEST_DECLARE (shutdown_eof)
|
||||
TEST_DECLARE (callback_stack)
|
||||
TEST_DECLARE (error_message)
|
||||
TEST_DECLARE (timer)
|
||||
TEST_DECLARE (timer_init)
|
||||
TEST_DECLARE (timer_again)
|
||||
TEST_DECLARE (timer_start_twice)
|
||||
TEST_DECLARE (timer_order)
|
||||
TEST_DECLARE (timer_huge_timeout)
|
||||
TEST_DECLARE (timer_huge_repeat)
|
||||
TEST_DECLARE (idle_starvation)
|
||||
TEST_DECLARE (loop_handles)
|
||||
TEST_DECLARE (get_loadavg)
|
||||
@@ -336,9 +339,12 @@ TASK_LIST_START
|
||||
TEST_ENTRY (error_message)
|
||||
|
||||
TEST_ENTRY (timer)
|
||||
TEST_ENTRY (timer_init)
|
||||
TEST_ENTRY (timer_again)
|
||||
TEST_ENTRY (timer_start_twice)
|
||||
TEST_ENTRY (timer_order)
|
||||
TEST_ENTRY (timer_huge_timeout)
|
||||
TEST_ENTRY (timer_huge_repeat)
|
||||
|
||||
TEST_ENTRY (idle_starvation)
|
||||
|
||||
|
||||
Vendored
+63
-1
@@ -28,8 +28,10 @@ static int once_close_cb_called = 0;
|
||||
static int repeat_cb_called = 0;
|
||||
static int repeat_close_cb_called = 0;
|
||||
static int order_cb_called = 0;
|
||||
|
||||
static uint64_t start_time;
|
||||
static uv_timer_t tiny_timer;
|
||||
static uv_timer_t huge_timer1;
|
||||
static uv_timer_t huge_timer2;
|
||||
|
||||
|
||||
static void once_close_cb(uv_handle_t* handle) {
|
||||
@@ -156,6 +158,18 @@ TEST_IMPL(timer_start_twice) {
|
||||
}
|
||||
|
||||
|
||||
TEST_IMPL(timer_init) {
|
||||
uv_timer_t handle;
|
||||
|
||||
ASSERT(0 == uv_timer_init(uv_default_loop(), &handle));
|
||||
ASSERT(0 == uv_timer_get_repeat(&handle));
|
||||
ASSERT(!uv_is_active((uv_handle_t*)&handle));
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void order_cb_a(uv_timer_t *handle, int status) {
|
||||
ASSERT(order_cb_called++ == *(int*)handle->data);
|
||||
}
|
||||
@@ -200,5 +214,53 @@ TEST_IMPL(timer_order) {
|
||||
|
||||
ASSERT(order_cb_called == 2);
|
||||
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void tiny_timer_cb(uv_timer_t* handle, int status) {
|
||||
ASSERT(handle == &tiny_timer);
|
||||
uv_close((uv_handle_t*) &tiny_timer, NULL);
|
||||
uv_close((uv_handle_t*) &huge_timer1, NULL);
|
||||
uv_close((uv_handle_t*) &huge_timer2, NULL);
|
||||
}
|
||||
|
||||
|
||||
TEST_IMPL(timer_huge_timeout) {
|
||||
ASSERT(0 == uv_timer_init(uv_default_loop(), &tiny_timer));
|
||||
ASSERT(0 == uv_timer_init(uv_default_loop(), &huge_timer1));
|
||||
ASSERT(0 == uv_timer_init(uv_default_loop(), &huge_timer2));
|
||||
ASSERT(0 == uv_timer_start(&tiny_timer, tiny_timer_cb, 1, 0));
|
||||
ASSERT(0 == uv_timer_start(&huge_timer1, tiny_timer_cb, 0xffffffffffffLL, 0));
|
||||
ASSERT(0 == uv_timer_start(&huge_timer2, tiny_timer_cb, (uint64_t) -1, 0));
|
||||
ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_DEFAULT));
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void huge_repeat_cb(uv_timer_t* handle, int status) {
|
||||
static int ncalls;
|
||||
|
||||
if (ncalls == 0)
|
||||
ASSERT(handle == &huge_timer1);
|
||||
else
|
||||
ASSERT(handle == &tiny_timer);
|
||||
|
||||
if (++ncalls == 10) {
|
||||
uv_close((uv_handle_t*) &tiny_timer, NULL);
|
||||
uv_close((uv_handle_t*) &huge_timer1, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TEST_IMPL(timer_huge_repeat) {
|
||||
ASSERT(0 == uv_timer_init(uv_default_loop(), &tiny_timer));
|
||||
ASSERT(0 == uv_timer_init(uv_default_loop(), &huge_timer1));
|
||||
ASSERT(0 == uv_timer_start(&tiny_timer, huge_repeat_cb, 2, 2));
|
||||
ASSERT(0 == uv_timer_start(&huge_timer1, huge_repeat_cb, 1, (uint64_t) -1));
|
||||
ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_DEFAULT));
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user