From 8bac8857f5c60e3af1a986f55912ce507b6135ba Mon Sep 17 00:00:00 2001 From: isaacs Date: Tue, 9 Jul 2013 13:20:38 -0700 Subject: [PATCH] uv: Upgrade to v0.10.12 --- deps/uv/AUTHORS | 1 + deps/uv/ChangeLog | 19 ++++++++- deps/uv/build.mk | 7 +--- deps/uv/checksparse.sh | 2 +- deps/uv/common.gypi | 1 + deps/uv/config-unix.mk | 9 +++- deps/uv/gyp_uv | 1 + deps/uv/src/unix/linux-core.c | 21 ++++++---- deps/uv/src/unix/thread.c | 2 +- deps/uv/src/version.c | 2 +- deps/uv/src/win/process.c | 2 +- deps/uv/src/win/tcp.c | 6 +-- deps/uv/test/test-fs.c | 3 +- deps/uv/test/test-list.h | 2 + deps/uv/test/test-timer-from-check.c | 80 ++++++++++++++++++++++++++++++++++++ deps/uv/test/test-tty.c | 4 +- deps/uv/uv.gyp | 1 + 17 files changed, 139 insertions(+), 24 deletions(-) create mode 100644 deps/uv/test/test-timer-from-check.c diff --git a/deps/uv/AUTHORS b/deps/uv/AUTHORS index 2172b03..119773a 100644 --- a/deps/uv/AUTHORS +++ b/deps/uv/AUTHORS @@ -84,3 +84,4 @@ Nicholas Vavilov Miroslav Bajtoš Elliot Saba Wynn Wilkes +Andrei Sedoi diff --git a/deps/uv/ChangeLog b/deps/uv/ChangeLog index f62839e..ab36a28 100644 --- a/deps/uv/ChangeLog +++ b/deps/uv/ChangeLog @@ -1,4 +1,21 @@ -2013.06.13, Version 0.10.11 (Stable) +2013.07.10, Version 0.10.12 (Stable) + +Changes since version 0.10.11: + +* linux: add support for MIPS (Andrei Sedoi) + +* windows: uv_spawn shouldn't reject reparse points (Bert Belder) + +* windows: use WSAGetLastError(), not errno (Ben Noordhuis) + +* build: darwin: disable -fstrict-aliasing warnings (Ben Noordhuis) + +* build: `all` now builds static and dynamic lib (Ben Noordhuis) + +* unix: fix build when !defined(PTHREAD_MUTEX_ERRORCHECK) (Ben Noordhuis) + + +2013.06.13, Version 0.10.11 (Stable), c3b75406a66a10222a589cb173e8f469e9665c7e Changes since version 0.10.10: diff --git a/deps/uv/build.mk b/deps/uv/build.mk index 5ff713e..6cba169 100644 --- a/deps/uv/build.mk +++ b/deps/uv/build.mk @@ -130,6 +130,7 @@ TESTS= \ test/test-threadpool.o \ test/test-threadpool-cancel.o \ test/test-timer-again.o \ + test/test-timer-from-check.o \ test/test-timer.o \ test/test-tty.o \ test/test-udp-dgram-too-big.o \ @@ -142,7 +143,7 @@ TESTS= \ test/test-util.o \ test/test-walk-handles.o \ -all: libuv.a +.PHONY: all bench clean clean-platform distclean test run-tests$(E): test/run-tests.o test/runner.o $(RUNNER_SRC) $(TESTS) libuv.a $(CC) $(CPPFLAGS) $(RUNNER_CFLAGS) -o $@ $^ $(RUNNER_LIBS) $(RUNNER_LDFLAGS) @@ -152,10 +153,6 @@ run-benchmarks$(E): test/run-benchmarks.o test/runner.o $(RUNNER_SRC) $(BENCHMAR test/echo.o: test/echo.c test/echo.h - -.PHONY: clean clean-platform distclean test bench - - test: run-tests$(E) $(CURDIR)/$< diff --git a/deps/uv/checksparse.sh b/deps/uv/checksparse.sh index f06b27d..7412c21 100755 --- a/deps/uv/checksparse.sh +++ b/deps/uv/checksparse.sh @@ -222,7 +222,7 @@ SunOS) ;; esac -for ARCH in __i386__ __x86_64__ __arm__; do +for ARCH in __i386__ __x86_64__ __arm__ __mips__; do $SPARSE $SPARSE_FLAGS -D$ARCH=1 $SOURCES done diff --git a/deps/uv/common.gypi b/deps/uv/common.gypi index c346282..67291fd 100644 --- a/deps/uv/common.gypi +++ b/deps/uv/common.gypi @@ -36,6 +36,7 @@ }, 'xcode_settings': { 'GCC_OPTIMIZATION_LEVEL': '0', + 'OTHER_CFLAGS': [ '-Wno-strict-aliasing' ], }, 'conditions': [ ['OS != "win"', { diff --git a/deps/uv/config-unix.mk b/deps/uv/config-unix.mk index 9088730..d230bb2 100644 --- a/deps/uv/config-unix.mk +++ b/deps/uv/config-unix.mk @@ -29,7 +29,7 @@ CPPFLAGS += -D_FILE_OFFSET_BITS=64 RUNNER_SRC=test/runner-unix.c RUNNER_CFLAGS=$(CFLAGS) -I$(SRCDIR)/test -RUNNER_LDFLAGS=-L"$(CURDIR)" -luv +RUNNER_LDFLAGS= DTRACE_OBJS= DTRACE_HEADER= @@ -159,6 +159,13 @@ endif RUNNER_LDFLAGS += $(LDFLAGS) +all: + # Force a sequential build of the static and the shared library. + # Works around a make quirk where it forgets to (re)build either + # the *.o or *.pic.o files, depending on what target comes first. + $(MAKE) -f $(SRCDIR)/Makefile libuv.a + $(MAKE) -f $(SRCDIR)/Makefile libuv.$(SOEXT) + libuv.a: $(OBJS) $(AR) rcs $@ $^ diff --git a/deps/uv/gyp_uv b/deps/uv/gyp_uv index ab59451..651bd09 100755 --- a/deps/uv/gyp_uv +++ b/deps/uv/gyp_uv @@ -24,6 +24,7 @@ def host_arch(): if machine == 'i386': return 'ia32' if machine == 'x86_64': return 'x64' if machine.startswith('arm'): return 'arm' + if machine.startswith('mips'): return 'mips' return machine # Return as-is and hope for the best. diff --git a/deps/uv/src/unix/linux-core.c b/deps/uv/src/unix/linux-core.c index 13765ae..e4c34a1 100644 --- a/deps/uv/src/unix/linux-core.c +++ b/deps/uv/src/unix/linux-core.c @@ -427,7 +427,7 @@ static int read_models(unsigned int numcpus, uv_cpu_info_t* ci) { char* model; FILE* fp; - /* Most are unused on non-ARM and non-x86 architectures. */ + /* Most are unused on non-ARM, non-MIPS and non-x86 architectures. */ (void) &model_marker; (void) &speed_marker; (void) &speed_idx; @@ -438,7 +438,10 @@ static int read_models(unsigned int numcpus, uv_cpu_info_t* ci) { model_idx = 0; speed_idx = 0; -#if defined(__arm__) || defined(__i386__) || defined(__x86_64__) +#if defined(__arm__) || \ + defined(__i386__) || \ + defined(__mips__) || \ + defined(__x86_64__) fp = fopen("/proc/cpuinfo", "r"); if (fp == NULL) return -1; @@ -456,10 +459,14 @@ static int read_models(unsigned int numcpus, uv_cpu_info_t* ci) { continue; } } -#if defined(__arm__) - /* Fallback for pre-3.8 kernels. */ +#if defined(__arm__) || defined(__mips__) if (model_idx < numcpus) { +#if defined(__arm__) + /* Fallback for pre-3.8 kernels. */ static const char model_marker[] = "Processor\t: "; +#else /* defined(__mips__) */ + static const char model_marker[] = "cpu model\t\t: "; +#endif if (strncmp(buf, model_marker, sizeof(model_marker) - 1) == 0) { model = buf + sizeof(model_marker) - 1; model = strndup(model, strlen(model) - 1); /* Strip newline. */ @@ -471,18 +478,18 @@ static int read_models(unsigned int numcpus, uv_cpu_info_t* ci) { continue; } } -#else /* !__arm____ */ +#else /* !__arm__ && !__mips__ */ if (speed_idx < numcpus) { if (strncmp(buf, speed_marker, sizeof(speed_marker) - 1) == 0) { ci[speed_idx++].speed = atoi(buf + sizeof(speed_marker) - 1); continue; } } -#endif /* __arm__ */ +#endif /* __arm__ || __mips__ */ } fclose(fp); -#endif /* __arm__ || __i386__ || __x86_64__ */ +#endif /* __arm__ || __i386__ || __mips__ || __x86_64__ */ /* Now we want to make sure that all the models contain *something* because * it's not safe to leave them as null. Copy the last entry unless there diff --git a/deps/uv/src/unix/thread.c b/deps/uv/src/unix/thread.c index e44a77f..4d59e93 100644 --- a/deps/uv/src/unix/thread.c +++ b/deps/uv/src/unix/thread.c @@ -42,7 +42,7 @@ int uv_thread_join(uv_thread_t *tid) { int uv_mutex_init(uv_mutex_t* mutex) { -#ifdef NDEBUG +#if defined(NDEBUG) || !defined(PTHREAD_MUTEX_ERRORCHECK) if (pthread_mutex_init(mutex, NULL)) return -1; else diff --git a/deps/uv/src/version.c b/deps/uv/src/version.c index 248ff28..d4ee15e 100644 --- a/deps/uv/src/version.c +++ b/deps/uv/src/version.c @@ -34,7 +34,7 @@ #define UV_VERSION_MAJOR 0 #define UV_VERSION_MINOR 10 -#define UV_VERSION_PATCH 11 +#define UV_VERSION_PATCH 12 #define UV_VERSION_IS_RELEASE 1 diff --git a/deps/uv/src/win/process.c b/deps/uv/src/win/process.c index f98767a..fb445b6 100644 --- a/deps/uv/src/win/process.c +++ b/deps/uv/src/win/process.c @@ -225,7 +225,7 @@ static WCHAR* search_path_join_test(const WCHAR* dir, attrs = GetFileAttributesW(result); if (attrs != INVALID_FILE_ATTRIBUTES && - !(attrs & (FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_REPARSE_POINT))) { + !(attrs & FILE_ATTRIBUTE_DIRECTORY)) { return result; } diff --git a/deps/uv/src/win/tcp.c b/deps/uv/src/win/tcp.c index c3ef653..59a36de 100644 --- a/deps/uv/src/win/tcp.c +++ b/deps/uv/src/win/tcp.c @@ -50,7 +50,7 @@ static int uv__tcp_nodelay(uv_tcp_t* handle, SOCKET socket, int enable) { TCP_NODELAY, (const char*)&enable, sizeof enable) == -1) { - uv__set_sys_error(handle->loop, errno); + uv__set_sys_error(handle->loop, WSAGetLastError()); return -1; } return 0; @@ -63,7 +63,7 @@ static int uv__tcp_keepalive(uv_tcp_t* handle, SOCKET socket, int enable, unsign SO_KEEPALIVE, (const char*)&enable, sizeof enable) == -1) { - uv__set_sys_error(handle->loop, errno); + uv__set_sys_error(handle->loop, WSAGetLastError()); return -1; } @@ -72,7 +72,7 @@ static int uv__tcp_keepalive(uv_tcp_t* handle, SOCKET socket, int enable, unsign TCP_KEEPALIVE, (const char*)&delay, sizeof delay) == -1) { - uv__set_sys_error(handle->loop, errno); + uv__set_sys_error(handle->loop, WSAGetLastError()); return -1; } diff --git a/deps/uv/test/test-fs.c b/deps/uv/test/test-fs.c index 0016b3b..ca2ff2b 100644 --- a/deps/uv/test/test-fs.c +++ b/deps/uv/test/test-fs.c @@ -1391,7 +1391,8 @@ TEST_IMPL(fs_symlink_dir) { #ifdef _WIN32 ASSERT(((struct stat*)req.ptr)->st_size == strlen(test_dir + 4)); #else - ASSERT(((struct stat*)req.ptr)->st_size == strlen(test_dir)); + /* st_size has type off_t. Cast to avoid signed/unsigned warnings. */ + ASSERT((size_t) ((struct stat*)req.ptr)->st_size == strlen(test_dir)); #endif uv_fs_req_cleanup(&req); diff --git a/deps/uv/test/test-list.h b/deps/uv/test/test-list.h index 4c01585..7a9b1a2 100644 --- a/deps/uv/test/test-list.h +++ b/deps/uv/test/test-list.h @@ -101,6 +101,7 @@ TEST_DECLARE (timer_start_twice) TEST_DECLARE (timer_order) TEST_DECLARE (timer_huge_timeout) TEST_DECLARE (timer_huge_repeat) +TEST_DECLARE (timer_from_check) TEST_DECLARE (idle_starvation) TEST_DECLARE (loop_handles) TEST_DECLARE (get_loadavg) @@ -348,6 +349,7 @@ TASK_LIST_START TEST_ENTRY (timer_order) TEST_ENTRY (timer_huge_timeout) TEST_ENTRY (timer_huge_repeat) + TEST_ENTRY (timer_from_check) TEST_ENTRY (idle_starvation) diff --git a/deps/uv/test/test-timer-from-check.c b/deps/uv/test/test-timer-from-check.c new file mode 100644 index 0000000..2aa3fe4 --- /dev/null +++ b/deps/uv/test/test-timer-from-check.c @@ -0,0 +1,80 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +static uv_prepare_t prepare_handle; +static uv_check_t check_handle; +static uv_timer_t timer_handle; + +static int prepare_cb_called; +static int check_cb_called; +static int timer_cb_called; + + +static void prepare_cb(uv_prepare_t* handle, int status) { + ASSERT(0 == uv_prepare_stop(&prepare_handle)); + ASSERT(0 == prepare_cb_called); + ASSERT(1 == check_cb_called); + ASSERT(0 == timer_cb_called); + prepare_cb_called++; +} + + +static void timer_cb(uv_timer_t* handle, int status) { + ASSERT(0 == uv_timer_stop(&timer_handle)); + ASSERT(1 == prepare_cb_called); + ASSERT(1 == check_cb_called); + ASSERT(0 == timer_cb_called); + timer_cb_called++; +} + + +static void check_cb(uv_check_t* handle, int status) { + ASSERT(0 == uv_check_stop(&check_handle)); + ASSERT(0 == uv_timer_stop(&timer_handle)); /* Runs before timer_cb. */ + ASSERT(0 == uv_timer_start(&timer_handle, timer_cb, 50, 0)); + ASSERT(0 == uv_prepare_start(&prepare_handle, prepare_cb)); + ASSERT(0 == prepare_cb_called); + ASSERT(0 == check_cb_called); + ASSERT(0 == timer_cb_called); + check_cb_called++; +} + + +TEST_IMPL(timer_from_check) { + ASSERT(0 == uv_prepare_init(uv_default_loop(), &prepare_handle)); + ASSERT(0 == uv_check_init(uv_default_loop(), &check_handle)); + ASSERT(0 == uv_check_start(&check_handle, check_cb)); + ASSERT(0 == uv_timer_init(uv_default_loop(), &timer_handle)); + ASSERT(0 == uv_timer_start(&timer_handle, timer_cb, 50, 0)); + ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_DEFAULT)); + ASSERT(1 == prepare_cb_called); + ASSERT(1 == check_cb_called); + ASSERT(1 == timer_cb_called); + uv_close((uv_handle_t*) &prepare_handle, NULL); + uv_close((uv_handle_t*) &check_handle, NULL); + uv_close((uv_handle_t*) &timer_handle, NULL); + ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_ONCE)); + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/deps/uv/test/test-tty.c b/deps/uv/test/test-tty.c index f3003ef..c26f7fa 100644 --- a/deps/uv/test/test-tty.c +++ b/deps/uv/test/test-tty.c @@ -81,10 +81,10 @@ TEST_IMPL(tty) { ASSERT(UV_TTY == uv_guess_handle(ttyin_fd)); ASSERT(UV_TTY == uv_guess_handle(ttyout_fd)); - r = uv_tty_init(uv_default_loop(), &tty_in, ttyin_fd, 1); + r = uv_tty_init(uv_default_loop(), &tty_in, ttyin_fd, 1); /* Readable. */ ASSERT(r == 0); - r = uv_tty_init(uv_default_loop(), &tty_out, ttyout_fd, 2); + r = uv_tty_init(uv_default_loop(), &tty_out, ttyout_fd, 0); /* Writable. */ ASSERT(r == 0); r = uv_tty_get_winsize(&tty_out, &width, &height); diff --git a/deps/uv/uv.gyp b/deps/uv/uv.gyp index 54c771e..f61ebb5 100644 --- a/deps/uv/uv.gyp +++ b/deps/uv/uv.gyp @@ -353,6 +353,7 @@ 'test/test-barrier.c', 'test/test-condvar.c', 'test/test-timer-again.c', + 'test/test-timer-from-check.c', 'test/test-timer.c', 'test/test-tty.c', 'test/test-udp-dgram-too-big.c', -- 2.7.4