-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
SunOS process and thread support #105403
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. |
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.
As there are different teams owning these areas, CoreCLR (runtime) changes should be in separate PR than libraries. Also, please run the PAL tests against this change when you open a separate PR.
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.
OK, I figured we might need to do that. Do all 8 commits need to be separate PRs? Or can some be combined?
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.
I think everything which is not related to "System.Diagnostics.Process SunOS port" should be in separate PR. i.e. keep src/libraries
and src/native/libs
changes and move the rest.
|
||
internal static partial class Interop | ||
{ | ||
internal static partial class @procfs |
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.
Is it missing the functionality or here to-be-filled in the future? In case it's the latter, lets delete it for now.
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.
It looks like the original idea was to split up that code. That may still make sense later -- I'm not sure.
I find this file name: Interop.ProcFsStat.TryReadProcessStatusInfo.cs to be annoyingly long.
How about I delete that and put this all in Interop.ProcFsStat.cs instead?
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.
Based on https://github.com/dotnet/runtime/blob/dff1d8467845fd93c517f89dc81598e5fd17c270/docs/coding-guidelines/interop-guidelines.md, we can move:
- struct definitions in
Interop.ProcFs.Definitions.cs
- then for each internal method like TryReadProcessStatusInfo, TryReadProcessThreadInfo etc. create a separate Interop.ProcFs.XX.cs file.
Linux procfs is not using this approach because it wasn't upgraded when guidelines were written, but for new platform port, we can follow the guidelines to keep things tidy.
If something (struct, const or a method method) is not used outside the @procfs
class, change internal
to private
.
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.
Based on https://github.com/dotnet/runtime/blob/dff1d8467845fd93c517f89dc81598e5fd17c270/docs/coding-guidelines/interop-guidelines.md, we can move:
- struct definitions in
Interop.ProcFs.Definitions.cs
- then for each internal method like TryReadProcessStatusInfo, TryReadProcessThreadInfo etc. create a separate Interop.ProcFs.XX.cs file.
I tried moving some of the structs and stuff like RootPath but then the C# compiler did not "know about" the structures in the other file. Any tips on how to do that? Thanks!
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.
Did you add lines for new files in src/libraries/System.Diagnostics.Process/src/System.Diagnostics.Process.csproj?
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.
Yes, and it seems like that *.csproj file is being ignored. New files I add are apparently ignored. Files I've removed are still being looked for, and I don't see why. Eg.
CSC : error CS2001: Source file '/home/gwr/dotnet/runtime/src/libraries/Common/src/Interop/SunOS/procfs/Interop.ProcFsStat.TryReadProcessStatusInfo.cs' could not be found. [/home/gwr/dotnet/runtime/src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj]
What am I missing?
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.
Oh, found it:
src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems
@@ -1,7 +1,7 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
|
|||
<PropertyGroup> | |||
<TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-freebsd;$(NetCoreAppCurrent)-linux;$(NetCoreAppCurrent)-osx;$(NetCoreAppCurrent)-maccatalyst;$(NetCoreAppCurrent)-ios;$(NetCoreAppCurrent)-tvos;$(NetCoreAppCurrent)</TargetFrameworks> | |||
<TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-freebsd;$(NetCoreAppCurrent)-linux;$(NetCoreAppCurrent)-osx;$(NetCoreAppCurrent)-maccatalyst;$(NetCoreAppCurrent)-ios;$(NetCoreAppCurrent)-tvos;$(NetCoreAppCurrent)-illumos;$(NetCoreAppCurrent)</TargetFrameworks> |
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.
Lets keep then in sync for now:
<TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-freebsd;$(NetCoreAppCurrent)-linux;$(NetCoreAppCurrent)-osx;$(NetCoreAppCurrent)-maccatalyst;$(NetCoreAppCurrent)-ios;$(NetCoreAppCurrent)-tvos;$(NetCoreAppCurrent)-illumos;$(NetCoreAppCurrent)</TargetFrameworks> | |
<TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-freebsd;$(NetCoreAppCurrent)-linux;$(NetCoreAppCurrent)-osx;$(NetCoreAppCurrent)-maccatalyst;$(NetCoreAppCurrent)-ios;$(NetCoreAppCurrent)-tvos;$(NetCoreAppCurrent)-illumos;$(NetCoreAppCurrent)-solaris;$(NetCoreAppCurrent)</TargetFrameworks> |
@@ -363,6 +363,19 @@ | |||
Link="Common\Interop\FreeBSD\Interop.Process.GetProcInfo.cs" /> | |||
</ItemGroup> | |||
|
|||
<ItemGroup Condition="'$(TargetPlatformIdentifier)' == 'illumos' or '$(TargetPlatformIdentifier)' == 'sunos'"> |
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.
<ItemGroup Condition="'$(TargetPlatformIdentifier)' == 'illumos' or '$(TargetPlatformIdentifier)' == 'sunos'"> | |
<ItemGroup Condition="'$(TargetPlatformIdentifier)' == 'illumos' or '$(TargetPlatformIdentifier)' == 'solaris'"> |
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.SunOS.cs
Outdated
Show resolved
Hide resolved
@@ -629,7 +629,7 @@ public void TestMinWorkingSet() | |||
Assert.InRange((long)p.MinWorkingSet, 0, long.MaxValue); | |||
} | |||
|
|||
if (OperatingSystem.IsMacOS() || OperatingSystem.IsFreeBSD()) { | |||
if (PlatformDetection.IsBsdLike || PlatformDetection.IsSunOS) { |
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.
IsBsdLike includes more platforms than this code was tested against. I'd keep the existing part of the condition untouched.
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.
Are your sure? I looked at the implementation of IsBsdLike() and it appeared to me that all the platforms that includes use the same get/set Min/Max WorkingSet code that only supports acting on the current 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.
OperatingSystem.IsMacOS() || OperatingSystem.IsFreeBSD()
does not include iOS, macCatalyst, NetBSD etc. which IsBsdLike is pulling.
Besides, anything which is not part of the port work is best left for other PRs. This is to make the review process easier for all participants.
@@ -574,7 +574,7 @@ public void TestMaxWorkingSet() | |||
Assert.InRange((long)p.MinWorkingSet, 0, long.MaxValue); | |||
} | |||
|
|||
if (OperatingSystem.IsMacOS() || OperatingSystem.IsFreeBSD()) { | |||
if (PlatformDetection.IsBsdLike || PlatformDetection.IsSunOS) { |
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.
Same here.
@@ -57,6 +57,8 @@ private static IntPtr ProcessorAffinityCore | |||
/// </summary> | |||
private void GetWorkingSetLimits(out IntPtr minWorkingSet, out IntPtr maxWorkingSet) | |||
{ | |||
EnsureState(State.HaveNonExitedId); |
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.
This looks like a good change if you have tested it on FreeBSD, but it would be best to submit it as a separate improvement and not part of other platform port.
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.
Right, though it's pretty simple. The test is complaining that we throw the wrong exception code.
This makes it throw the right code for a process object that has not yet started.
I'm not in a position test on FreeBSD at the moment. Are there FreeBSD people around who could help me?
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.
I'm not in a position test on FreeBSD at the moment. Are there FreeBSD people around who could help me?
Which is why it is best to put it in a separate PR, so someone can test before approving it.
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.
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 |
Read binary psinfo for System.Diagnostic.Process on SunOS Thanks for initial prototype help from: Austin Wise <AustinWise@gmail.com>
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.