libuv 1.43.0
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3735 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
6
deps/libuv/src/win/fs-event.c
vendored
6
deps/libuv/src/win/fs-event.c
vendored
@ -574,10 +574,10 @@ void uv_process_fs_event_req(uv_loop_t* loop, uv_req_t* req,
|
||||
handle->cb(handle, NULL, 0, uv_translate_sys_error(err));
|
||||
}
|
||||
|
||||
if (!(handle->flags & UV_HANDLE_CLOSING)) {
|
||||
uv_fs_event_queue_readdirchanges(loop, handle);
|
||||
} else {
|
||||
if (handle->flags & UV_HANDLE_CLOSING) {
|
||||
uv_want_endgame(loop, (uv_handle_t*)handle);
|
||||
} else if (uv__is_active(handle)) {
|
||||
uv_fs_event_queue_readdirchanges(loop, handle);
|
||||
}
|
||||
}
|
||||
|
||||
|
18
deps/libuv/src/win/fs.c
vendored
18
deps/libuv/src/win/fs.c
vendored
@ -758,7 +758,7 @@ void fs__read_filemap(uv_fs_t* req, struct uv__fd_info_s* fd_info) {
|
||||
void* view;
|
||||
|
||||
if (rw_flags == UV_FS_O_WRONLY) {
|
||||
SET_REQ_WIN32_ERROR(req, ERROR_ACCESS_DENIED);
|
||||
SET_REQ_WIN32_ERROR(req, ERROR_INVALID_FLAGS);
|
||||
return;
|
||||
}
|
||||
if (fd_info->is_directory) {
|
||||
@ -912,6 +912,11 @@ void fs__read(uv_fs_t* req) {
|
||||
SET_REQ_RESULT(req, bytes);
|
||||
} else {
|
||||
error = GetLastError();
|
||||
|
||||
if (error == ERROR_ACCESS_DENIED) {
|
||||
error = ERROR_INVALID_FLAGS;
|
||||
}
|
||||
|
||||
if (error == ERROR_HANDLE_EOF) {
|
||||
SET_REQ_RESULT(req, bytes);
|
||||
} else {
|
||||
@ -936,7 +941,7 @@ void fs__write_filemap(uv_fs_t* req, HANDLE file,
|
||||
FILETIME ft;
|
||||
|
||||
if (rw_flags == UV_FS_O_RDONLY) {
|
||||
SET_REQ_WIN32_ERROR(req, ERROR_ACCESS_DENIED);
|
||||
SET_REQ_WIN32_ERROR(req, ERROR_INVALID_FLAGS);
|
||||
return;
|
||||
}
|
||||
if (fd_info->is_directory) {
|
||||
@ -1052,6 +1057,7 @@ void fs__write(uv_fs_t* req) {
|
||||
OVERLAPPED overlapped, *overlapped_ptr;
|
||||
LARGE_INTEGER offset_;
|
||||
DWORD bytes;
|
||||
DWORD error;
|
||||
int result;
|
||||
unsigned int index;
|
||||
LARGE_INTEGER original_position;
|
||||
@ -1111,7 +1117,13 @@ void fs__write(uv_fs_t* req) {
|
||||
if (result || bytes > 0) {
|
||||
SET_REQ_RESULT(req, bytes);
|
||||
} else {
|
||||
SET_REQ_WIN32_ERROR(req, GetLastError());
|
||||
error = GetLastError();
|
||||
|
||||
if (error == ERROR_ACCESS_DENIED) {
|
||||
error = ERROR_INVALID_FLAGS;
|
||||
}
|
||||
|
||||
SET_REQ_WIN32_ERROR(req, error);
|
||||
}
|
||||
}
|
||||
|
||||
|
2
deps/libuv/src/win/pipe.c
vendored
2
deps/libuv/src/win/pipe.c
vendored
@ -1252,7 +1252,6 @@ static DWORD WINAPI uv_pipe_writefile_thread_proc(void* parameter) {
|
||||
assert(req != NULL);
|
||||
assert(req->type == UV_WRITE);
|
||||
assert(handle->type == UV_NAMED_PIPE);
|
||||
assert(req->write_buffer.base);
|
||||
|
||||
result = WriteFile(handle->handle,
|
||||
req->write_buffer.base,
|
||||
@ -1797,7 +1796,6 @@ static void uv_pipe_read_eof(uv_loop_t* loop, uv_pipe_t* handle,
|
||||
* it. */
|
||||
eof_timer_destroy(handle);
|
||||
|
||||
handle->flags &= ~UV_HANDLE_READABLE;
|
||||
uv_read_stop((uv_stream_t*) handle);
|
||||
|
||||
handle->read_cb((uv_stream_t*) handle, UV_EOF, &buf);
|
||||
|
4
deps/libuv/src/win/process.c
vendored
4
deps/libuv/src/win/process.c
vendored
@ -169,7 +169,9 @@ static WCHAR* search_path_join_test(const WCHAR* dir,
|
||||
size_t cwd_len) {
|
||||
WCHAR *result, *result_pos;
|
||||
DWORD attrs;
|
||||
if (dir_len > 2 && dir[0] == L'\\' && dir[1] == L'\\') {
|
||||
if (dir_len > 2 &&
|
||||
((dir[0] == L'\\' || dir[0] == L'/') &&
|
||||
(dir[1] == L'\\' || dir[1] == L'/'))) {
|
||||
/* It's a UNC path so ignore cwd */
|
||||
cwd_len = 0;
|
||||
} else if (dir_len >= 1 && (dir[0] == L'/' || dir[0] == L'\\')) {
|
||||
|
5
deps/libuv/src/win/tcp.c
vendored
5
deps/libuv/src/win/tcp.c
vendored
@ -1044,7 +1044,6 @@ void uv_process_tcp_read_req(uv_loop_t* loop, uv_tcp_t* handle,
|
||||
handle->flags &= ~UV_HANDLE_READING;
|
||||
DECREASE_ACTIVE_COUNT(loop, handle);
|
||||
}
|
||||
handle->flags &= ~UV_HANDLE_READABLE;
|
||||
|
||||
buf.base = 0;
|
||||
buf.len = 0;
|
||||
@ -1081,7 +1080,7 @@ void uv_process_tcp_read_req(uv_loop_t* loop, uv_tcp_t* handle,
|
||||
}
|
||||
} else {
|
||||
/* Connection closed */
|
||||
handle->flags &= ~(UV_HANDLE_READING | UV_HANDLE_READABLE);
|
||||
handle->flags &= ~UV_HANDLE_READING;
|
||||
DECREASE_ACTIVE_COUNT(loop, handle);
|
||||
|
||||
handle->read_cb((uv_stream_t*)handle, UV_EOF, &buf);
|
||||
@ -1651,7 +1650,7 @@ int uv_socketpair(int type, int protocol, uv_os_sock_t fds[2], int flags0, int f
|
||||
err = WSAGetLastError();
|
||||
if (err == ERROR_IO_PENDING) {
|
||||
/* Result should complete immediately, since we already called connect,
|
||||
* but emperically, we sometimes have to poll the kernel a couple times
|
||||
* but empirically, we sometimes have to poll the kernel a couple times
|
||||
* until it notices that. */
|
||||
while (!WSAGetOverlappedResult(client1, &overlap, &bytes, FALSE, &flags)) {
|
||||
err = WSAGetLastError();
|
||||
|
15
deps/libuv/src/win/thread.c
vendored
15
deps/libuv/src/win/thread.c
vendored
@ -103,7 +103,7 @@ static UINT __stdcall uv__thread_start(void* arg) {
|
||||
uv__free(ctx_p);
|
||||
|
||||
uv_once(&uv__current_thread_init_guard, uv__init_current_thread_key);
|
||||
uv_key_set(&uv__current_thread_key, (void*) ctx.self);
|
||||
uv_key_set(&uv__current_thread_key, ctx.self);
|
||||
|
||||
ctx.entry(ctx.arg);
|
||||
|
||||
@ -183,7 +183,18 @@ int uv_thread_create_ex(uv_thread_t* tid,
|
||||
|
||||
uv_thread_t uv_thread_self(void) {
|
||||
uv_once(&uv__current_thread_init_guard, uv__init_current_thread_key);
|
||||
return (uv_thread_t) uv_key_get(&uv__current_thread_key);
|
||||
uv_thread_t key = uv_key_get(&uv__current_thread_key);
|
||||
if (key == NULL) {
|
||||
/* If the thread wasn't started by uv_thread_create (such as the main
|
||||
* thread), we assign an id to it now. */
|
||||
if (!DuplicateHandle(GetCurrentProcess(), GetCurrentThread(),
|
||||
GetCurrentProcess(), &key, 0,
|
||||
FALSE, DUPLICATE_SAME_ACCESS)) {
|
||||
uv_fatal_error(GetLastError(), "DuplicateHandle");
|
||||
}
|
||||
uv_key_set(&uv__current_thread_key, key);
|
||||
}
|
||||
return key;
|
||||
}
|
||||
|
||||
|
||||
|
2
deps/libuv/src/win/udp.c
vendored
2
deps/libuv/src/win/udp.c
vendored
@ -1083,7 +1083,7 @@ int uv__udp_connect(uv_udp_t* handle,
|
||||
|
||||
int uv__udp_disconnect(uv_udp_t* handle) {
|
||||
int err;
|
||||
struct sockaddr addr;
|
||||
struct sockaddr_storage addr;
|
||||
|
||||
memset(&addr, 0, sizeof(addr));
|
||||
|
||||
|
5
deps/libuv/src/win/util.c
vendored
5
deps/libuv/src/win/util.c
vendored
@ -1674,7 +1674,10 @@ int uv_os_gethostname(char* buffer, size_t* size) {
|
||||
|
||||
uv__once_init(); /* Initialize winsock */
|
||||
|
||||
if (GetHostNameW(buf, UV_MAXHOSTNAMESIZE) != 0)
|
||||
if (pGetHostNameW == NULL)
|
||||
return UV_ENOSYS;
|
||||
|
||||
if (pGetHostNameW(buf, UV_MAXHOSTNAMESIZE) != 0)
|
||||
return uv_translate_sys_error(WSAGetLastError());
|
||||
|
||||
convert_result = uv__convert_utf16_to_utf8(buf, -1, &utf8_str);
|
||||
|
10
deps/libuv/src/win/winapi.c
vendored
10
deps/libuv/src/win/winapi.c
vendored
@ -45,12 +45,15 @@ sPowerRegisterSuspendResumeNotification pPowerRegisterSuspendResumeNotification;
|
||||
/* User32.dll function pointer */
|
||||
sSetWinEventHook pSetWinEventHook;
|
||||
|
||||
/* ws2_32.dll function pointer */
|
||||
uv_sGetHostNameW pGetHostNameW;
|
||||
|
||||
void uv_winapi_init(void) {
|
||||
HMODULE ntdll_module;
|
||||
HMODULE powrprof_module;
|
||||
HMODULE user32_module;
|
||||
HMODULE kernel32_module;
|
||||
HMODULE ws2_32_module;
|
||||
|
||||
ntdll_module = GetModuleHandleA("ntdll.dll");
|
||||
if (ntdll_module == NULL) {
|
||||
@ -134,4 +137,11 @@ void uv_winapi_init(void) {
|
||||
pSetWinEventHook = (sSetWinEventHook)
|
||||
GetProcAddress(user32_module, "SetWinEventHook");
|
||||
}
|
||||
|
||||
ws2_32_module = LoadLibraryA("ws2_32.dll");
|
||||
if (ws2_32_module != NULL) {
|
||||
pGetHostNameW = (uv_sGetHostNameW) GetProcAddress(
|
||||
ws2_32_module,
|
||||
"GetHostNameW");
|
||||
}
|
||||
}
|
||||
|
7
deps/libuv/src/win/winapi.h
vendored
7
deps/libuv/src/win/winapi.h
vendored
@ -4759,4 +4759,11 @@ extern sPowerRegisterSuspendResumeNotification pPowerRegisterSuspendResumeNotifi
|
||||
/* User32.dll function pointer */
|
||||
extern sSetWinEventHook pSetWinEventHook;
|
||||
|
||||
/* ws2_32.dll function pointer */
|
||||
/* mingw doesn't have this definition, so let's declare it here locally */
|
||||
typedef int (WINAPI *uv_sGetHostNameW)
|
||||
(PWSTR,
|
||||
int);
|
||||
extern uv_sGetHostNameW pGetHostNameW;
|
||||
|
||||
#endif /* UV_WIN_WINAPI_H_ */
|
||||
|
Reference in New Issue
Block a user