Skip to content

Implement SafeProcessHandle APIs for Linux and other Unixes#124979

Draft
Copilot wants to merge 4 commits intocopilot/implement-safeprocesshandle-apisfrom
copilot/implement-safeprocesshandle-apis-again
Draft

Implement SafeProcessHandle APIs for Linux and other Unixes#124979
Copilot wants to merge 4 commits intocopilot/implement-safeprocesshandle-apisfrom
copilot/implement-safeprocesshandle-apis-again

Conversation

Copy link
Contributor

Copilot AI commented Feb 27, 2026

  • Update src/native/libs/configure.cmake with new feature detection checks for Linux (clone3, pidfd_send_signal, close_range, pdeathsig, sys_tgkill)
  • Update src/native/libs/Common/pal_config.h.in with new #cmakedefine01 entries for the new features
  • Update src/native/libs/System.Native/pal_process.c:
    • Add necessary includes for sys/syscall.h, linux/sched.h, sys/prctl.h
    • Define HAVE_PIDFD when HAVE_CLONE3 is available
    • Replace the #else (ENOTSUP) branch in SystemNative_SpawnProcess with fork/exec path using clone3/fork/vfork
    • Update SystemNative_SendSignal to use pidfd_send_signal when available
    • Add pidfd-based map_wait_status_pidfd using siginfo_t for pidfd path
    • Update SystemNative_TryGetExitCode to use waitid(P_PIDFD) when pidfd available
    • Update SystemNative_WaitForExitAndReap to use waitid(P_PIDFD) when pidfd available
    • Update SystemNative_TryWaitForExitCancellable to use poll with pidfd when available
    • Update SystemNative_TryWaitForExit to use poll with pidfd when available
    • Update SystemNative_OpenProcess to use waitid verification and pidfd_open when available
  • Update test files:
    • Change SafeProcessHandleTests.Unix.cs from [PlatformSpecific(TestPlatforms.OSX)] to [PlatformSpecific(TestPlatforms.AnyUnix)]
    • Change SafeProcessHandleTests.cs from [PlatformSpecific(TestPlatforms.OSX | TestPlatforms.Windows)] to [PlatformSpecific(TestPlatforms.AnyUnix | TestPlatforms.Windows)]
  • Native code compiles successfully
  • All 395 tests pass (0 failures), including all 23 SafeProcessHandle tests
  • Address review feedback: consolidate sys/syscall.h includes

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-io
See info in area-owners.md if you want to be subscribed.

Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
Copy link
Member

@adamsitnik adamsitnik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot So far I've found only one nit.

Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement SafeProcessHandle APIs for other Unixes Implement SafeProcessHandle APIs for Linux and other Unixes Feb 27, 2026
Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants