-
Notifications
You must be signed in to change notification settings - Fork 5k
SunOS process and thread support #105403
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?
SunOS process and thread support #105403
Conversation
Tagging subscribers to this area: @dotnet/area-system-diagnostics-process |
Lets drop the changes which are already submitted in other PRs. |
src/libraries/Common/src/Interop/SunOS/procfs/Interop.ProcFsStat.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Diagnostics.Process/src/System.Diagnostics.Process.csproj
Outdated
Show resolved
Hide resolved
src/libraries/System.Diagnostics.Process/src/System.Diagnostics.Process.csproj
Outdated
Show resolved
Hide resolved
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.SunOS.cs
Show resolved
Hide resolved
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.BSD.cs
Outdated
Show resolved
Hide resolved
Good start! I've left initial feedback, which I anticipate the maintainers will point out. :) |
Thanks. I had not yet seen #105207 when I opened this. I think @AustinWise and I should figure out how to get the prerequisite fixes shown there (and here) all integrated, and then I'll rebase the last parts of this onto that. |
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.SunOS.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.SunOS.cs
Outdated
Show resolved
Hide resolved
I'd love to, but I do not see a way to do "stacked" PRs, where one PR targets the branch of another PR. |
Create a local branch |
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 C# for reading from procfs and enumerating threads/processes looks good to me.
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.SunOS.cs
Outdated
Show resolved
Hide resolved
Rebased and squashed |
Looks good to me. Thanks for this @gwr! This is one major step to complete the shared framework on illumos-x64 and enabling msbuild/sdk. 👍 @adamsitnik, @jkotas, PTAL. |
@gwr fyi, we are not required to rebase for every commit merging in main branch. It's rather a busy repo so GH will likely always show you that your branch is behind by X number of commits. The maintainers can do the rebase if deemed necessary. |
Read binary psinfo for System.Diagnostic.Process on SunOS Thanks for initial prototype help from: Austin Wise <AustinWise@gmail.com> Add Try prefix to SunOS Interop functions Get rid of unsafe for procfs get methods
Updated to fix a comment (nit) |
OK, thanks. Won't do it too often. |
Here too; Can anyone tell me what to do about the runtime checks that reported failure? |
Don't worry about them. They are not related to your change. |
nudge 2 |
nudge 3 |
Please excuse me for lack of response, I am busy fixing some last minute bugs for .NET 9. I should be less busy after the RC2 branch snap next week and I hope to be able to review it then. |
Sorry for the delay on this, @gwr. I just merged main into your branch to get a fresh build. |
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 introduces SunOS (Solaris and illumos) support for System.Diagnostics.Process by implementing new SunOS-specific interop routines and process/thread management code. Key changes include:
- New files for reading process and thread information from procfs on SunOS.
- Updates to process and thread APIs to support SunOS properties and priority mapping.
- Adjustments in test utilities and environment code to incorporate SunOS detection and behavior.
Reviewed Changes
Copilot reviewed 12 out of 17 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.SunOS.cs | Implements SunOS thread info retrieval and property mapping. |
src/libraries/Common/src/Interop/SunOS/procfs/Interop.ProcFs.TryGetProcessInfoById.cs | Adds support for reading process info from procfs on SunOS. |
src/libraries/Common/src/Interop/SunOS/procfs/Interop.ProcFs.TryGetThreadInfoById.cs | Provides SunOS-specific thread info retrieval from procfs. |
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.SunOS.cs | Implements SunOS properties for Process, including start time and CPU time calculation. |
src/libraries/Common/src/Interop/SunOS/procfs/Interop.ProcFs.Definitions.cs | Defines SunOS procfs structures and constants. |
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.SunOS.cs | Integrates process management and enumeration for SunOS. |
src/libraries/Common/src/Interop/Unix/System.Native/Interop.TimeSpec.cs | Introduces a TimeSpec struct for time conversions. |
src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs | Updates platform detection to include SunOS. |
src/libraries/System.Diagnostics.Process/tests/ProcessTests.cs | Adjusts tests to handle working set issues on SunOS. |
src/libraries/System.Private.CoreLib/src/System/Environment.SunOS.cs | Updates environment working set retrieval for SunOS. |
src/libraries/Common/src/Interop/Unix/System.Native/Interop.UTimensat.cs | Removes duplicate TimeSpec definition. |
src/libraries/Common/src/Interop/SunOS/procfs/Interop.ProcFsStat.TryReadProcessStatusInfo.cs | Removes legacy status info retrieval code. |
Files not reviewed (5)
- src/libraries/System.Diagnostics.Process/src/System.Diagnostics.Process.csproj: Language not supported
- src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems: Language not supported
- src/native/libs/System.Native/entrypoints.c: Language not supported
- src/native/libs/System.Native/pal_io.c: Language not supported
- src/native/libs/System.Native/pal_io.h: Language not supported
Comments suppressed due to low confidence (1)
src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs:48
- [nitpick] Consider renaming 'Isillumos' to 'IsIllumos' for improved readability and consistency with .NET naming conventions.
public static bool Isillumos => RuntimeInformation.IsOSPlatform(OSPlatform.Create("ILLUMOS"));
|
||
// Iterate through all process IDs to load information about each process | ||
IEnumerable<int> pids = EnumerateProcessIds(); | ||
ArrayBuilder<ProcessInfo> processes = default; |
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.
Ensure that ArrayBuilder is properly instantiated instead of using the default value to prevent potential NullReferenceExceptions when adding items.
ArrayBuilder<ProcessInfo> processes = default; | |
ArrayBuilder<ProcessInfo> processes = new ArrayBuilder<ProcessInfo>(); |
Copilot uses AI. Check for mistakes.
Read binary psinfo for System.Diagnostic.Process on SunOS (Solaris or illumos).
No failures in System.Diagnostic.Process.Tests (but lots of skip)
BTW, I tried rebasing on main from Mon. this week and ran into problems downloading stuff.
Not sure why, but it didn't seem to have anything to do with my changes.