diff --git a/lib/Basic/Subprocess.cpp b/lib/Basic/Subprocess.cpp index bf2fd4d1..0b5ecf40 100644 --- a/lib/Basic/Subprocess.cpp +++ b/lib/Basic/Subprocess.cpp @@ -79,9 +79,13 @@ int pthread_fchdir_np(int fd) // Implementation mostly copied from _CFPosixSpawnFileActionsChdir in swift-corelibs-foundation static int posix_spawn_file_actions_addchdir_polyfill(posix_spawn_file_actions_t * __restrict file_actions, const char * __restrict path) { -#if defined(__GLIBC__) && !__GLIBC_PREREQ(2, 29) +#if (defined(__GLIBC__) && !__GLIBC_PREREQ(2, 29)) || (defined(__OpenBSD__)) || (defined(__ANDROID__) && __ANDROID_API__ < 34) || (defined(__QNX__)) // Glibc versions prior to 2.29 don't support posix_spawn_file_actions_addchdir_np, impacting: // - Amazon Linux 2 (EoL mid-2025) + // Currently missing as of: + // - OpenBSD 7.5 (April 2024) + // - QNX 8 (December 2023) + // - Android <= 14 return ENOSYS; #elif defined(__APPLE__) && defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500 // Conditionally available on macOS if building with a deployment target older than 10.15 @@ -89,11 +93,7 @@ static int posix_spawn_file_actions_addchdir_polyfill(posix_spawn_file_actions_t return posix_spawn_file_actions_addchdir_np(file_actions, path); } return ENOSYS; -#elif defined(__OpenBSD__) - // Currently missing as of: - // - OpenBSD 7.5 (April 2024) - return ENOSYS; -#elif defined(__GLIBC__) || defined(__APPLE__) || defined(__FreeBSD__) || (defined(__ANDROID__) && __ANDROID_API__ >= 34) || defined(__musl__) +#elif defined(__GLIBC__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__ANDROID__) || defined(__musl__) // Pre-standard posix_spawn_file_actions_addchdir_np version available in: // - Solaris 11.3 (October 2015) // - Glibc 2.29 (February 2019) @@ -106,7 +106,6 @@ static int posix_spawn_file_actions_addchdir_polyfill(posix_spawn_file_actions_t // Standardized posix_spawn_file_actions_addchdir version (POSIX.1-2024, June 2024) available in: // - Solaris 11.4 (August 2018) // - NetBSD 10.0 (March 2024) - // - QNX 8 (December 2023) return posix_spawn_file_actions_addchdir((posix_spawn_file_actions_t *)file_actions, path); #endif }