From 1e34c85082c7abc0f0d19694f9ff3779cbdc1241 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Fri, 18 Nov 2011 14:05:35 +0100 Subject: [PATCH] uv: upgrade to b297d36 --- deps/uv/config-unix.mk | 1 + deps/uv/src/unix/kqueue.c | 1 + deps/uv/src/win/handle.c | 2 +- deps/uv/test/test-fs-event.c | 42 +++++++++++++++++++++++++++++++++++- deps/uv/test/test-list.h | 2 ++ deps/uv/uv.gyp | 3 +++ 6 files changed, 49 insertions(+), 2 deletions(-) diff --git a/deps/uv/config-unix.mk b/deps/uv/config-unix.mk index 8fe7254cfdd..759be4e041f 100644 --- a/deps/uv/config-unix.mk +++ b/deps/uv/config-unix.mk @@ -50,6 +50,7 @@ endif ifeq (Darwin,$(uname_S)) EV_CONFIG=config_darwin.h EIO_CONFIG=config_darwin.h +CPPFLAGS += -D__DARWIN_64_BIT_INO_T=1 CPPFLAGS += -Isrc/ares/config_darwin LINKFLAGS+=-framework CoreServices OBJS += src/unix/darwin.o diff --git a/deps/uv/src/unix/kqueue.c b/deps/uv/src/unix/kqueue.c index 00180cd41d3..ad80a26fbb0 100644 --- a/deps/uv/src/unix/kqueue.c +++ b/deps/uv/src/unix/kqueue.c @@ -116,6 +116,7 @@ int uv_fs_event_init(uv_loop_t* loop, void uv__fs_event_destroy(uv_fs_event_t* handle) { + uv__fs_event_stop(handle); free(handle->filename); uv__close(handle->fd); handle->fd = -1; diff --git a/deps/uv/src/win/handle.c b/deps/uv/src/win/handle.c index b67139cbc6a..ba0af755fe7 100644 --- a/deps/uv/src/win/handle.c +++ b/deps/uv/src/win/handle.c @@ -35,7 +35,7 @@ uv_handle_type uv_guess_handle(uv_file file) { if (GetConsoleMode(handle, &mode)) { return UV_TTY; } else { - return UV_UNKNOWN_HANDLE; + return UV_FILE; } case FILE_TYPE_PIPE: diff --git a/deps/uv/test/test-fs-event.c b/deps/uv/test/test-fs-event.c index c1f23fe996a..59bdebc0320 100644 --- a/deps/uv/test/test-fs-event.c +++ b/deps/uv/test/test-fs-event.c @@ -267,4 +267,44 @@ TEST_IMPL(fs_event_no_callback_on_close) { r = uv_fs_rmdir(loop, &fs_req, "watch_dir", NULL); return 0; -} \ No newline at end of file +} + + +static void fs_event_fail(uv_fs_event_t* handle, const char* filename, + int events, int status) { + ASSERT(0 && "should never be called"); +} + + +static void timer_cb(uv_timer_t* handle, int status) { + int r; + + ASSERT(status == 0); + + r = uv_fs_event_init(handle->loop, &fs_event, ".", fs_event_fail, 0); + ASSERT(r != -1); + + uv_close((uv_handle_t*)&fs_event, close_cb); + uv_close((uv_handle_t*)handle, close_cb); +} + + +TEST_IMPL(fs_event_immediate_close) { + uv_timer_t timer; + uv_loop_t* loop; + int r; + + loop = uv_default_loop(); + + r = uv_timer_init(loop, &timer); + ASSERT(r == 0); + + r = uv_timer_start(&timer, timer_cb, 1, 0); + ASSERT(r == 0); + + uv_run(loop); + + ASSERT(close_cb_called == 2); + + return 0; +} diff --git a/deps/uv/test/test-list.h b/deps/uv/test/test-list.h index 9051fdb35ce..d6639df031e 100644 --- a/deps/uv/test/test-list.h +++ b/deps/uv/test/test-list.h @@ -110,6 +110,7 @@ TEST_DECLARE (fs_event_watch_dir) TEST_DECLARE (fs_event_watch_file) TEST_DECLARE (fs_event_watch_file_current_dir) TEST_DECLARE (fs_event_no_callback_on_close) +TEST_DECLARE (fs_event_immediate_close) TEST_DECLARE (fs_readdir_empty_dir) TEST_DECLARE (fs_readdir_file) TEST_DECLARE (fs_open_dir) @@ -261,6 +262,7 @@ TASK_LIST_START TEST_ENTRY (fs_event_watch_file) TEST_ENTRY (fs_event_watch_file_current_dir) TEST_ENTRY (fs_event_no_callback_on_close) + TEST_ENTRY (fs_event_immediate_close) TEST_ENTRY (fs_readdir_empty_dir) TEST_ENTRY (fs_readdir_file) TEST_ENTRY (fs_open_dir) diff --git a/deps/uv/uv.gyp b/deps/uv/uv.gyp index 83129b5c956..88cee32b44e 100644 --- a/deps/uv/uv.gyp +++ b/deps/uv/uv.gyp @@ -9,6 +9,9 @@ 'EIO_STACKSIZE=262144' ], 'conditions': [ + ['OS=="mac"', { + 'defines': ['__DARWIN_64_BIT_INO_T=1'], + }], ['OS=="solaris"', { 'cflags': ['-pthreads'], 'ldlags': ['-pthreads'],