Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions lib/Basic/Subprocess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,21 +79,21 @@ 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
if (__builtin_available(macOS 10.15, *)) {
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)
Expand All @@ -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
}
Expand Down