-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Haiku: Process/thread management functions #121883
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
base: main
Are you sure you want to change the base?
Haiku: Process/thread management functions #121883
Conversation
|
C/c @am11 I just added the relevant parts of the common files to both, then we can rebase stuff later. |
|
Tagging subscribers to this area: @dotnet/area-system-diagnostics-process |
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.
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 |
| } | ||
| return _priorityLevel.Value; | ||
| } | ||
| [SupportedOSPlatform("windows")] |
Copilot
AI
Nov 21, 2025
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
| public delegate* unmanaged<void> init_routine; | ||
| public delegate* unmanaged<void> term_routine; |
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.
Nit: if it's not interested to invoke them from managed code, you can define them as opaque IntPtr.
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.
Maybe an opaque void* instead, since the other members are void*?
Those two correspond to https://github.com/haiku/haiku/blob/d39ce117e02d3d8aac966b1a46bd955a2b59c069/headers/os/kernel/image.h#L27-L28 in the Haiku source.
void (*init_routine)();
void (*term_routine)();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.
Semantic-wise void* is incorrect because function pointers can't be dereferenced. In C function pointers can't be casted to void* either. IntPtr is correct for opaque pointer-size field. Unmanaged function pointer is precise but unnecessary.
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 <[email protected]>
822ecd1 to
7863bab
Compare
Declare Haiku as a supported platform to MSBuild for all `System.Diagnostics.Process` builds. This prevents `CA1418` when using the `SupportedOSPlatform` attribute with `haiku`.
2070b2b to
b7ee79c
Compare
b7ee79c to
f458cbd
Compare
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.