Skip to content

Commit cc33585

Browse files
committed
Consumers affected by void returns
Work in progress...
1 parent 31c4bc3 commit cc33585

4 files changed

Lines changed: 15 additions & 22 deletions

File tree

‎src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.SunOS.cs‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,7 @@ private Interop.procfs.ProcessInfo GetProcInfo()
126126
{
127127
EnsureState(State.HaveNonExitedId);
128128
Interop.procfs.ProcessInfo processInfo;
129-
if (!Interop.procfs.GetProcessInfoById(_processId, out processInfo))
130-
{
131-
throw new Win32Exception(SR.ProcessInformationUnavailable);
132-
}
129+
Interop.procfs.GetProcessInfoById(_processId, out processInfo))
133130
return processInfo;
134131
}
135132
}

‎src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.SunOS.cs‎

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,14 @@ internal static ProcessModuleCollection GetModules(int processId)
5757

5858
string argString;
5959
Interop.procfs.ProcessInfo processInfo;
60-
if (Interop.procfs.GetProcessInfoById(processId, out processInfo, out argString))
60+
Interop.procfs.GetProcessInfoById(processId, out processInfo, out argString)
61+
string? fullName = Process.GetUntruncatedProcessName(ref processInfo, ref argString);
62+
if (!string.IsNullOrEmpty(fullName))
6163
{
62-
string? fullName = Process.GetUntruncatedProcessName(ref processInfo, ref argString);
63-
if (!string.IsNullOrEmpty(fullName))
64+
return new ProcessModuleCollection(1)
6465
{
65-
return new ProcessModuleCollection(1)
66-
{
67-
new ProcessModule(fullName, Path.GetFileName(fullName))
68-
};
69-
}
66+
new ProcessModule(fullName, Path.GetFileName(fullName))
67+
};
7068
}
7169
return new ProcessModuleCollection(0);
7270
}
@@ -81,11 +79,7 @@ internal static ProcessModuleCollection GetModules(int processId)
8179

8280
Interop.procfs.ProcessInfo processInfo;
8381
string argString;
84-
if (!Interop.procfs.GetProcessInfoById(pid, out processInfo, out argString))
85-
{
86-
return null;
87-
}
88-
82+
Interop.procfs.GetProcessInfoById(pid, out processInfo, out argString)
8983
string? processName = Process.GetUntruncatedProcessName(ref processInfo, ref argString);
9084
if (!string.IsNullOrEmpty(processNameFilter) &&
9185
!string.Equals(processName, processNameFilter, StringComparison.OrdinalIgnoreCase))
@@ -176,7 +170,11 @@ internal static ProcessInfo CreateProcessInfo(ref Interop.procfs.ProcessInfo pro
176170
Interop.procfs.ThreadInfo threadInfo;
177171
ThreadInfo? ti;
178172

179-
if (!Interop.procfs.GetThreadInfoById(pid, tid, out threadInfo))
173+
try
174+
{
175+
Interop.procfs.GetThreadInfoById(pid, tid, out threadInfo))
176+
}
177+
catch (Exception ex)
180178
{
181179
continue;
182180
}

‎src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.SunOS.cs‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,7 @@ private static System.Diagnostics.ThreadPriorityLevel GetThreadPriorityFromSysPr
121121
private Interop.procfs.ThreadInfo GetThreadInfo()
122122
{
123123
Interop.procfs.ThreadInfo threadInfo;
124-
if (!Interop.procfs.GetThreadInfoById(_processId, tid: Id, out threadInfo))
125-
{
126-
throw new InvalidOperationException(SR.Format(SR.ThreadExited, Id));
127-
}
124+
Interop.procfs.GetThreadInfoById(_processId, tid: Id, out threadInfo)
128125
return threadInfo;
129126
}
130127
}

‎src/libraries/System.Private.CoreLib/src/System/Environment.SunOS.cs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ namespace System
77
{
88
public static partial class Environment
99
{
10+
// XXX the void returns complicate this. FIX ME
1011
public static long WorkingSet => (long)(Interop.procfs.GetProcessInfoById(ProcessId, out Interop.procfs.ProcessInfo iProcInfo) ? iProcInfo.ResidentSetSize : 0);
1112
}
1213
}

0 commit comments

Comments
 (0)