summaryrefslogtreecommitdiff
path: root/deps/uv
diff options
context:
space:
mode:
authorIgor Zinkovsky <igorzi@microsoft.com>2012-04-05 17:10:39 -0700
committerIgor Zinkovsky <igorzi@microsoft.com>2012-04-05 17:10:39 -0700
commitf178f2ae3fc6cd24221e8b9548902e18c63ab8e4 (patch)
tree313a7fc21abd189e852aeb192160472b3776898b /deps/uv
parent052aaa4c4dbb52c9430b609cdfe81fc942a7df64 (diff)
downloadnode-new-f178f2ae3fc6cd24221e8b9548902e18c63ab8e4.tar.gz
upgrade libuv to d68b3d960b6d95bfc16027cecca2f3fa48bcc36f
Diffstat (limited to 'deps/uv')
-rw-r--r--deps/uv/include/uv.h9
-rw-r--r--deps/uv/src/unix/fs.c31
-rw-r--r--deps/uv/src/win/error.c1
-rw-r--r--deps/uv/src/win/fs-event.c13
-rw-r--r--deps/uv/src/win/fs.c88
-rw-r--r--deps/uv/src/win/pipe.c5
-rw-r--r--deps/uv/src/win/tcp.c3
-rw-r--r--deps/uv/src/win/udp.c7
-rw-r--r--deps/uv/test/test-fs-event.c106
-rw-r--r--deps/uv/test/test-fs.c35
-rw-r--r--deps/uv/test/test-list.h6
-rw-r--r--deps/uv/test/test-pipe-connect-error.c28
-rw-r--r--deps/uv/uv.gyp1
13 files changed, 292 insertions, 41 deletions
diff --git a/deps/uv/include/uv.h b/deps/uv/include/uv.h
index 49ce47a952..ed6100aebf 100644
--- a/deps/uv/include/uv.h
+++ b/deps/uv/include/uv.h
@@ -1155,12 +1155,18 @@ UV_EXTERN int uv_fs_open(uv_loop_t* loop, uv_fs_t* req, const char* path,
UV_EXTERN int uv_fs_read(uv_loop_t* loop, uv_fs_t* req, uv_file file,
void* buf, size_t length, off_t offset, uv_fs_cb cb);
+int uv_fs_read64(uv_loop_t* loop, uv_fs_t* req, uv_file file,
+ void* buf, size_t length, int64_t offset, uv_fs_cb cb);
+
UV_EXTERN int uv_fs_unlink(uv_loop_t* loop, uv_fs_t* req, const char* path,
uv_fs_cb cb);
UV_EXTERN int uv_fs_write(uv_loop_t* loop, uv_fs_t* req, uv_file file,
void* buf, size_t length, off_t offset, uv_fs_cb cb);
+int uv_fs_write64(uv_loop_t* loop, uv_fs_t* req, uv_file file,
+ void* buf, size_t length, int64_t offset, uv_fs_cb cb);
+
UV_EXTERN int uv_fs_mkdir(uv_loop_t* loop, uv_fs_t* req, const char* path,
int mode, uv_fs_cb cb);
@@ -1188,6 +1194,9 @@ UV_EXTERN int uv_fs_fdatasync(uv_loop_t* loop, uv_fs_t* req, uv_file file,
UV_EXTERN int uv_fs_ftruncate(uv_loop_t* loop, uv_fs_t* req, uv_file file,
off_t offset, uv_fs_cb cb);
+int uv_fs_ftruncate64(uv_loop_t* loop, uv_fs_t* req, uv_file file,
+ int64_t offset, uv_fs_cb cb);
+
UV_EXTERN int uv_fs_sendfile(uv_loop_t* loop, uv_fs_t* req, uv_file out_fd,
uv_file in_fd, off_t in_offset, size_t length, uv_fs_cb cb);
diff --git a/deps/uv/src/unix/fs.c b/deps/uv/src/unix/fs.c
index 436e54c680..ddcb8b5d78 100644
--- a/deps/uv/src/unix/fs.c
+++ b/deps/uv/src/unix/fs.c
@@ -701,3 +701,34 @@ int uv_queue_work(uv_loop_t* loop, uv_work_t* req, uv_work_cb work_cb,
return 0;
}
+
+
+int uv_fs_read64(uv_loop_t* loop,
+ uv_fs_t* req,
+ uv_file file,
+ void* buf,
+ size_t length,
+ int64_t offset,
+ uv_fs_cb cb) {
+ return uv_fs_read(loop, req, file, buf, length, offset, cb);
+}
+
+
+int uv_fs_write64(uv_loop_t* loop,
+ uv_fs_t* req,
+ uv_file file,
+ void* buf,
+ size_t length,
+ int64_t offset,
+ uv_fs_cb cb) {
+ return uv_fs_write(loop, req, file, buf, length, offset, cb);
+}
+
+
+int uv_fs_ftruncate64(uv_loop_t* loop,
+ uv_fs_t* req,
+ uv_file file,
+ int64_t offset,
+ uv_fs_cb cb) {
+ return uv_fs_ftruncate(loop, req, file, offset, cb);
+}
diff --git a/deps/uv/src/win/error.c b/deps/uv/src/win/error.c
index dccd2e7189..7bdc3cda39 100644
--- a/deps/uv/src/win/error.c
+++ b/deps/uv/src/win/error.c
@@ -125,6 +125,7 @@ uv_err_code uv_translate_sys_error(int sys_errno) {
case ERROR_SEM_TIMEOUT: return UV_ETIMEDOUT;
case WSAETIMEDOUT: return UV_ETIMEDOUT;
case WSAHOST_NOT_FOUND: return UV_ENOENT;
+ case WSAENOTSOCK: return UV_ENOTSOCK;
default: return UV_UNKNOWN;
}
}
diff --git a/deps/uv/src/win/fs-event.c b/deps/uv/src/win/fs-event.c
index 5a25e9d647..3b37c75218 100644
--- a/deps/uv/src/win/fs-event.c
+++ b/deps/uv/src/win/fs-event.c
@@ -301,6 +301,13 @@ void uv_process_fs_event_req(uv_loop_t* loop, uv_req_t* req,
assert(handle->req_pending);
handle->req_pending = 0;
+ /* If we're closing, don't report any callbacks, and just push the handle */
+ /* onto the endgame queue. */
+ if (handle->flags & UV_HANDLE_CLOSING) {
+ uv_want_endgame(loop, (uv_handle_t*) handle);
+ return;
+ };
+
file_info = (FILE_NOTIFY_INFORMATION*)(handle->buffer + offset);
if (REQ_SUCCESS(req)) {
@@ -438,11 +445,9 @@ void uv_process_fs_event_req(uv_loop_t* loop, uv_req_t* req,
}
offset = file_info->NextEntryOffset;
- } while(offset);
+ } while (offset && !(handle->flags & UV_HANDLE_CLOSING));
} else {
- if (!(handle->flags & UV_HANDLE_CLOSING)) {
- handle->cb(handle, NULL, UV_CHANGE, 0);
- }
+ handle->cb(handle, NULL, UV_CHANGE, 0);
}
} else {
uv__set_sys_error(loop, GET_REQ_ERROR(req));
diff --git a/deps/uv/src/win/fs.c b/deps/uv/src/win/fs.c
index 507336eed4..daa23ed19d 100644
--- a/deps/uv/src/win/fs.c
+++ b/deps/uv/src/win/fs.c
@@ -33,12 +33,11 @@
#include "uv.h"
#include "internal.h"
-#define UV_FS_ASYNC_QUEUED 0x0001
-#define UV_FS_FREE_ARG0 0x0002
-#define UV_FS_FREE_ARG1 0x0004
-#define UV_FS_FREE_PTR 0x0008
-#define UV_FS_CLEANEDUP 0x0010
-
+#define UV_FS_ASYNC_QUEUED 0x0001
+#define UV_FS_FREE_ARG0 0x0002
+#define UV_FS_FREE_ARG1 0x0004
+#define UV_FS_FREE_PTR 0x0008
+#define UV_FS_CLEANEDUP 0x0010
#define UTF8_TO_UTF16(s, t) \
size = uv_utf8_to_utf16(s, NULL, 0) * sizeof(wchar_t); \
@@ -289,7 +288,7 @@ void fs__close(uv_fs_t* req, uv_file file) {
void fs__read(uv_fs_t* req, uv_file file, void *buf, size_t length,
- off_t offset) {
+ int64_t offset) {
HANDLE handle;
OVERLAPPED overlapped, *overlapped_ptr;
LARGE_INTEGER offset_;
@@ -335,7 +334,7 @@ void fs__read(uv_fs_t* req, uv_file file, void *buf, size_t length,
void fs__write(uv_fs_t* req, uv_file file, void *buf, size_t length,
- off_t offset) {
+ int64_t offset) {
HANDLE handle;
OVERLAPPED overlapped, *overlapped_ptr;
LARGE_INTEGER offset_;
@@ -597,12 +596,12 @@ void fs__fsync(uv_fs_t* req, uv_file file) {
}
-void fs__ftruncate(uv_fs_t* req, uv_file file, off_t offset) {
+void fs__ftruncate(uv_fs_t* req, uv_file file, int64_t offset) {
int result;
VERIFY_UV_FILE(file, req);
- result = _chsize(file, offset);
+ result = _chsize_s(file, offset);
SET_REQ_RESULT(req, result);
}
@@ -878,14 +877,14 @@ static DWORD WINAPI uv_fs_thread_proc(void* parameter) {
(uv_file) req->arg0,
req->arg1,
(size_t) req->arg2,
- (off_t) req->arg3);
+ req->stat.st_atime);
break;
case UV_FS_WRITE:
fs__write(req,
(uv_file)req->arg0,
req->arg1,
(size_t) req->arg2,
- (off_t) req->arg3);
+ req->stat.st_atime);
break;
case UV_FS_UNLINK:
fs__unlink(req, req->pathw);
@@ -914,7 +913,7 @@ static DWORD WINAPI uv_fs_thread_proc(void* parameter) {
fs__fsync(req, (uv_file)req->arg0);
break;
case UV_FS_FTRUNCATE:
- fs__ftruncate(req, (uv_file)req->arg0, (off_t)req->arg1);
+ fs__ftruncate(req, (uv_file)req->arg0, (off_t)req->stat.st_atime);
break;
case UV_FS_SENDFILE:
fs__sendfile(req,
@@ -1002,7 +1001,26 @@ int uv_fs_read(uv_loop_t* loop, uv_fs_t* req, uv_file file, void* buf,
size_t length, off_t offset, uv_fs_cb cb) {
if (cb) {
uv_fs_req_init_async(loop, req, UV_FS_READ, NULL, NULL, cb);
- WRAP_REQ_ARGS4(req, file, buf, length, offset);
+ WRAP_REQ_ARGS3(req, file, buf, length);
+ req->stat.st_atime = offset;
+ QUEUE_FS_TP_JOB(loop, req);
+ } else {
+ uv_fs_req_init_sync(loop, req, UV_FS_READ);
+ fs__read(req, file, buf, length, offset);
+ SET_UV_LAST_ERROR_FROM_REQ(req);
+ return req->result;
+ }
+
+ return 0;
+}
+
+
+int uv_fs_read64(uv_loop_t* loop, uv_fs_t* req, uv_file file, void* buf,
+ size_t length, int64_t offset, uv_fs_cb cb) {
+ if (cb) {
+ uv_fs_req_init_async(loop, req, UV_FS_READ, NULL, NULL, cb);
+ WRAP_REQ_ARGS3(req, file, buf, length);
+ req->stat.st_atime = offset;
QUEUE_FS_TP_JOB(loop, req);
} else {
uv_fs_req_init_sync(loop, req, UV_FS_READ);
@@ -1019,7 +1037,26 @@ int uv_fs_write(uv_loop_t* loop, uv_fs_t* req, uv_file file, void* buf,
size_t length, off_t offset, uv_fs_cb cb) {
if (cb) {
uv_fs_req_init_async(loop, req, UV_FS_WRITE, NULL, NULL, cb);
- WRAP_REQ_ARGS4(req, file, buf, length, offset);
+ WRAP_REQ_ARGS3(req, file, buf, length);
+ req->stat.st_atime = offset;
+ QUEUE_FS_TP_JOB(loop, req);
+ } else {
+ uv_fs_req_init_sync(loop, req, UV_FS_WRITE);
+ fs__write(req, file, buf, length, offset);
+ SET_UV_LAST_ERROR_FROM_REQ(req);
+ return req->result;
+ }
+
+ return 0;
+}
+
+
+int uv_fs_write64(uv_loop_t* loop, uv_fs_t* req, uv_file file, void* buf,
+ size_t length, int64_t offset, uv_fs_cb cb) {
+ if (cb) {
+ uv_fs_req_init_async(loop, req, UV_FS_WRITE, NULL, NULL, cb);
+ WRAP_REQ_ARGS3(req, file, buf, length);
+ req->stat.st_atime = offset;
QUEUE_FS_TP_JOB(loop, req);
} else {
uv_fs_req_init_sync(loop, req, UV_FS_WRITE);
@@ -1412,7 +1449,26 @@ int uv_fs_ftruncate(uv_loop_t* loop, uv_fs_t* req, uv_file file,
off_t offset, uv_fs_cb cb) {
if (cb) {
uv_fs_req_init_async(loop, req, UV_FS_FTRUNCATE, NULL, NULL, cb);
- WRAP_REQ_ARGS2(req, file, offset);
+ WRAP_REQ_ARGS1(req, file);
+ req->stat.st_atime = offset;
+ QUEUE_FS_TP_JOB(loop, req);
+ } else {
+ uv_fs_req_init_sync(loop, req, UV_FS_FTRUNCATE);
+ fs__ftruncate(req, file, offset);
+ SET_UV_LAST_ERROR_FROM_REQ(req);
+ return req->result;
+ }
+
+ return 0;
+}
+
+
+int uv_fs_ftruncate64(uv_loop_t* loop, uv_fs_t* req, uv_file file,
+ int64_t offset, uv_fs_cb cb) {
+ if (cb) {
+ uv_fs_req_init_async(loop, req, UV_FS_FTRUNCATE, NULL, NULL, cb);
+ WRAP_REQ_ARGS1(req, file);
+ req->stat.st_atime = offset;
QUEUE_FS_TP_JOB(loop, req);
} else {
uv_fs_req_init_sync(loop, req, UV_FS_FTRUNCATE);
diff --git a/deps/uv/src/win/pipe.c b/deps/uv/src/win/pipe.c
index f99a32a9bc..83220a23b0 100644
--- a/deps/uv/src/win/pipe.c
+++ b/deps/uv/src/win/pipe.c
@@ -217,6 +217,11 @@ static int uv_set_pipe_handle(uv_loop_t* loop, uv_pipe_t* handle,
DWORD mode = PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT;
if (!SetNamedPipeHandleState(pipeHandle, &mode, NULL, NULL)) {
+ /* If this returns ERROR_INVALID_PARAMETER we probably opened something */
+ /* that is not a pipe. */
+ if (GetLastError() == ERROR_INVALID_PARAMETER) {
+ SetLastError(WSAENOTSOCK);
+ }
return -1;
}
diff --git a/deps/uv/src/win/tcp.c b/deps/uv/src/win/tcp.c
index 25ca26bdd2..71c5575f12 100644
--- a/deps/uv/src/win/tcp.c
+++ b/deps/uv/src/win/tcp.c
@@ -239,10 +239,9 @@ static int uv__bind(uv_tcp_t* handle,
int addrsize) {
DWORD err;
int r;
- SOCKET sock;
if (handle->socket == INVALID_SOCKET) {
- sock = socket(domain, SOCK_STREAM, 0);
+ SOCKET sock = socket(domain, SOCK_STREAM, 0);
if (sock == INVALID_SOCKET) {
uv__set_sys_error(handle->loop, WSAGetLastError());
return -1;
diff --git a/deps/uv/src/win/udp.c b/deps/uv/src/win/udp.c
index 18ae4a2c13..7c638e4540 100644
--- a/deps/uv/src/win/udp.c
+++ b/deps/uv/src/win/udp.c
@@ -167,7 +167,6 @@ static int uv__bind(uv_udp_t* handle,
int addrsize,
unsigned int flags) {
int r;
- SOCKET sock;
DWORD no = 0, yes = 1;
if ((flags & UV_UDP_IPV6ONLY) && domain != AF_INET6) {
@@ -177,7 +176,7 @@ static int uv__bind(uv_udp_t* handle,
}
if (handle->socket == INVALID_SOCKET) {
- sock = socket(domain, SOCK_DGRAM, 0);
+ SOCKET sock = socket(domain, SOCK_DGRAM, 0);
if (sock == INVALID_SOCKET) {
uv__set_sys_error(handle->loop, WSAGetLastError());
return -1;
@@ -196,14 +195,14 @@ static int uv__bind(uv_udp_t* handle,
/* TODO: how to handle errors? This may fail if there is no ipv4 stack */
/* available, or when run on XP/2003 which have no support for dualstack */
/* sockets. For now we're silently ignoring the error. */
- setsockopt(sock,
+ setsockopt(handle->socket,
IPPROTO_IPV6,
IPV6_V6ONLY,
(char*) &no,
sizeof no);
}
- r = setsockopt(sock,
+ r = setsockopt(handle->socket,
SOL_SOCKET,
SO_REUSEADDR,
(char*) &yes,
diff --git a/deps/uv/test/test-fs-event.c b/deps/uv/test/test-fs-event.c
index 7f02e68a77..f59a928f02 100644
--- a/deps/uv/test/test-fs-event.c
+++ b/deps/uv/test/test-fs-event.c
@@ -27,16 +27,16 @@
static uv_fs_event_t fs_event;
static uv_timer_t timer;
-static int timer_cb_called;
-static int close_cb_called;
-static int fs_event_cb_called;
-static int timer_cb_touch_called;
+static int timer_cb_called = 0;
+static int close_cb_called = 0;
+static int fs_event_cb_called = 0;
+static int timer_cb_touch_called = 0;
static void create_dir(uv_loop_t* loop, const char* name) {
int r;
uv_fs_t req;
r = uv_fs_mkdir(loop, &req, name, 0755, NULL);
- ASSERT(r == 0);
+ ASSERT(r == 0 || uv_last_error(loop).code == UV_EEXIST);
uv_fs_req_cleanup(&req);
}
@@ -117,7 +117,7 @@ static void timer_cb_dir(uv_timer_t* handle, int status) {
static void timer_cb_file(uv_timer_t* handle, int status) {
++timer_cb_called;
-
+
if (timer_cb_called == 1) {
touch_file(handle->loop, "watch_dir/file1");
} else {
@@ -271,7 +271,7 @@ TEST_IMPL(fs_event_no_callback_on_close) {
static void fs_event_fail(uv_fs_event_t* handle, const char* filename,
- int events, int status) {
+ int events, int status) {
ASSERT(0 && "should never be called");
}
@@ -308,3 +308,95 @@ TEST_IMPL(fs_event_immediate_close) {
return 0;
}
+
+
+TEST_IMPL(fs_event_close_with_pending_event) {
+ uv_loop_t* loop;
+ uv_fs_t fs_req;
+ int r;
+
+ loop = uv_default_loop();
+
+ create_dir(loop, "watch_dir");
+ create_file(loop, "watch_dir/file");
+
+ r = uv_fs_event_init(loop, &fs_event, "watch_dir", fs_event_fail, 0);
+ ASSERT(r == 0);
+
+ /* Generate an fs event. */
+ touch_file(loop, "watch_dir/file");
+
+ uv_close((uv_handle_t*)&fs_event, close_cb);
+
+ uv_run(loop);
+
+ ASSERT(close_cb_called == 1);
+
+ /* Clean up */
+ r = uv_fs_unlink(loop, &fs_req, "watch_dir/file", NULL);
+ ASSERT(r == 0);
+ r = uv_fs_rmdir(loop, &fs_req, "watch_dir", NULL);
+ ASSERT(r == 0);
+
+ return 0;
+}
+
+
+static void fs_event_cb_close(uv_fs_event_t* handle, const char* filename,
+ int events, int status) {
+ ASSERT(status == 0);
+
+ ASSERT(fs_event_cb_called < 3);
+ ++fs_event_cb_called;
+
+ if (fs_event_cb_called == 3) {
+ uv_close((uv_handle_t*) handle, close_cb);
+ }
+}
+
+
+TEST_IMPL(fs_event_close_in_callback) {
+ uv_loop_t* loop;
+ uv_fs_t fs_req;
+ int r;
+
+ loop = uv_default_loop();
+
+ create_dir(loop, "watch_dir");
+ create_file(loop, "watch_dir/file1");
+ create_file(loop, "watch_dir/file2");
+ create_file(loop, "watch_dir/file3");
+ create_file(loop, "watch_dir/file4");
+ create_file(loop, "watch_dir/file5");
+
+ r = uv_fs_event_init(loop, &fs_event, "watch_dir", fs_event_cb_close, 0);
+ ASSERT(r == 0);
+
+ /* Generate a couple of fs events. */
+ touch_file(loop, "watch_dir/file1");
+ touch_file(loop, "watch_dir/file2");
+ touch_file(loop, "watch_dir/file3");
+ touch_file(loop, "watch_dir/file4");
+ touch_file(loop, "watch_dir/file5");
+
+ uv_run(loop);
+
+ ASSERT(close_cb_called == 1);
+ ASSERT(fs_event_cb_called == 3);
+
+ /* Clean up */
+ r = uv_fs_unlink(loop, &fs_req, "watch_dir/file1", NULL);
+ ASSERT(r == 0);
+ r = uv_fs_unlink(loop, &fs_req, "watch_dir/file2", NULL);
+ ASSERT(r == 0);
+ r = uv_fs_unlink(loop, &fs_req, "watch_dir/file3", NULL);
+ ASSERT(r == 0);
+ r = uv_fs_unlink(loop, &fs_req, "watch_dir/file4", NULL);
+ ASSERT(r == 0);
+ r = uv_fs_unlink(loop, &fs_req, "watch_dir/file5", NULL);
+ ASSERT(r == 0);
+ r = uv_fs_rmdir(loop, &fs_req, "watch_dir", NULL);
+ ASSERT(r == 0);
+
+ return 0;
+}
diff --git a/deps/uv/test/test-fs.c b/deps/uv/test/test-fs.c
index 8dc7147310..73d013822d 100644
--- a/deps/uv/test/test-fs.c
+++ b/deps/uv/test/test-fs.c
@@ -249,6 +249,11 @@ static void read_cb(uv_fs_t* req) {
uv_fs_req_cleanup(req);
if (read_cb_count == 1) {
ASSERT(strcmp(buf, test_buf) == 0);
+ memset(buf, 0, sizeof(buf));
+ r = uv_fs_read64(loop, &read_req, open_req1.result, buf, sizeof(buf), 0,
+ read_cb);
+ } else if (read_cb_count == 2) {
+ ASSERT(strcmp(buf, test_buf) == 0);
r = uv_fs_ftruncate(loop, &ftruncate_req, open_req1.result, 7,
ftruncate_cb);
} else {
@@ -319,7 +324,13 @@ static void write_cb(uv_fs_t* req) {
ASSERT(req->result != -1);
write_cb_count++;
uv_fs_req_cleanup(req);
- r = uv_fs_fdatasync(loop, &fdatasync_req, open_req1.result, fdatasync_cb);
+
+ if (write_cb_count == 1) {
+ r = uv_fs_write64(loop, &write_req, open_req1.result, test_buf, sizeof(test_buf),
+ -1, write_cb);
+ } else {
+ r = uv_fs_fdatasync(loop, &fdatasync_req, open_req1.result, fdatasync_cb);
+ }
}
@@ -596,7 +607,7 @@ TEST_IMPL(fs_file_async) {
uv_run(loop);
ASSERT(create_cb_count == 1);
- ASSERT(write_cb_count == 1);
+ ASSERT(write_cb_count == 2);
ASSERT(fsync_cb_count == 1);
ASSERT(fdatasync_cb_count == 1);
ASSERT(close_cb_count == 1);
@@ -606,7 +617,7 @@ TEST_IMPL(fs_file_async) {
uv_run(loop);
ASSERT(create_cb_count == 1);
- ASSERT(write_cb_count == 1);
+ ASSERT(write_cb_count == 2);
ASSERT(close_cb_count == 1);
ASSERT(rename_cb_count == 1);
@@ -615,11 +626,11 @@ TEST_IMPL(fs_file_async) {
uv_run(loop);
ASSERT(open_cb_count == 1);
- ASSERT(read_cb_count == 1);
+ ASSERT(read_cb_count == 2);
ASSERT(close_cb_count == 2);
ASSERT(rename_cb_count == 1);
ASSERT(create_cb_count == 1);
- ASSERT(write_cb_count == 1);
+ ASSERT(write_cb_count == 2);
ASSERT(ftruncate_cb_count == 1);
r = uv_fs_open(loop, &open_req1, "test_file2", O_RDONLY, 0, open_cb);
@@ -627,12 +638,12 @@ TEST_IMPL(fs_file_async) {
uv_run(loop);
ASSERT(open_cb_count == 2);
- ASSERT(read_cb_count == 2);
+ ASSERT(read_cb_count == 3);
ASSERT(close_cb_count == 3);
ASSERT(rename_cb_count == 1);
ASSERT(unlink_cb_count == 1);
ASSERT(create_cb_count == 1);
- ASSERT(write_cb_count == 1);
+ ASSERT(write_cb_count == 2);
ASSERT(ftruncate_cb_count == 1);
/* Cleanup. */
@@ -681,6 +692,14 @@ TEST_IMPL(fs_file_sync) {
ASSERT(strcmp(buf, test_buf) == 0);
uv_fs_req_cleanup(&read_req);
+ memset(buf, 0, sizeof(buf));
+ r = uv_fs_read64(loop, &read_req, open_req1.result, buf, sizeof(buf), 0,
+ NULL);
+ ASSERT(r != -1);
+ ASSERT(read_req.result != -1);
+ ASSERT(strcmp(buf, test_buf) == 0);
+ uv_fs_req_cleanup(&read_req);
+
r = uv_fs_ftruncate(loop, &ftruncate_req, open_req1.result, 7, NULL);
ASSERT(r != -1);
ASSERT(ftruncate_req.result != -1);
@@ -899,7 +918,7 @@ TEST_IMPL(fs_fstat) {
file = req.result;
uv_fs_req_cleanup(&req);
- r = uv_fs_write(loop, &req, file, test_buf, sizeof(test_buf), -1, NULL);
+ r = uv_fs_write64(loop, &req, file, test_buf, sizeof(test_buf), -1, NULL);
ASSERT(r == sizeof(test_buf));
ASSERT(req.result == sizeof(test_buf));
uv_fs_req_cleanup(&req);
diff --git a/deps/uv/test/test-list.h b/deps/uv/test/test-list.h
index 9e5309c170..5aad6331e4 100644
--- a/deps/uv/test/test-list.h
+++ b/deps/uv/test/test-list.h
@@ -57,6 +57,7 @@ TEST_DECLARE (pipe_bind_error_addrnotavail)
TEST_DECLARE (pipe_bind_error_inval)
TEST_DECLARE (pipe_listen_without_bind)
TEST_DECLARE (pipe_connect_bad_name)
+TEST_DECLARE (pipe_connect_to_file)
TEST_DECLARE (connection_fail)
TEST_DECLARE (connection_fail_doesnt_auto_close)
TEST_DECLARE (shutdown_close_tcp)
@@ -131,6 +132,8 @@ 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_event_close_with_pending_event)
+TEST_DECLARE (fs_event_close_in_callback);
TEST_DECLARE (fs_readdir_empty_dir)
TEST_DECLARE (fs_readdir_file)
TEST_DECLARE (fs_open_dir)
@@ -153,6 +156,7 @@ HELPER_DECLARE (pipe_echo_server)
TASK_LIST_START
TEST_ENTRY (pipe_connect_bad_name)
+ TEST_ENTRY (pipe_connect_to_file)
TEST_ENTRY (tty)
TEST_ENTRY (stdio_over_pipes)
@@ -315,6 +319,8 @@ TASK_LIST_START
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_event_close_with_pending_event)
+ TEST_ENTRY (fs_event_close_in_callback)
TEST_ENTRY (fs_readdir_empty_dir)
TEST_ENTRY (fs_readdir_file)
TEST_ENTRY (fs_open_dir)
diff --git a/deps/uv/test/test-pipe-connect-error.c b/deps/uv/test/test-pipe-connect-error.c
index 2faa446148..4a6c5110fa 100644
--- a/deps/uv/test/test-pipe-connect-error.c
+++ b/deps/uv/test/test-pipe-connect-error.c
@@ -50,6 +50,15 @@ static void connect_cb(uv_connect_t* connect_req, int status) {
}
+static void connect_cb_file(uv_connect_t* connect_req, int status) {
+ ASSERT(status == -1);
+ ASSERT(uv_last_error(uv_default_loop()).code == UV_ENOTSOCK ||
+ uv_last_error(uv_default_loop()).code == UV_ECONNREFUSED);
+ uv_close((uv_handle_t*)connect_req->handle, close_cb);
+ connect_cb_called++;
+}
+
+
TEST_IMPL(pipe_connect_bad_name) {
uv_pipe_t client;
uv_connect_t req;
@@ -66,3 +75,22 @@ TEST_IMPL(pipe_connect_bad_name) {
return 0;
}
+
+
+TEST_IMPL(pipe_connect_to_file) {
+ const char* path = "test/fixtures/empty_file";
+ uv_pipe_t client;
+ uv_connect_t req;
+ int r;
+
+ r = uv_pipe_init(uv_default_loop(), &client, 0);
+ ASSERT(r == 0);
+ uv_pipe_connect(&req, &client, path, connect_cb_file);
+
+ uv_run(uv_default_loop());
+
+ ASSERT(close_cb_called == 1);
+ ASSERT(connect_cb_called == 1);
+
+ return 0;
+} \ No newline at end of file
diff --git a/deps/uv/uv.gyp b/deps/uv/uv.gyp
index 8151878fa5..0b33b114ed 100644
--- a/deps/uv/uv.gyp
+++ b/deps/uv/uv.gyp
@@ -208,6 +208,7 @@
],
},
'defines': [
+ '_DARWIN_USE_64_BIT_INODE=1',
'EV_CONFIG_H="config_darwin.h"',
'EIO_CONFIG_H="config_darwin.h"',
]