-
Notifications
You must be signed in to change notification settings - Fork 209
Return ENOSYS for posix_spawn_file_actions_addchdir on older Android versions #985
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
jakepetroules
merged 4 commits into
swiftlang:main
from
swift-everywhere:android-posix-spawn-fix
May 21, 2025
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
fc947c0
Return ENOSYS for posix_spawn_file_actions_addchdir on older Android …
marcprux 40f777c
Update __ANDROID_ check to add __ANDROID_API__ < 34
marcprux 70783fd
Merge __ANDROID__ with __GLIBC__ and __OpenBSD__ checks for posix_spa…
marcprux 2cfc9eb
Add __QNX__ as not supporting posix_spawn_file_actions_addchdir
marcprux File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,20 +79,19 @@ 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) | ||
// 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) | ||
// - 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__) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The ANDROID_API >= 34 bit is no longer needed. |
||
// Pre-standard posix_spawn_file_actions_addchdir_np version available in: | ||
// - Solaris 11.3 (October 2015) | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While you're here, could you move the QNX 8 comment here too?. The function is actually missing on that platform. It is mistakenly labeled as supported due to an error in earlier refactoring.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume you also want to add a check for
defined(__QNX__)
for that block? I've moved the comment and added the check in 2cfc9eb