aboutsummaryrefslogtreecommitdiff
path: root/deps/uv/src/win
diff options
context:
space:
mode:
Diffstat (limited to 'deps/uv/src/win')
-rw-r--r--deps/uv/src/win/core.c6
-rw-r--r--deps/uv/src/win/fs-event.c29
-rw-r--r--deps/uv/src/win/fs.c18
-rw-r--r--deps/uv/src/win/internal.h10
-rw-r--r--deps/uv/src/win/pipe.c1
-rw-r--r--deps/uv/src/win/stream-inl.h10
-rw-r--r--deps/uv/src/win/tcp.c15
-rw-r--r--deps/uv/src/win/tty.c10
-rw-r--r--deps/uv/src/win/util.c50
9 files changed, 82 insertions, 67 deletions
diff --git a/deps/uv/src/win/core.c b/deps/uv/src/win/core.c
index 9ed4e824c6..5fa9b6666d 100644
--- a/deps/uv/src/win/core.c
+++ b/deps/uv/src/win/core.c
@@ -239,7 +239,7 @@ int uv_loop_init(uv_loop_t* loop) {
QUEUE_INIT(&loop->wq);
QUEUE_INIT(&loop->handle_queue);
- QUEUE_INIT(&loop->active_reqs);
+ loop->active_reqs.count = 0;
loop->active_handles = 0;
loop->pending_reqs_tail = NULL;
@@ -470,8 +470,8 @@ static void uv_poll_ex(uv_loop_t* loop, DWORD timeout) {
static int uv__loop_alive(const uv_loop_t* loop) {
- return loop->active_handles > 0 ||
- !QUEUE_EMPTY(&loop->active_reqs) ||
+ return uv__has_active_handles(loop) ||
+ uv__has_active_reqs(loop) ||
loop->endgame_handles != NULL;
}
diff --git a/deps/uv/src/win/fs-event.c b/deps/uv/src/win/fs-event.c
index 95f843ad08..14c9af9ad7 100644
--- a/deps/uv/src/win/fs-event.c
+++ b/deps/uv/src/win/fs-event.c
@@ -69,6 +69,7 @@ static void uv_relative_path(const WCHAR* filename,
size_t relpathlen;
size_t filenamelen = wcslen(filename);
size_t dirlen = wcslen(dir);
+ assert(!_wcsnicmp(filename, dir, dirlen));
if (dirlen > 0 && dir[dirlen - 1] == '\\')
dirlen--;
relpathlen = filenamelen - dirlen - 1;
@@ -151,11 +152,11 @@ int uv_fs_event_start(uv_fs_event_t* handle,
uv_fs_event_cb cb,
const char* path,
unsigned int flags) {
- int name_size, is_path_dir;
+ int name_size, is_path_dir, size;
DWORD attr, last_error;
WCHAR* dir = NULL, *dir_to_watch, *pathw = NULL;
WCHAR short_path_buffer[MAX_PATH];
- WCHAR* short_path;
+ WCHAR* short_path, *long_path;
if (uv__is_active(handle))
return UV_EINVAL;
@@ -197,6 +198,30 @@ int uv_fs_event_start(uv_fs_event_t* handle,
if (is_path_dir) {
/* path is a directory, so that's the directory that we will watch. */
+
+ /* Convert to long path. */
+ size = GetLongPathNameW(pathw, NULL, 0);
+
+ if (size) {
+ long_path = (WCHAR*)uv__malloc(size * sizeof(WCHAR));
+ if (!long_path) {
+ uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc");
+ }
+
+ size = GetLongPathNameW(pathw, long_path, size);
+ if (size) {
+ long_path[size] = '\0';
+ } else {
+ uv__free(long_path);
+ long_path = NULL;
+ }
+ }
+
+ if (long_path) {
+ uv__free(pathw);
+ pathw = long_path;
+ }
+
dir_to_watch = pathw;
} else {
/*
diff --git a/deps/uv/src/win/fs.c b/deps/uv/src/win/fs.c
index 6e0bdc7bb2..b07d47cf56 100644
--- a/deps/uv/src/win/fs.c
+++ b/deps/uv/src/win/fs.c
@@ -245,7 +245,6 @@ INLINE static void uv_fs_req_init(uv_loop_t* loop, uv_fs_t* req,
req->ptr = NULL;
req->path = NULL;
req->cb = cb;
- req->fs.info.bufs = NULL;
memset(&req->fs, 0, sizeof(req->fs));
}
@@ -435,6 +434,8 @@ void fs__open(uv_fs_t* req) {
access |= FILE_APPEND_DATA;
}
+ access |= FILE_WRITE_ATTRIBUTES;
+
/*
* Here is where we deviate significantly from what CRT's _open()
* does. We indiscriminately use all the sharing modes, to match
@@ -784,7 +785,9 @@ void fs__unlink(uv_fs_t* req) {
/* Remove read-only attribute */
FILE_BASIC_INFORMATION basic = { 0 };
- basic.FileAttributes = info.dwFileAttributes & ~(FILE_ATTRIBUTE_READONLY);
+ basic.FileAttributes = info.dwFileAttributes
+ & ~(FILE_ATTRIBUTE_READONLY)
+ | FILE_ATTRIBUTE_ARCHIVE;
status = pNtSetInformationFile(handle,
&iosb,
@@ -1391,6 +1394,12 @@ static void fs__copyfile(uv_fs_t* req) {
int overwrite;
flags = req->fs.info.file_flags;
+
+ if (flags & UV_FS_COPYFILE_FICLONE_FORCE) {
+ SET_REQ_UV_ERROR(req, UV_ENOSYS, ERROR_NOT_SUPPORTED);
+ return;
+ }
+
overwrite = flags & UV_FS_COPYFILE_EXCL;
if (CopyFileW(req->file.pathw, req->fs.info.new_pathw, overwrite) == 0) {
@@ -2335,8 +2344,11 @@ int uv_fs_copyfile(uv_loop_t* loop,
INIT(UV_FS_COPYFILE);
- if (flags & ~UV_FS_COPYFILE_EXCL)
+ if (flags & ~(UV_FS_COPYFILE_EXCL |
+ UV_FS_COPYFILE_FICLONE |
+ UV_FS_COPYFILE_FICLONE_FORCE)) {
return UV_EINVAL;
+ }
err = fs__capture_path(req, path, new_path, cb != NULL);
diff --git a/deps/uv/src/win/internal.h b/deps/uv/src/win/internal.h
index 217fcdb5d7..cce4e204d2 100644
--- a/deps/uv/src/win/internal.h
+++ b/deps/uv/src/win/internal.h
@@ -221,10 +221,16 @@ void uv_process_tty_read_req(uv_loop_t* loop, uv_tty_t* handle,
uv_req_t* req);
void uv_process_tty_write_req(uv_loop_t* loop, uv_tty_t* handle,
uv_write_t* req);
-/* TODO: remove me */
+/*
+ * uv_process_tty_accept_req() is a stub to keep DELEGATE_STREAM_REQ working
+ * TODO: find a way to remove it
+ */
void uv_process_tty_accept_req(uv_loop_t* loop, uv_tty_t* handle,
uv_req_t* raw_req);
-/* TODO: remove me */
+/*
+ * uv_process_tty_connect_req() is a stub to keep DELEGATE_STREAM_REQ working
+ * TODO: find a way to remove it
+ */
void uv_process_tty_connect_req(uv_loop_t* loop, uv_tty_t* handle,
uv_connect_t* req);
diff --git a/deps/uv/src/win/pipe.c b/deps/uv/src/win/pipe.c
index 1a7c4dc15e..0ecfbf1f0e 100644
--- a/deps/uv/src/win/pipe.c
+++ b/deps/uv/src/win/pipe.c
@@ -847,6 +847,7 @@ static void uv_pipe_queue_accept(uv_loop_t* loop, uv_pipe_t* handle,
return;
}
+ /* Wait for completion via IOCP */
handle->reqs_pending++;
}
diff --git a/deps/uv/src/win/stream-inl.h b/deps/uv/src/win/stream-inl.h
index dba0374704..40f5ddd51e 100644
--- a/deps/uv/src/win/stream-inl.h
+++ b/deps/uv/src/win/stream-inl.h
@@ -37,11 +37,6 @@ INLINE static void uv_stream_init(uv_loop_t* loop,
handle->write_queue_size = 0;
handle->activecnt = 0;
handle->stream.conn.shutdown_req = NULL;
-}
-
-
-INLINE static void uv_connection_init(uv_stream_t* handle) {
- handle->flags |= UV_HANDLE_CONNECTION;
handle->stream.conn.write_reqs_pending = 0;
UV_REQ_INIT(&handle->read_req, UV_READ);
@@ -51,4 +46,9 @@ INLINE static void uv_connection_init(uv_stream_t* handle) {
}
+INLINE static void uv_connection_init(uv_stream_t* handle) {
+ handle->flags |= UV_HANDLE_CONNECTION;
+}
+
+
#endif /* UV_WIN_STREAM_INL_H_ */
diff --git a/deps/uv/src/win/tcp.c b/deps/uv/src/win/tcp.c
index fd6efbaf89..39c1ff0565 100644
--- a/deps/uv/src/win/tcp.c
+++ b/deps/uv/src/win/tcp.c
@@ -459,8 +459,6 @@ static void uv_tcp_queue_accept(uv_tcp_t* handle, uv_tcp_accept_t* req) {
INFINITE, WT_EXECUTEINWAITTHREAD)) {
SET_REQ_ERROR(req, GetLastError());
uv_insert_pending_req(loop, (uv_req_t*)req);
- handle->reqs_pending++;
- return;
}
} else {
/* Make this req pending reporting an error. */
@@ -1173,11 +1171,14 @@ void uv_process_tcp_connect_req(uv_loop_t* loop, uv_tcp_t* handle,
err = 0;
if (REQ_SUCCESS(req)) {
- if (setsockopt(handle->socket,
- SOL_SOCKET,
- SO_UPDATE_CONNECT_CONTEXT,
- NULL,
- 0) == 0) {
+ if (handle->flags & UV__HANDLE_CLOSING) {
+ /* use UV_ECANCELED for consistency with Unix */
+ err = ERROR_OPERATION_ABORTED;
+ } else if (setsockopt(handle->socket,
+ SOL_SOCKET,
+ SO_UPDATE_CONNECT_CONTEXT,
+ NULL,
+ 0) == 0) {
uv_connection_init((uv_stream_t*)handle);
handle->flags |= UV_HANDLE_READABLE | UV_HANDLE_WRITABLE;
loop->active_tcp_streams++;
diff --git a/deps/uv/src/win/tty.c b/deps/uv/src/win/tty.c
index 05a11e8830..ecf7bc9b5b 100644
--- a/deps/uv/src/win/tty.c
+++ b/deps/uv/src/win/tty.c
@@ -2235,14 +2235,20 @@ void uv_tty_endgame(uv_loop_t* loop, uv_tty_t* handle) {
}
-/* TODO: remove me */
+/*
+ * uv_process_tty_accept_req() is a stub to keep DELEGATE_STREAM_REQ working
+ * TODO: find a way to remove it
+ */
void uv_process_tty_accept_req(uv_loop_t* loop, uv_tty_t* handle,
uv_req_t* raw_req) {
abort();
}
-/* TODO: remove me */
+/*
+ * uv_process_tty_connect_req() is a stub to keep DELEGATE_STREAM_REQ working
+ * TODO: find a way to remove it
+ */
void uv_process_tty_connect_req(uv_loop_t* loop, uv_tty_t* handle,
uv_connect_t* req) {
abort();
diff --git a/deps/uv/src/win/util.c b/deps/uv/src/win/util.c
index 3100bc23ad..3c1d9bed1d 100644
--- a/deps/uv/src/win/util.c
+++ b/deps/uv/src/win/util.c
@@ -1148,53 +1148,17 @@ int uv_getrusage(uv_rusage_t *uv_rusage) {
int uv_os_homedir(char* buffer, size_t* size) {
uv_passwd_t pwd;
- wchar_t path[MAX_PATH];
- DWORD bufsize;
size_t len;
int r;
- if (buffer == NULL || size == NULL || *size == 0)
- return UV_EINVAL;
-
- /* Check if the USERPROFILE environment variable is set first */
- len = GetEnvironmentVariableW(L"USERPROFILE", path, MAX_PATH);
-
- if (len == 0) {
- r = GetLastError();
-
- /* Don't return an error if USERPROFILE was not found */
- if (r != ERROR_ENVVAR_NOT_FOUND)
- return uv_translate_sys_error(r);
- } else if (len > MAX_PATH) {
- /* This should not be possible */
- return UV_EIO;
- } else {
- /* Check how much space we need */
- bufsize = WideCharToMultiByte(CP_UTF8, 0, path, -1, NULL, 0, NULL, NULL);
-
- if (bufsize == 0) {
- return uv_translate_sys_error(GetLastError());
- } else if (bufsize > *size) {
- *size = bufsize;
- return UV_ENOBUFS;
- }
-
- /* Convert to UTF-8 */
- bufsize = WideCharToMultiByte(CP_UTF8,
- 0,
- path,
- -1,
- buffer,
- *size,
- NULL,
- NULL);
-
- if (bufsize == 0)
- return uv_translate_sys_error(GetLastError());
+ /* Check if the USERPROFILE environment variable is set first. The task of
+ performing input validation on buffer and size is taken care of by
+ uv_os_getenv(). */
+ r = uv_os_getenv("USERPROFILE", buffer, size);
- *size = bufsize - 1;
- return 0;
- }
+ /* Don't return an error if USERPROFILE was not found. */
+ if (r != UV_ENOENT)
+ return r;
/* USERPROFILE is not set, so call uv__getpwuid_r() */
r = uv__getpwuid_r(&pwd);