aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am1
-rw-r--r--docs/requirements.txt51
-rw-r--r--src/unix/aix.c6
-rw-r--r--src/unix/bsd-ifaddrs.c7
-rw-r--r--src/unix/ibmi.c5
-rw-r--r--src/unix/linux.c7
-rw-r--r--src/unix/pipe.c3
-rw-r--r--src/unix/sunos.c5
-rw-r--r--src/uv-common.c8
-rw-r--r--src/win/async.c20
-rw-r--r--src/win/atomicops-inl.h61
-rw-r--r--src/win/core.c198
-rw-r--r--src/win/fs-fd-hash-inl.h8
-rw-r--r--src/win/fs.c72
-rw-r--r--src/win/handle-inl.h68
-rw-r--r--src/win/pipe.c3
-rw-r--r--src/win/req-inl.h130
-rw-r--r--src/win/util.c6
-rw-r--r--test/test-process-title-threadsafe.c8
-rw-r--r--test/test-spawn.c2
20 files changed, 303 insertions, 366 deletions
diff --git a/Makefile.am b/Makefile.am
index 5f29adbf..8a41f18a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -61,7 +61,6 @@ AM_CPPFLAGS += -I$(top_srcdir)/src/win \
-DWIN32_LEAN_AND_MEAN \
-D_WIN32_WINNT=0x0A00
libuv_la_SOURCES += src/win/async.c \
- src/win/atomicops-inl.h \
src/win/core.c \
src/win/detect-wakeup.c \
src/win/dl.c \
diff --git a/docs/requirements.txt b/docs/requirements.txt
index 2e310ebe..0319b308 100644
--- a/docs/requirements.txt
+++ b/docs/requirements.txt
@@ -1,36 +1,29 @@
# primary
-furo==2023.5.20
-Sphinx==6.1.3
+furo==2024.8.6
+Sphinx==7.0.1
# dependencies
-alabaster==0.7.13
-Babel==2.11.0
-beautifulsoup4==4.12.2
-certifi==2022.12.7
-charset-normalizer==3.0.1
-colorama==0.4.6
-docutils==0.19
-idna==3.4
+alabaster==0.7.16
+babel==2.17.0
+beautifulsoup4==4.13.3
+certifi==2025.1.31
+charset-normalizer==3.4.1
+docutils==0.20.1
+idna==3.10
imagesize==1.4.1
-importlib-metadata==6.0.0
-Jinja2==3.1.2
-livereload==2.6.3
-MarkupSafe==2.1.2
-packaging==23.0
-Pygments==2.14.0
-pytz==2022.7.1
-requests==2.28.2
-six==1.16.0
+Jinja2==3.1.6
+MarkupSafe==3.0.2
+packaging==24.2
+Pygments==2.19.1
+requests==2.32.3
snowballstemmer==2.2.0
-soupsieve==2.4.1
-sphinx-autobuild==2021.3.14
+soupsieve==2.6
sphinx-basic-ng==1.0.0b2
-sphinxcontrib-devhelp==1.0.2
-sphinxcontrib-htmlhelp==2.0.0
+sphinxcontrib-applehelp==2.0.0
+sphinxcontrib-devhelp==2.0.0
+sphinxcontrib-htmlhelp==2.1.0
sphinxcontrib-jsmath==1.0.1
-sphinxcontrib-qthelp==1.0.3
-sphinxcontrib-serializinghtml==1.1.5
-sphinxcontrib.applehelp==1.0.3
-tornado==6.3.2
-urllib3==1.26.14
-zipp==3.11.0
+sphinxcontrib-qthelp==2.0.0
+sphinxcontrib-serializinghtml==2.0.0
+typing_extensions==4.13.0
+urllib3==2.3.0
diff --git a/src/unix/aix.c b/src/unix/aix.c
index 48da0c9c..8343bc5c 100644
--- a/src/unix/aix.c
+++ b/src/unix/aix.c
@@ -1288,12 +1288,6 @@ cleanup:
}
-void uv_free_interface_addresses(uv_interface_address_t* addresses,
- int count) {
- uv__free(addresses);
-}
-
-
void uv__platform_invalidate_fd(uv_loop_t* loop, int fd) {
struct pollfd* events;
uintptr_t i;
diff --git a/src/unix/bsd-ifaddrs.c b/src/unix/bsd-ifaddrs.c
index 8d9ebd25..6829e2a8 100644
--- a/src/unix/bsd-ifaddrs.c
+++ b/src/unix/bsd-ifaddrs.c
@@ -155,10 +155,3 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
return 0;
}
-
-
-/* TODO(bnoordhuis) share with linux.c */
-void uv_free_interface_addresses(uv_interface_address_t* addresses,
- int count) {
- uv__free(addresses);
-}
diff --git a/src/unix/ibmi.c b/src/unix/ibmi.c
index 9d94d2af..fe270f8c 100644
--- a/src/unix/ibmi.c
+++ b/src/unix/ibmi.c
@@ -505,11 +505,6 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
}
-void uv_free_interface_addresses(uv_interface_address_t* addresses,
- int count) {
- uv__free(addresses);
-}
-
char** uv_setup_args(int argc, char** argv) {
char exepath[UV__PATH_MAX];
char* s;
diff --git a/src/unix/linux.c b/src/unix/linux.c
index 77d079b7..1a62d78d 100644
--- a/src/unix/linux.c
+++ b/src/unix/linux.c
@@ -2045,13 +2045,6 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
}
-/* TODO(bnoordhuis) share with bsd-ifaddrs.c */
-void uv_free_interface_addresses(uv_interface_address_t* addresses,
- int count) {
- uv__free(addresses);
-}
-
-
void uv__set_process_title(const char* title) {
#if defined(PR_SET_NAME)
prctl(PR_SET_NAME, title); /* Only copies first 16 characters. */
diff --git a/src/unix/pipe.c b/src/unix/pipe.c
index 68e225e2..f086a22f 100644
--- a/src/unix/pipe.c
+++ b/src/unix/pipe.c
@@ -171,8 +171,7 @@ int uv__pipe_listen(uv_pipe_t* handle, int backlog, uv_connection_cb cb) {
handle->connection_cb = cb;
handle->io_watcher.cb = uv__server_io;
- uv__io_start(handle->loop, &handle->io_watcher, POLLIN);
- return 0;
+ return uv__io_start(handle->loop, &handle->io_watcher, POLLIN);
}
diff --git a/src/unix/sunos.c b/src/unix/sunos.c
index 6c38c31a..62584d72 100644
--- a/src/unix/sunos.c
+++ b/src/unix/sunos.c
@@ -898,11 +898,6 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
}
#endif /* SUNOS_NO_IFADDRS */
-void uv_free_interface_addresses(uv_interface_address_t* addresses,
- int count) {
- uv__free(addresses);
-}
-
#if !defined(_POSIX_VERSION) || _POSIX_VERSION < 200809L
size_t strnlen(const char* s, size_t maxlen) {
diff --git a/src/uv-common.c b/src/uv-common.c
index bff9d9ee..e5a76329 100644
--- a/src/uv-common.c
+++ b/src/uv-common.c
@@ -1054,3 +1054,11 @@ uint64_t uv_metrics_idle_time(uv_loop_t* loop) {
idle_time += uv_hrtime() - entry_time;
return idle_time;
}
+
+/* OS390 needs a different implementation, already provided in os390.c. */
+#ifndef __MVS__
+void uv_free_interface_addresses(uv_interface_address_t* addresses,
+ int count) {
+ uv__free(addresses);
+}
+#endif /* !__MVS__ */
diff --git a/src/win/async.c b/src/win/async.c
index b904676e..4c2cd265 100644
--- a/src/win/async.c
+++ b/src/win/async.c
@@ -23,10 +23,28 @@
#include "uv.h"
#include "internal.h"
-#include "atomicops-inl.h"
#include "handle-inl.h"
#include "req-inl.h"
+#ifdef _MSC_VER /* MSVC */
+
+/* _InterlockedOr8 is supported by MSVC on x32 and x64. It is slightly less
+ * efficient than InterlockedExchange, but InterlockedExchange8 does not exist,
+ * and interlocked operations on larger targets might require the target to be
+ * aligned. */
+#pragma intrinsic(_InterlockedOr8)
+
+static char uv__atomic_exchange_set(char volatile* target) {
+ return _InterlockedOr8(target, 1);
+}
+
+#else /* GCC, Clang in mingw mode */
+
+static char uv__atomic_exchange_set(char volatile* target) {
+ return __sync_fetch_and_or(target, 1);
+}
+
+#endif /* _MSC_VER */
void uv__async_endgame(uv_loop_t* loop, uv_async_t* handle) {
if (handle->flags & UV_HANDLE_CLOSING &&
diff --git a/src/win/atomicops-inl.h b/src/win/atomicops-inl.h
deleted file mode 100644
index 2f984c6d..00000000
--- a/src/win/atomicops-inl.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- */
-
-#ifndef UV_WIN_ATOMICOPS_INL_H_
-#define UV_WIN_ATOMICOPS_INL_H_
-
-#include "uv.h"
-#include "internal.h"
-
-
-/* Atomic set operation on char */
-#ifdef _MSC_VER /* MSVC */
-
-/* _InterlockedOr8 is supported by MSVC on x32 and x64. It is slightly less
- * efficient than InterlockedExchange, but InterlockedExchange8 does not exist,
- * and interlocked operations on larger targets might require the target to be
- * aligned. */
-#pragma intrinsic(_InterlockedOr8)
-
-static char INLINE uv__atomic_exchange_set(char volatile* target) {
- return _InterlockedOr8(target, 1);
-}
-
-#else /* GCC, Clang in mingw mode */
-
-static inline char uv__atomic_exchange_set(char volatile* target) {
-#if defined(__i386__) || defined(__x86_64__)
- /* Mingw-32 version, hopefully this works for 64-bit gcc as well. */
- const char one = 1;
- char old_value;
- __asm__ __volatile__ ("lock xchgb %0, %1\n\t"
- : "=r"(old_value), "=m"(*target)
- : "0"(one), "m"(*target)
- : "memory");
- return old_value;
-#else
- return __sync_fetch_and_or(target, 1);
-#endif
-}
-
-#endif
-
-#endif /* UV_WIN_ATOMICOPS_INL_H_ */
diff --git a/src/win/core.c b/src/win/core.c
index 5f41c87a..317238fd 100644
--- a/src/win/core.c
+++ b/src/win/core.c
@@ -428,6 +428,7 @@ static void uv__poll(uv_loop_t* loop, DWORD timeout) {
BOOL success;
uv_req_t* req;
OVERLAPPED_ENTRY overlappeds[128];
+ OVERLAPPED* overlapped;
ULONG count;
ULONG i;
int repeat;
@@ -491,7 +492,8 @@ static void uv__poll(uv_loop_t* loop, DWORD timeout) {
if (actual_timeout == 0)
uv__metrics_inc_events_waiting(loop, 1);
- req = uv__overlapped_to_req(overlappeds[i].lpOverlapped);
+ overlapped = overlappeds[i].lpOverlapped;
+ req = container_of(overlapped, uv_req_t, u.io.overlapped);
uv__insert_pending_req(loop, req);
}
}
@@ -525,6 +527,177 @@ static void uv__poll(uv_loop_t* loop, DWORD timeout) {
}
+#define DELEGATE_STREAM_REQ(loop, req, method, handle_at) \
+ do { \
+ switch (((uv_handle_t*) (req)->handle_at)->type) { \
+ case UV_TCP: \
+ uv__process_tcp_##method##_req(loop, \
+ (uv_tcp_t*) ((req)->handle_at), \
+ req); \
+ break; \
+ \
+ case UV_NAMED_PIPE: \
+ uv__process_pipe_##method##_req(loop, \
+ (uv_pipe_t*) ((req)->handle_at), \
+ req); \
+ break; \
+ \
+ case UV_TTY: \
+ uv__process_tty_##method##_req(loop, \
+ (uv_tty_t*) ((req)->handle_at), \
+ req); \
+ break; \
+ \
+ default: \
+ assert(0); \
+ } \
+ } while (0)
+
+
+static void uv__process_reqs(uv_loop_t* loop) {
+ uv_req_t* req;
+ uv_req_t* first;
+ uv_req_t* next;
+
+ if (loop->pending_reqs_tail == NULL)
+ return;
+
+ first = loop->pending_reqs_tail->next_req;
+ next = first;
+ loop->pending_reqs_tail = NULL;
+
+ while (next != NULL) {
+ req = next;
+ next = req->next_req != first ? req->next_req : NULL;
+
+ switch (req->type) {
+ case UV_READ:
+ DELEGATE_STREAM_REQ(loop, req, read, data);
+ break;
+
+ case UV_WRITE:
+ DELEGATE_STREAM_REQ(loop, (uv_write_t*) req, write, handle);
+ break;
+
+ case UV_ACCEPT:
+ DELEGATE_STREAM_REQ(loop, req, accept, data);
+ break;
+
+ case UV_CONNECT:
+ DELEGATE_STREAM_REQ(loop, (uv_connect_t*) req, connect, handle);
+ break;
+
+ case UV_SHUTDOWN:
+ DELEGATE_STREAM_REQ(loop, (uv_shutdown_t*) req, shutdown, handle);
+ break;
+
+ case UV_UDP_RECV:
+ uv__process_udp_recv_req(loop, (uv_udp_t*) req->data, req);
+ break;
+
+ case UV_UDP_SEND:
+ uv__process_udp_send_req(loop,
+ ((uv_udp_send_t*) req)->handle,
+ (uv_udp_send_t*) req);
+ break;
+
+ case UV_WAKEUP:
+ uv__process_async_wakeup_req(loop, (uv_async_t*) req->data, req);
+ break;
+
+ case UV_SIGNAL_REQ:
+ uv__process_signal_req(loop, (uv_signal_t*) req->data, req);
+ break;
+
+ case UV_POLL_REQ:
+ uv__process_poll_req(loop, (uv_poll_t*) req->data, req);
+ break;
+
+ case UV_PROCESS_EXIT:
+ uv__process_proc_exit(loop, (uv_process_t*) req->data);
+ break;
+
+ case UV_FS_EVENT_REQ:
+ uv__process_fs_event_req(loop, req, (uv_fs_event_t*) req->data);
+ break;
+
+ default:
+ assert(0);
+ }
+ }
+}
+
+#undef DELEGATE_STREAM_REQ
+
+static void uv__process_endgames(uv_loop_t* loop) {
+ uv_handle_t* handle;
+
+ while (loop->endgame_handles) {
+ handle = loop->endgame_handles;
+ loop->endgame_handles = handle->endgame_next;
+
+ handle->flags &= ~UV_HANDLE_ENDGAME_QUEUED;
+
+ switch (handle->type) {
+ case UV_TCP:
+ uv__tcp_endgame(loop, (uv_tcp_t*) handle);
+ break;
+
+ case UV_NAMED_PIPE:
+ uv__pipe_endgame(loop, (uv_pipe_t*) handle);
+ break;
+
+ case UV_TTY:
+ uv__tty_endgame(loop, (uv_tty_t*) handle);
+ break;
+
+ case UV_UDP:
+ uv__udp_endgame(loop, (uv_udp_t*) handle);
+ break;
+
+ case UV_POLL:
+ uv__poll_endgame(loop, (uv_poll_t*) handle);
+ break;
+
+ case UV_TIMER:
+ uv__timer_close((uv_timer_t*) handle);
+ uv__handle_close(handle);
+ break;
+
+ case UV_PREPARE:
+ case UV_CHECK:
+ case UV_IDLE:
+ uv__loop_watcher_endgame(loop, handle);
+ break;
+
+ case UV_ASYNC:
+ uv__async_endgame(loop, (uv_async_t*) handle);
+ break;
+
+ case UV_SIGNAL:
+ uv__signal_endgame(loop, (uv_signal_t*) handle);
+ break;
+
+ case UV_PROCESS:
+ uv__process_endgame(loop, (uv_process_t*) handle);
+ break;
+
+ case UV_FS_EVENT:
+ uv__fs_event_endgame(loop, (uv_fs_event_t*) handle);
+ break;
+
+ case UV_FS_POLL:
+ uv__fs_poll_endgame(loop, (uv_fs_poll_t*) handle);
+ break;
+
+ default:
+ assert(0);
+ break;
+ }
+ }
+}
+
+
int uv_run(uv_loop_t *loop, uv_run_mode mode) {
DWORD timeout;
int r;
@@ -681,3 +854,26 @@ int uv__getsockpeername(const uv_handle_t* handle,
return 0;
}
+
+void uv__insert_pending_req(uv_loop_t* loop, uv_req_t* req) {
+ req->next_req = NULL;
+ if (loop->pending_reqs_tail) {
+#ifdef _DEBUG
+ /* Ensure the request is not already in the queue, or the queue
+ * will get corrupted.
+ */
+ uv_req_t* current = loop->pending_reqs_tail;
+ do {
+ assert(req != current);
+ current = current->next_req;
+ } while (current != loop->pending_reqs_tail);
+#endif
+
+ req->next_req = loop->pending_reqs_tail->next_req;
+ loop->pending_reqs_tail->next_req = req;
+ loop->pending_reqs_tail = req;
+ } else {
+ req->next_req = req;
+ loop->pending_reqs_tail = req;
+ }
+}
diff --git a/src/win/fs-fd-hash-inl.h b/src/win/fs-fd-hash-inl.h
index 0b532af1..fd875d28 100644
--- a/src/win/fs-fd-hash-inl.h
+++ b/src/win/fs-fd-hash-inl.h
@@ -73,7 +73,7 @@ static struct uv__fd_hash_entry_group_s
static struct uv__fd_hash_bucket_s uv__fd_hash[UV__FD_HASH_SIZE];
-INLINE static void uv__fd_hash_init(void) {
+static void uv__fd_hash_init(void) {
size_t i;
int err;
@@ -119,7 +119,7 @@ INLINE static void uv__fd_hash_init(void) {
FIND_IN_GROUP_PTR(UV__FD_HASH_GROUP_SIZE); \
} while (0)
-INLINE static int uv__fd_hash_get(int fd, struct uv__fd_info_s* info) {
+static int uv__fd_hash_get(int fd, struct uv__fd_info_s* info) {
FIND_COMMON_VARIABLES
uv_mutex_lock(&uv__fd_hash_mutex);
@@ -134,7 +134,7 @@ INLINE static int uv__fd_hash_get(int fd, struct uv__fd_info_s* info) {
return entry_ptr != NULL;
}
-INLINE static void uv__fd_hash_add(int fd, struct uv__fd_info_s* info) {
+static void uv__fd_hash_add(int fd, struct uv__fd_info_s* info) {
FIND_COMMON_VARIABLES
uv_mutex_lock(&uv__fd_hash_mutex);
@@ -164,7 +164,7 @@ INLINE static void uv__fd_hash_add(int fd, struct uv__fd_info_s* info) {
uv_mutex_unlock(&uv__fd_hash_mutex);
}
-INLINE static int uv__fd_hash_remove(int fd, struct uv__fd_info_s* info) {
+static int uv__fd_hash_remove(int fd, struct uv__fd_info_s* info) {
FIND_COMMON_VARIABLES
uv_mutex_lock(&uv__fd_hash_mutex);
diff --git a/src/win/fs.c b/src/win/fs.c
index fb1a5844..4e156930 100644
--- a/src/win/fs.c
+++ b/src/win/fs.c
@@ -167,9 +167,10 @@ typedef enum {
FS__STAT_PATH_TRY_SLOW
} fs__stat_path_return_t;
-INLINE static void fs__stat_assign_statbuf_null(uv_stat_t* statbuf);
-INLINE static void fs__stat_assign_statbuf(uv_stat_t* statbuf,
- FILE_STAT_BASIC_INFORMATION stat_info, int do_lstat);
+static void fs__stat_assign_statbuf_null(uv_stat_t* statbuf);
+static void fs__stat_assign_statbuf(uv_stat_t* statbuf,
+ FILE_STAT_BASIC_INFORMATION stat_info,
+ int do_lstat);
void uv__fs_init(void) {
@@ -182,9 +183,9 @@ void uv__fs_init(void) {
}
-INLINE static int fs__readlink_handle(HANDLE handle,
- char** target_ptr,
- size_t* target_len_ptr) {
+static int fs__readlink_handle(HANDLE handle,
+ char** target_ptr,
+ size_t* target_len_ptr) {
char buffer[MAXIMUM_REPARSE_DATA_BUFFER_SIZE];
REPARSE_DATA_BUFFER* reparse_data = (REPARSE_DATA_BUFFER*) buffer;
WCHAR* w_target;
@@ -319,8 +320,10 @@ INLINE static int fs__readlink_handle(HANDLE handle,
}
-INLINE static int fs__capture_path(uv_fs_t* req, const char* path,
- const char* new_path, const int copy_path) {
+static int fs__capture_path(uv_fs_t* req,
+ const char* path,
+ const char* new_path,
+ const int copy_path) {
WCHAR* buf;
WCHAR* pos;
size_t buf_sz = 0;
@@ -394,8 +397,10 @@ INLINE static int fs__capture_path(uv_fs_t* req, const char* path,
}
-INLINE static void uv__fs_req_init(uv_loop_t* loop, uv_fs_t* req,
- uv_fs_type fs_type, const uv_fs_cb cb) {
+static void uv__fs_req_init(uv_loop_t* loop,
+ uv_fs_t* req,
+ uv_fs_type fs_type,
+ const uv_fs_cb cb) {
uv__once_init();
UV_REQ_INIT(req, UV_FS);
req->loop = loop;
@@ -1698,8 +1703,9 @@ void fs__closedir(uv_fs_t* req) {
SET_REQ_RESULT(req, 0);
}
-INLINE static fs__stat_path_return_t fs__stat_path(WCHAR* path,
- uv_stat_t* statbuf, int do_lstat) {
+static fs__stat_path_return_t fs__stat_path(WCHAR* path,
+ uv_stat_t* statbuf,
+ int do_lstat) {
FILE_STAT_BASIC_INFORMATION stat_info;
/* Check if the new fast API is available. */
@@ -1735,8 +1741,7 @@ INLINE static fs__stat_path_return_t fs__stat_path(WCHAR* path,
return FS__STAT_PATH_SUCCESS;
}
-INLINE static int fs__stat_handle(HANDLE handle, uv_stat_t* statbuf,
- int do_lstat) {
+static int fs__stat_handle(HANDLE handle, uv_stat_t* statbuf, int do_lstat) {
size_t target_length = 0;
FILE_FS_DEVICE_INFORMATION device_info;
FILE_ALL_INFORMATION file_info;
@@ -1827,7 +1832,7 @@ INLINE static int fs__stat_handle(HANDLE handle, uv_stat_t* statbuf,
return 0;
}
-INLINE static void fs__stat_assign_statbuf_null(uv_stat_t* statbuf) {
+static void fs__stat_assign_statbuf_null(uv_stat_t* statbuf) {
memset(statbuf, 0, sizeof(uv_stat_t));
statbuf->st_mode = _S_IFCHR;
statbuf->st_mode |= (_S_IREAD | _S_IWRITE) | ((_S_IREAD | _S_IWRITE) >> 3) |
@@ -1837,8 +1842,9 @@ INLINE static void fs__stat_assign_statbuf_null(uv_stat_t* statbuf) {
statbuf->st_rdev = FILE_DEVICE_NULL << 16;
}
-INLINE static void fs__stat_assign_statbuf(uv_stat_t* statbuf,
- FILE_STAT_BASIC_INFORMATION stat_info, int do_lstat) {
+static void fs__stat_assign_statbuf(uv_stat_t* statbuf,
+ FILE_STAT_BASIC_INFORMATION stat_info,
+ int do_lstat) {
statbuf->st_dev = stat_info.VolumeSerialNumber.LowPart;
/* Todo: st_mode should probably always be 0666 for everyone. We might also
@@ -1943,7 +1949,7 @@ INLINE static void fs__stat_assign_statbuf(uv_stat_t* statbuf,
}
-INLINE static void fs__stat_prepare_path(WCHAR* pathw) {
+static void fs__stat_prepare_path(WCHAR* pathw) {
size_t len = wcslen(pathw);
if (len > 1 && pathw[len - 2] != L':' &&
@@ -1952,8 +1958,10 @@ INLINE static void fs__stat_prepare_path(WCHAR* pathw) {
}
}
-INLINE static DWORD fs__stat_directory(WCHAR* path, uv_stat_t* statbuf,
- int do_lstat, DWORD ret_error) {
+static DWORD fs__stat_directory(WCHAR* path,
+ uv_stat_t* statbuf,
+ int do_lstat,
+ DWORD ret_error) {
HANDLE handle = INVALID_HANDLE_VALUE;
FILE_STAT_BASIC_INFORMATION stat_info;
FILE_ID_FULL_DIR_INFORMATION dir_info;
@@ -2126,9 +2134,9 @@ cleanup:
return ret_error;
}
-INLINE static DWORD fs__stat_impl_from_path(WCHAR* path,
- int do_lstat,
- uv_stat_t* statbuf) {
+static DWORD fs__stat_impl_from_path(WCHAR* path,
+ int do_lstat,
+ uv_stat_t* statbuf) {
HANDLE handle;
DWORD flags;
DWORD ret;
@@ -2173,7 +2181,7 @@ INLINE static DWORD fs__stat_impl_from_path(WCHAR* path,
}
-INLINE static void fs__stat_impl(uv_fs_t* req, int do_lstat) {
+static void fs__stat_impl(uv_fs_t* req, int do_lstat) {
DWORD error;
error = fs__stat_impl_from_path(req->file.pathw, do_lstat, &req->statbuf);
@@ -2196,7 +2204,7 @@ INLINE static void fs__stat_impl(uv_fs_t* req, int do_lstat) {
}
-INLINE static int fs__fstat_handle(int fd, HANDLE handle, uv_stat_t* statbuf) {
+static int fs__fstat_handle(int fd, HANDLE handle, uv_stat_t* statbuf) {
DWORD file_type;
/* Each file type is processed differently. */
@@ -2272,7 +2280,7 @@ static void fs__rename(uv_fs_t* req) {
}
-INLINE static void fs__sync_impl(uv_fs_t* req) {
+static void fs__sync_impl(uv_fs_t* req) {
int fd = req->file.fd;
int result;
@@ -2578,7 +2586,7 @@ fchmod_cleanup:
}
-INLINE static int fs__utime_handle(HANDLE handle, double atime, double mtime) {
+static int fs__utime_handle(HANDLE handle, double atime, double mtime) {
FILETIME filetime_as, *filetime_a = &filetime_as;
FILETIME filetime_ms, *filetime_m = &filetime_ms;
FILETIME now;
@@ -2606,10 +2614,10 @@ INLINE static int fs__utime_handle(HANDLE handle, double atime, double mtime) {
return 0;
}
-INLINE static DWORD fs__utime_impl_from_path(WCHAR* path,
- double atime,
- double mtime,
- int do_lutime) {
+static DWORD fs__utime_impl_from_path(WCHAR* path,
+ double atime,
+ double mtime,
+ int do_lutime) {
HANDLE handle;
DWORD flags;
DWORD ret;
@@ -2639,7 +2647,7 @@ INLINE static DWORD fs__utime_impl_from_path(WCHAR* path,
return ret;
}
-INLINE static void fs__utime_impl(uv_fs_t* req, int do_lutime) {
+static void fs__utime_impl(uv_fs_t* req, int do_lutime) {
DWORD error;
error = fs__utime_impl_from_path(req->file.pathw,
diff --git a/src/win/handle-inl.h b/src/win/handle-inl.h
index 4722e857..e30d148c 100644
--- a/src/win/handle-inl.h
+++ b/src/win/handle-inl.h
@@ -95,74 +95,6 @@ INLINE static void uv__want_endgame(uv_loop_t* loop, uv_handle_t* handle) {
}
-INLINE static void uv__process_endgames(uv_loop_t* loop) {
- uv_handle_t* handle;
-
- while (loop->endgame_handles) {
- handle = loop->endgame_handles;
- loop->endgame_handles = handle->endgame_next;
-
- handle->flags &= ~UV_HANDLE_ENDGAME_QUEUED;
-
- switch (handle->type) {
- case UV_TCP:
- uv__tcp_endgame(loop, (uv_tcp_t*) handle);
- break;
-
- case UV_NAMED_PIPE:
- uv__pipe_endgame(loop, (uv_pipe_t*) handle);
- break;
-
- case UV_TTY:
- uv__tty_endgame(loop, (uv_tty_t*) handle);
- break;
-
- case UV_UDP:
- uv__udp_endgame(loop, (uv_udp_t*) handle);
- break;
-
- case UV_POLL:
- uv__poll_endgame(loop, (uv_poll_t*) handle);
- break;
-
- case UV_TIMER:
- uv__timer_close((uv_timer_t*) handle);
- uv__handle_close(handle);
- break;
-
- case UV_PREPARE:
- case UV_CHECK:
- case UV_IDLE:
- uv__loop_watcher_endgame(loop, handle);
- break;
-
- case UV_ASYNC:
- uv__async_endgame(loop, (uv_async_t*) handle);
- break;
-
- case UV_SIGNAL:
- uv__signal_endgame(loop, (uv_signal_t*) handle);
- break;
-
- case UV_PROCESS:
- uv__process_endgame(loop, (uv_process_t*) handle);
- break;
-
- case UV_FS_EVENT:
- uv__fs_event_endgame(loop, (uv_fs_event_t*) handle);
- break;
-
- case UV_FS_POLL:
- uv__fs_poll_endgame(loop, (uv_fs_poll_t*) handle);
- break;
-
- default:
- assert(0);
- break;
- }
- }
-}
-
INLINE static HANDLE uv__get_osfhandle(int fd)
{
/* _get_osfhandle() raises an assert in debug builds if the FD is invalid.
diff --git a/src/win/pipe.c b/src/win/pipe.c
index d05bfd28..8f86a1fe 100644
--- a/src/win/pipe.c
+++ b/src/win/pipe.c
@@ -2149,7 +2149,8 @@ void uv__process_pipe_read_req(uv_loop_t* loop,
} else {
/* The zero-read completed without error, indicating there is data
* available in the kernel buffer. */
- while (handle->flags & UV_HANDLE_READING) {
+ while (handle->flags & UV_HANDLE_READING &&
+ !(handle->flags & UV_HANDLE_READ_PENDING)) {
bytes_requested = 65536;
/* Depending on the type of pipe, read either IPC frames or raw data. */
if (handle->ipc)
diff --git a/src/win/req-inl.h b/src/win/req-inl.h
index cf16e8ba..af6fb752 100644
--- a/src/win/req-inl.h
+++ b/src/win/req-inl.h
@@ -81,134 +81,6 @@
uv_fatal_error(GetLastError(), "PostQueuedCompletionStatus"); \
}
-
-INLINE static uv_req_t* uv__overlapped_to_req(OVERLAPPED* overlapped) {
- return container_of(overlapped, uv_req_t, u.io.overlapped);
-}
-
-
-INLINE static void uv__insert_pending_req(uv_loop_t* loop, uv_req_t* req) {
- req->next_req = NULL;
- if (loop->pending_reqs_tail) {
-#ifdef _DEBUG
- /* Ensure the request is not already in the queue, or the queue
- * will get corrupted.
- */
- uv_req_t* current = loop->pending_reqs_tail;
- do {
- assert(req != current);
- current = current->next_req;
- } while(current != loop->pending_reqs_tail);
-#endif
-
- req->next_req = loop->pending_reqs_tail->next_req;
- loop->pending_reqs_tail->next_req = req;
- loop->pending_reqs_tail = req;
- } else {
- req->next_req = req;
- loop->pending_reqs_tail = req;
- }
-}
-
-
-#define DELEGATE_STREAM_REQ(loop, req, method, handle_at) \
- do { \
- switch (((uv_handle_t*) (req)->handle_at)->type) { \
- case UV_TCP: \
- uv__process_tcp_##method##_req(loop, \
- (uv_tcp_t*) ((req)->handle_at), \
- req); \
- break; \
- \
- case UV_NAMED_PIPE: \
- uv__process_pipe_##method##_req(loop, \
- (uv_pipe_t*) ((req)->handle_at), \
- req); \
- break; \
- \
- case UV_TTY: \
- uv__process_tty_##method##_req(loop, \
- (uv_tty_t*) ((req)->handle_at), \
- req); \
- break; \
- \
- default: \
- assert(0); \
- } \
- } while (0)
-
-
-INLINE static void uv__process_reqs(uv_loop_t* loop) {
- uv_req_t* req;
- uv_req_t* first;
- uv_req_t* next;
-
- if (loop->pending_reqs_tail == NULL)
- return;
-
- first = loop->pending_reqs_tail->next_req;
- next = first;
- loop->pending_reqs_tail = NULL;
-
- while (next != NULL) {
- req = next;
- next = req->next_req != first ? req->next_req : NULL;
-
- switch (req->type) {
- case UV_READ:
- DELEGATE_STREAM_REQ(loop, req, read, data);
- break;
-
- case UV_WRITE:
- DELEGATE_STREAM_REQ(loop, (uv_write_t*) req, write, handle);
- break;
-
- case UV_ACCEPT:
- DELEGATE_STREAM_REQ(loop, req, accept, data);
- break;
-
- case UV_CONNECT:
- DELEGATE_STREAM_REQ(loop, (uv_connect_t*) req, connect, handle);
- break;
-
- case UV_SHUTDOWN:
- DELEGATE_STREAM_REQ(loop, (uv_shutdown_t*) req, shutdown, handle);
- break;
-
- case UV_UDP_RECV:
- uv__process_udp_recv_req(loop, (uv_udp_t*) req->data, req);
- break;
-
- case UV_UDP_SEND:
- uv__process_udp_send_req(loop,
- ((uv_udp_send_t*) req)->handle,
- (uv_udp_send_t*) req);
- break;
-
- case UV_WAKEUP:
- uv__process_async_wakeup_req(loop, (uv_async_t*) req->data, req);
- break;
-
- case UV_SIGNAL_REQ:
- uv__process_signal_req(loop, (uv_signal_t*) req->data, req);
- break;
-
- case UV_POLL_REQ:
- uv__process_poll_req(loop, (uv_poll_t*) req->data, req);
- break;
-
- case UV_PROCESS_EXIT:
- uv__process_proc_exit(loop, (uv_process_t*) req->data);
- break;
-
- case UV_FS_EVENT_REQ:
- uv__process_fs_event_req(loop, req, (uv_fs_event_t*) req->data);
- break;
-
- default:
- assert(0);
- }
- }
-}
+void uv__insert_pending_req(uv_loop_t* loop, uv_req_t* req);
#endif /* UV_WIN_REQ_INL_H_ */
diff --git a/src/win/util.c b/src/win/util.c
index cebc2b3e..8c2681fe 100644
--- a/src/win/util.c
+++ b/src/win/util.c
@@ -872,12 +872,6 @@ int uv_interface_addresses(uv_interface_address_t** addresses_ptr,
}
-void uv_free_interface_addresses(uv_interface_address_t* addresses,
- int count) {
- uv__free(addresses);
-}
-
-
int uv_getrusage(uv_rusage_t *uv_rusage) {
FILETIME create_time, exit_time, kernel_time, user_time;
SYSTEMTIME kernel_system_time, user_system_time;
diff --git a/test/test-process-title-threadsafe.c b/test/test-process-title-threadsafe.c
index daa13b8c..212c715a 100644
--- a/test/test-process-title-threadsafe.c
+++ b/test/test-process-title-threadsafe.c
@@ -89,6 +89,14 @@ TEST_IMPL(process_title_threadsafe) {
RETURN_SKIP("uv_(get|set)_process_title is not implemented.");
#endif
+#if defined(__ASAN__) && defined(__APPLE__)
+ /* uv_set_process_title loads and unloads a bunch of dynamic libraries,
+ * and that's quite slow and prone to time out when running concurrently
+ * under AddressSanitizer.
+ */
+ RETURN_SKIP("too slow under ASAN");
+#endif
+
ASSERT_OK(uv_set_process_title(titles[0]));
ASSERT_OK(uv_sem_init(&getter_sem, 0));
diff --git a/test/test-spawn.c b/test/test-spawn.c
index 1c470a09..0dad9bcd 100644
--- a/test/test-spawn.c
+++ b/test/test-spawn.c
@@ -1701,7 +1701,7 @@ TEST_IMPL(spawn_fs_open) {
#ifdef _WIN32
ASSERT_NE(0, DuplicateHandle(GetCurrentProcess(), fd, GetCurrentProcess(), &dup_fd,
0, /* inherit */ TRUE, DUPLICATE_SAME_ACCESS));
- kernelbase_module = GetModuleHandleW("kernelbase.dll");
+ kernelbase_module = GetModuleHandleW(L"kernelbase.dll");
pCompareObjectHandles = (sCompareObjectHandles)
GetProcAddress(kernelbase_module, "CompareObjectHandles");
ASSERT_NE(pCompareObjectHandles == NULL ||