diff options
author | Bert Belder <bertbelder@gmail.com> | 2013-09-05 16:49:47 +0200 |
---|---|---|
committer | Bert Belder <bertbelder@gmail.com> | 2013-09-05 16:50:47 +0200 |
commit | 6301613ff57c0be81f9b9e0592ac15b6102daace (patch) | |
tree | ab9ac10abafddfee0e319c4eba1307c733cbd810 | |
parent | 8b05206665aa38475a4dd76cd313c53360f4e946 (diff) | |
download | node-6301613ff57c0be81f9b9e0592ac15b6102daace.tar.gz |
uv: upgrade to v0.10.16
-rw-r--r-- | deps/uv/ChangeLog | 19 | ||||
-rw-r--r-- | deps/uv/src/version.c | 2 | ||||
-rw-r--r-- | deps/uv/src/win/fs.c | 104 | ||||
-rw-r--r-- | deps/uv/src/win/pipe.c | 10 | ||||
-rw-r--r-- | deps/uv/src/win/process-stdio.c | 15 |
5 files changed, 100 insertions, 50 deletions
diff --git a/deps/uv/ChangeLog b/deps/uv/ChangeLog index 45e308fb2..bcfc1dfff 100644 --- a/deps/uv/ChangeLog +++ b/deps/uv/ChangeLog @@ -1,4 +1,21 @@ -2013.08.24, Version 0.10.15 (Stable) +2013.09.06, Version 0.10.16 (Stable) + +Changes since version 0.10.15: + +* windows: make uv_shutdown() for write-only pipes work (Bert Belder) + +* windows: make uv_fs_open() report EINVAL when invalid arguments are passed + (Bert Belder) + +* windows: make uv_fs_open() report _open_osfhandle() failure correctly (Bert + Belder) + +* windows: make uv_fs_chmod() report errors correctly (Bert Belder) + +* windows: wrap multi-statement macros in do..while block (Bert Belder) + + +2013.08.24, Version 0.10.15 (Stable), 221078a8fdd9b853c6b557b3d9a5dd744b4fdd6b Changes since version 0.10.14: diff --git a/deps/uv/src/version.c b/deps/uv/src/version.c index 98442a65a..1cd43837e 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 15 +#define UV_VERSION_PATCH 16 #define UV_VERSION_IS_RELEASE 1 diff --git a/deps/uv/src/win/fs.c b/deps/uv/src/win/fs.c index e78bc1b80..7f3704e8a 100644 --- a/deps/uv/src/win/fs.c +++ b/deps/uv/src/win/fs.c @@ -41,33 +41,41 @@ #define QUEUE_FS_TP_JOB(loop, req) \ - if (!QueueUserWorkItem(&uv_fs_thread_proc, \ - req, \ - WT_EXECUTEDEFAULT)) { \ - uv__set_sys_error((loop), GetLastError()); \ - return -1; \ - } \ - uv__req_register(loop, req); + do { \ + if (!QueueUserWorkItem(&uv_fs_thread_proc, \ + req, \ + WT_EXECUTEDEFAULT)) { \ + uv__set_sys_error((loop), GetLastError()); \ + return -1; \ + } \ + uv__req_register(loop, req); \ + } while (0) #define SET_UV_LAST_ERROR_FROM_REQ(req) \ - uv__set_error(req->loop, req->errorno, req->sys_errno_); + uv__set_error(req->loop, req->errorno, req->sys_errno_) #define SET_REQ_RESULT(req, result_value) \ - req->result = (result_value); \ - if (req->result == -1) { \ - req->sys_errno_ = _doserrno; \ - req->errorno = uv_translate_sys_error(req->sys_errno_); \ - } + do { \ + req->result = (result_value); \ + if (req->result == -1) { \ + req->sys_errno_ = _doserrno; \ + req->errorno = uv_translate_sys_error(req->sys_errno_); \ + } \ + } while (0) #define SET_REQ_WIN32_ERROR(req, sys_errno) \ - req->result = -1; \ - req->sys_errno_ = (sys_errno); \ - req->errorno = uv_translate_sys_error(req->sys_errno_); + do { \ + req->result = -1; \ + req->sys_errno_ = (sys_errno); \ + req->errorno = uv_translate_sys_error(req->sys_errno_); \ + } while (0) #define SET_REQ_UV_ERROR(req, uv_errno, sys_errno) \ - req->result = -1; \ - req->sys_errno_ = (sys_errno); \ - req->errorno = (uv_errno); + do { \ + req->result = -1; \ + req->sys_errno_ = (sys_errno); \ + req->errorno = (uv_errno); \ + } while (0) #define VERIFY_FD(fd, req) \ if (fd == -1) { \ @@ -78,7 +86,7 @@ } #define FILETIME_TO_TIME_T(filetime) \ - ((*((uint64_t*) &(filetime)) - 116444736000000000ULL) / 10000000ULL); + ((*((uint64_t*) &(filetime)) - 116444736000000000ULL) / 10000000ULL) #define TIME_T_TO_FILETIME(time, filetime_ptr) \ do { \ @@ -392,7 +400,7 @@ void fs__open(uv_fs_t* req) { DWORD disposition; DWORD attributes = 0; HANDLE file; - int result, current_umask; + int fd, current_umask; int flags = req->file_flags; /* Obtain the active umask. umask() never fails and returns the previous */ @@ -413,8 +421,7 @@ void fs__open(uv_fs_t* req) { access = FILE_GENERIC_READ | FILE_GENERIC_WRITE; break; default: - result = -1; - goto end; + goto einval; } if (flags & _O_APPEND) { @@ -451,8 +458,7 @@ void fs__open(uv_fs_t* req) { disposition = CREATE_ALWAYS; break; default: - result = -1; - goto end; + goto einval; } attributes |= FILE_ATTRIBUTE_NORMAL; @@ -481,8 +487,7 @@ void fs__open(uv_fs_t* req) { attributes |= FILE_FLAG_RANDOM_ACCESS; break; default: - result = -1; - goto end; + goto einval; } /* Setting this flag makes it possible to open a directory. */ @@ -507,11 +512,30 @@ void fs__open(uv_fs_t* req) { } return; } - result = _open_osfhandle((intptr_t) file, flags); -end: - SET_REQ_RESULT(req, result); + + fd = _open_osfhandle((intptr_t) file, flags); + if (fd < 0) { + /* The only known failure mode for _open_osfhandle() is EMFILE, in which + * case GetLastError() will return zero. However we'll try to handle other + * errors as well, should they ever occur. + */ + if (errno == EMFILE) + SET_REQ_UV_ERROR(req, UV_EMFILE, ERROR_TOO_MANY_OPEN_FILES); + else if (GetLastError() != ERROR_SUCCESS) + SET_REQ_WIN32_ERROR(req, GetLastError()); + else + SET_REQ_WIN32_ERROR(req, UV_UNKNOWN); + return; + } + + SET_REQ_RESULT(req, fd); + return; + + einval: + SET_REQ_UV_ERROR(req, UV_EINVAL, ERROR_INVALID_PARAMETER); } + void fs__close(uv_fs_t* req) { int fd = req->fd; int result; @@ -1062,7 +1086,6 @@ static void fs__chmod(uv_fs_t* req) { static void fs__fchmod(uv_fs_t* req) { int fd = req->fd; - int result; HANDLE handle; NTSTATUS nt_status; IO_STATUS_BLOCK io_status; @@ -1070,7 +1093,7 @@ static void fs__fchmod(uv_fs_t* req) { VERIFY_FD(fd, req); - handle = (HANDLE)_get_osfhandle(fd); + handle = (HANDLE) _get_osfhandle(fd); nt_status = pNtQueryInformationFile(handle, &io_status, @@ -1078,9 +1101,9 @@ static void fs__fchmod(uv_fs_t* req) { sizeof file_info, FileBasicInformation); - if (nt_status != STATUS_SUCCESS) { - result = -1; - goto done; + if (!NT_SUCCESS(nt_status)) { + SET_REQ_WIN32_ERROR(req, pRtlNtStatusToDosError(nt_status)); + return; } if (req->mode & _S_IWRITE) { @@ -1095,15 +1118,12 @@ static void fs__fchmod(uv_fs_t* req) { sizeof file_info, FileBasicInformation); - if (nt_status != STATUS_SUCCESS) { - result = -1; - goto done; + if (!NT_SUCCESS(nt_status)) { + SET_REQ_WIN32_ERROR(req, pRtlNtStatusToDosError(nt_status)); + return; } - result = 0; - -done: - SET_REQ_RESULT(req, result); + SET_REQ_SUCCESS(req); } diff --git a/deps/uv/src/win/pipe.c b/deps/uv/src/win/pipe.c index 0fb70eae3..fd7418d73 100644 --- a/deps/uv/src/win/pipe.c +++ b/deps/uv/src/win/pipe.c @@ -1528,9 +1528,9 @@ void uv_process_pipe_shutdown_req(uv_loop_t* loop, uv_pipe_t* handle, UNREGISTER_HANDLE_REQ(loop, handle, req); - /* Initialize and optionally start the eof timer. */ - /* This makes no sense if we've already seen EOF. */ if (handle->flags & UV_HANDLE_READABLE) { + /* Initialize and optionally start the eof timer. Only do this if the */ + /* pipe is readable and we haven't seen EOF come in ourselves. */ eof_timer_init(handle); /* If reading start the timer right now. */ @@ -1538,6 +1538,12 @@ void uv_process_pipe_shutdown_req(uv_loop_t* loop, uv_pipe_t* handle, if (handle->flags & UV_HANDLE_READ_PENDING) { eof_timer_start(handle); } + + } else { + /* This pipe is not readable. We can just close it to let the other end */ + /* know that we're done writing. */ + CloseHandle(handle->handle); + handle->handle = INVALID_HANDLE_VALUE; } if (req->cb) { diff --git a/deps/uv/src/win/process-stdio.c b/deps/uv/src/win/process-stdio.c index 89e2cd990..e9cf84dac 100644 --- a/deps/uv/src/win/process-stdio.c +++ b/deps/uv/src/win/process-stdio.c @@ -104,12 +104,16 @@ static uv_err_t uv__create_stdio_pipe_pair(uv_loop_t* loop, uv_err_t err; if (flags & UV_READABLE_PIPE) { - server_access |= PIPE_ACCESS_OUTBOUND; + /* The server needs inbound access too, otherwise CreateNamedPipe() */ + /* won't give us the FILE_READ_ATTRIBUTES permission. We need that to */ + /* probe the state of the write buffer when we're trying to shutdown */ + /* the pipe. */ + server_access |= PIPE_ACCESS_OUTBOUND | PIPE_ACCESS_INBOUND; client_access |= GENERIC_READ | FILE_WRITE_ATTRIBUTES; } if (flags & UV_WRITABLE_PIPE) { server_access |= PIPE_ACCESS_INBOUND; - client_access |= GENERIC_WRITE; + client_access |= GENERIC_WRITE | FILE_READ_ATTRIBUTES; } /* Create server pipe handle. */ @@ -163,8 +167,11 @@ static uv_err_t uv__create_stdio_pipe_pair(uv_loop_t* loop, } } - /* The server end is now readable and writable. */ - server_pipe->flags |= UV_HANDLE_READABLE | UV_HANDLE_WRITABLE; + /* The server end is now readable and/or writable. */ + if (flags & UV_READABLE_PIPE) + server_pipe->flags |= UV_HANDLE_WRITABLE; + if (flags & UV_WRITABLE_PIPE) + server_pipe->flags |= UV_HANDLE_READABLE; *child_pipe_ptr = child_pipe; return uv_ok_; |