From 0db640268757fad992781ae6fac678fdc8526caf Mon Sep 17 00:00:00 2001 From: Brad King Date: Sun, 31 Mar 2024 09:45:04 -0400 Subject: libuv: process: de-duplicate conditions for using kqueue Its platform-specific headers provide a dedicated indicator. Backport libuv PR 4378. --- Utilities/cmlibuv/src/unix/process.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Utilities/cmlibuv/src/unix/process.c b/Utilities/cmlibuv/src/unix/process.c index 5c39da6..3427847 100644 --- a/Utilities/cmlibuv/src/unix/process.c +++ b/Utilities/cmlibuv/src/unix/process.c @@ -81,11 +81,7 @@ extern char **environ; #ifdef CMAKE_BOOTSTRAP #define UV_USE_SIGCHLD -#elif defined(__APPLE__) || \ - defined(__DragonFly__) || \ - defined(__FreeBSD__) || \ - defined(__NetBSD__) || \ - defined(__OpenBSD__) +#elif defined(UV_HAVE_KQUEUE) #include #else #define UV_USE_SIGCHLD -- cgit v0.12 From af330faaf17f46196d2d2faca8a50e4146d5cc09 Mon Sep 17 00:00:00 2001 From: Brad King Date: Sun, 31 Mar 2024 10:38:17 -0400 Subject: libuv: darwin: group kqueue-specific definitions together --- Utilities/cmlibuv/include/uv/darwin.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Utilities/cmlibuv/include/uv/darwin.h b/Utilities/cmlibuv/include/uv/darwin.h index d226415..36f872a 100644 --- a/Utilities/cmlibuv/include/uv/darwin.h +++ b/Utilities/cmlibuv/include/uv/darwin.h @@ -30,6 +30,8 @@ # define UV_PLATFORM_SEM_T semaphore_t #endif +#define UV_HAVE_KQUEUE 1 + #define UV_IO_PRIVATE_PLATFORM_FIELDS \ int rcount; \ int wcount; \ @@ -56,6 +58,4 @@ #define UV_STREAM_PRIVATE_PLATFORM_FIELDS \ void* select; \ -#define UV_HAVE_KQUEUE 1 - #endif /* UV_DARWIN_H */ -- cgit v0.12 From f54ec4e7f9a2d11306568668562246a154213b4f Mon Sep 17 00:00:00 2001 From: Brad King Date: Sun, 31 Mar 2024 10:43:05 -0400 Subject: libuv: macos: use posix poll instead of kqueue Since commit 5420639a8d (cmExecuteProcessCommand: Replace cmsysProcess with cmUVProcessChain, 2023-06-01, v3.28.0-rc1~138^2~8) we've observed spurious process hangs in `uv__io_poll` waiting for `kqueue` to deliver events on macOS. Issue: #25839 --- Utilities/cmlibuv/CMakeLists.txt | 4 ++-- Utilities/cmlibuv/include/uv/darwin.h | 5 +++++ Utilities/cmlibuv/src/unix/darwin.c | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Utilities/cmlibuv/CMakeLists.txt b/Utilities/cmlibuv/CMakeLists.txt index a0b161b..29dd18e 100644 --- a/Utilities/cmlibuv/CMakeLists.txt +++ b/Utilities/cmlibuv/CMakeLists.txt @@ -191,8 +191,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") src/unix/bsd-ifaddrs.c src/unix/darwin.c src/unix/darwin-proctitle.c - src/unix/fsevents.c - src/unix/kqueue.c + src/unix/no-fsevents.c + src/unix/posix-poll.c src/unix/proctitle.c ) endif() diff --git a/Utilities/cmlibuv/include/uv/darwin.h b/Utilities/cmlibuv/include/uv/darwin.h index 36f872a..7eeb194 100644 --- a/Utilities/cmlibuv/include/uv/darwin.h +++ b/Utilities/cmlibuv/include/uv/darwin.h @@ -30,6 +30,9 @@ # define UV_PLATFORM_SEM_T semaphore_t #endif +#if 1 /* FIXME(#25839): use posix poll to avoid kqueue hangs on macOS. */ +# include "posix.h" +#else #define UV_HAVE_KQUEUE 1 #define UV_IO_PRIVATE_PLATFORM_FIELDS \ @@ -55,6 +58,8 @@ int cf_error; \ uv_mutex_t cf_mutex; \ +#endif + #define UV_STREAM_PRIVATE_PLATFORM_FIELDS \ void* select; \ diff --git a/Utilities/cmlibuv/src/unix/darwin.c b/Utilities/cmlibuv/src/unix/darwin.c index 62f04d3..b9c8084 100644 --- a/Utilities/cmlibuv/src/unix/darwin.c +++ b/Utilities/cmlibuv/src/unix/darwin.c @@ -41,6 +41,7 @@ static mach_timebase_info_data_t timebase; typedef unsigned char UInt8; +#ifdef UV_HAVE_KQUEUE int uv__platform_loop_init(uv_loop_t* loop) { loop->cf_state = NULL; @@ -54,6 +55,7 @@ int uv__platform_loop_init(uv_loop_t* loop) { void uv__platform_loop_delete(uv_loop_t* loop) { uv__fsevents_loop_delete(loop); } +#endif static void uv__hrtime_init_once(void) { -- cgit v0.12