Uh oh!
There was an error while loading. Please reload this page.
Improve Process support on MacCatalyst: use posix_spawn - #126478
Merged
Conversation
Contributor
Tagging subscribers to this area: @dotnet/area-system-diagnostics-process |
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/821389c5-8982-47c1-80e8-b56290fc0176 Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
CopilotAI
changed the title
[WIP] Improve process support on MacCatalystImprove Process support on MacCatalystApr 2, 2026
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Apr 3, 2026
Open
adamsitnik
left a comment
Member
There was a problem hiding this comment.
@copilot please address my feedback
Uh oh!
There was an error while loading. Please reload this page.
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/01f47512-0d0e-42a7-b061-43f1cfb8a932 Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
CopilotAI
changed the title
Improve Process support on MacCatalystImprove Process support on MacCatalyst: use posix_spawnApr 10, 2026
jkotas
approved these changes
Apr 10, 2026
…f TARGET_MACCATALYST guards Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/e578bc53-d1e7-41bb-ad79-023a0863881a Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
CopilotAI
requested review from
adamsitnik and Copilot
and removed request for
CopilotApril 11, 2026 07:38
Uh oh!
There was an error while loading. Please reload this page.
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/c8eaa6ec-270a-4e03-bcbe-07aa37d8fb8a Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
CopilotAI
requested review from
adamsitnik and Copilot
and removed request for
CopilotApril 11, 2026 08:45
adamsitnik
commented
Apr 11, 2026
Member
/azp run runtime-maccatalyst |
|
Azure Pipelines successfully started running 1 pipeline(s). |
rolfbjarne
approved these changes
Apr 13, 2026
Uh oh!
There was an error while loading. Please reload this page.
… line Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/c5fe5049-df05-42ae-b847-40fd252f4a0f Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
rolfbjarne
approved these changes
Apr 13, 2026
adamsitnik
commented
Apr 13, 2026
Member
/ba-g WASM build timeout is unrelated |
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
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
MacCatalyst was missing the fast process spawning path available on macOS via
posix_spawn. Before this change, MacCatalyst had no working code path inSystemNative_ForkAndExecProcess— it fell through to the#else return -1fallback with*childPiduninitialized, since bothHAVE_FORK(disabled by kernel restriction inconfigure.cmake) andTARGET_OSXwere false for MacCatalyst.Description
configure.cmakecheck_symbol_exists(posix_spawn_file_actions_addchdir_np spawn.h HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR_NP)to detect availability ofposix_spawn_file_actions_addchdir_npat configure time. The existing-Wunguarded-availabilityflag ensures this check correctly fails for platforms (e.g. MacCatalyst) where the function is marked__API_UNAVAILABLEin the SDK, making the guard future-proof if the function becomes available on those platforms.src/native/libs/Common/pal_config.h.in#cmakedefine01 HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR_NPso the capability macro detected by CMake is emitted into the generatedpal_config.hheader used bypal_process.c.Native (
pal_process.c)posix_spawnpath to MacCatalyst by changing#if defined(TARGET_OSX)to#if defined(TARGET_OSX) || defined(TARGET_MACCATALYST)for both the argument/initialization guard and theposix_spawnblock. Previously, MacCatalyst had no functional code path for process spawning.#if HAVE_FORK || defined(TARGET_OSX)guard to includeTARGET_MACCATALYST, ensuring*childPidis properly initialized to-1and theaccess()pre-check runs on MacCatalyst.TARGET_MACCATALYST-specific early-fail block with two capability-based guards:#if !HAVE_FORK— fails fast witherrno = ENOTSUPwhensetCredentials=true, since setuid/setgid-based credential changes requirefork, which is blocked by the kernel at runtime on MacCatalyst (EPERM). The in-code comment explains this constraint.#if !HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR_NP— fails fast witherrno = ENOTSUPwhencwd != NULL, since the function is unavailable on MacCatalyst.posix_spawn_file_actions_addchdir_npcall site with#if HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR_NP(previously#if !defined(TARGET_MACCATALYST)) to fix the build error and make the guard forward-compatible.// Change working directory if specifiedcomment to the end of theposix_spawn_file_actions_addchdir_npline where it belongs.