Haiku: Process/thread management functions#121883
Haiku: Process/thread management functions#121883trungnt2910 wants to merge 15 commits intodotnet:mainfrom
Conversation
|
C/c @am11 I just added the relevant parts of the common files to both, then we can rebase stuff later. |
There was a problem hiding this comment.
Pull request overview
This PR adds Haiku operating system support to the System.Diagnostics.Process library, enabling process and thread management functionality for Haiku. This is part of the broader effort to support Haiku as a platform (#55803).
- Implements Haiku-specific process/thread management APIs using native Haiku system calls
- Adds proper platform attribute annotations for API surface compatibility
- Integrates Haiku interop layer for process, thread, and image information
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
ProcessThread.cs |
Adds [SupportedOSPlatform("haiku")] attributes to PriorityLevel property getter and setter |
ProcessThread.Haiku.cs |
Implements Haiku-specific thread priority management and processor time tracking using native BeOS-style priority values |
ProcessManager.Haiku.cs |
Implements process enumeration, module collection, and process information retrieval for Haiku using team and thread APIs |
Process.cs |
Adds [UnsupportedOSPlatform("haiku")] attributes to working set limit properties |
Process.Haiku.cs |
Implements Haiku-specific process properties including boot time caching, start time, processor time tracking, and platform-specific helper methods |
System.Diagnostics.Process.csproj |
Adds Haiku target framework and includes Haiku-specific source files and interop definitions |
Interop.OS.cs |
Defines Haiku native interop for OS-level APIs including team/thread/area/system information structures and P/Invoke declarations |
Interop.Libraries.cs |
Defines the libroot library constant for Haiku native library imports |
Interop.Image.cs |
Defines Haiku native interop for image (module) information APIs |
| @@ -100,6 +101,7 @@ public ThreadPriorityLevel PriorityLevel | |||
| return _priorityLevel.Value; | |||
| } | |||
| [SupportedOSPlatform("windows")] | |||
There was a problem hiding this comment.
The setter is missing [SupportedOSPlatform("linux")] and [SupportedOSPlatform("freebsd")] attributes. While these platforms throw PlatformNotSupportedException in their implementations, the attributes on the public API should match the getter's attributes to maintain consistency and accuracy in the API surface declarations. The presence of the getter attribute for these platforms indicates the API should be callable, even if it throws at runtime.
| [SupportedOSPlatform("windows")] | |
| [SupportedOSPlatform("windows")] | |
| [SupportedOSPlatform("linux")] | |
| [SupportedOSPlatform("freebsd")] |
There was a problem hiding this comment.
Ignoring since it's not related to Haiku.
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Haiku.cs
Outdated
Show resolved
Hide resolved
3db3a8c to
822ecd1
Compare
822ecd1 to
7863bab
Compare
b7ee79c to
f458cbd
Compare
|
Still tracking, will take action soon. |
|
@trungnt2910 I pushed 0ee9ed3 to my fork; it merges main into your branch and resolves the conflict. Feel free to cherry-pick that commit if it's helpful. |
Add support for process/thread management functions in `System.Diagnostics.Process` for Haiku. This is required to build managed runtime libraries for Haiku as well as running a simple "Hello, World!" application. Co-authored-by: Jessica Hamilton <jessica.l.hamilton@gmail.com>
Declare Haiku as a supported platform to MSBuild for all `System.Diagnostics.Process` builds. This prevents `CA1418` when using the `SupportedOSPlatform` attribute with `haiku`.
f458cbd to
5ed9cf0
Compare
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Haiku.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Haiku.cs
Outdated
Show resolved
Hide resolved
|
|
||
| while ((Interop.Image.GetNextImageInfo(processId, ref cookie, out info)) == 0) | ||
| { | ||
| string modulePath = GetString(info.name, Interop.Image.MAXPATHLEN); |
There was a problem hiding this comment.
In GetModules, info.name is a fixed buffer field; it can’t be passed directly to a byte* parameter. This likely won’t compile. Use a fixed (byte* pName = info.name) block (or change GetString to accept a span) and pass the pinned pointer.
| string modulePath = GetString(info.name, Interop.Image.MAXPATHLEN); | |
| string modulePath; | |
| fixed (byte* pName = info.name) | |
| { | |
| modulePath = GetString(pName, Interop.Image.MAXPATHLEN); | |
| } |
There was a problem hiding this comment.
Haven't seen any errors so far.
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Haiku.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Haiku.cs
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Haiku.cs
Show resolved
Hide resolved
`System.Collections.Generic` is used by `ArrayBuilder`. I am a victim of Copilot slop.
|
Local builds are succeeding in both Release and Debug mode (with all my other open PRs on native components applied). |
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Haiku.cs
Outdated
Show resolved
Hide resolved
Use `ReadOnlySpan` instead of a loop. Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Add support for process/thread management functions in
System.Diagnostics.Processfor Haiku.This is required to build managed runtime libraries for Haiku as well as running a simple "Hello, World!" application.
Part of #55803.