228 references to Interop
System.Diagnostics.Process (228)
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\LibraryImports.g.cs (50)
7
internal static extern partial global::
Interop
.Error ConvertErrorPlatformToPal(int platformErrno);
15
internal static extern partial int ConvertErrorPalToPlatform(global::
Interop
.Error error);
31
internal static unsafe extern partial global::
Interop
.Error Poll(global::
Interop
.PollEvent* pollEvents, uint eventCount, int timeout, uint* triggered);
401
internal static partial long SysConf(global::
Interop
.Sys.SysConfName name)
416
static extern unsafe long __PInvoke(global::
Interop
.Sys.SysConfName __name_native);
514
internal static unsafe partial int GetPwUidR(uint uid, out global::
Interop
.Sys.Passwd pwd, byte* buf, int bufLen)
521
fixed (global::
Interop
.Sys.Passwd* __pwd_native = &pwd)
528
static extern unsafe int __PInvoke(uint __uid_native, global::
Interop
.Sys.Passwd* __pwd_native, byte* __buf_native, int __bufLen_native);
538
internal static unsafe partial int GetPwNamR(string name, out global::
Interop
.Sys.Passwd pwd, byte* buf, int bufLen)
552
fixed (global::
Interop
.Sys.Passwd* __pwd_native = &pwd)
567
static extern unsafe int __PInvoke(byte* __name_native, global::
Interop
.Sys.Passwd* __pwd_native, byte* __buf_native, int __bufLen_native);
577
private static partial int GetPriority(global::
Interop
.Sys.PriorityWhich which, int who)
592
static extern unsafe int __PInvoke(global::
Interop
.Sys.PriorityWhich __which_native, int __who_native);
602
internal static partial int SetPriority(global::
Interop
.Sys.PriorityWhich which, int who, int nice)
617
static extern unsafe int __PInvoke(global::
Interop
.Sys.PriorityWhich __which_native, int __who_native, int __nice_native);
861
internal static partial int GetRLimit(global::
Interop
.Sys.RlimitResources resourceType, out global::
Interop
.Sys.RLimit limits)
869
fixed (global::
Interop
.Sys.RLimit* __limits_native = &limits)
879
static extern unsafe int __PInvoke(global::
Interop
.Sys.RlimitResources __resourceType_native, global::
Interop
.Sys.RLimit* __limits_native);
889
internal static partial int SetRLimit(global::
Interop
.Sys.RlimitResources resourceType, ref global::
Interop
.Sys.RLimit limits)
896
fixed (global::
Interop
.Sys.RLimit* __limits_native = &limits)
906
static extern unsafe int __PInvoke(global::
Interop
.Sys.RlimitResources __resourceType_native, global::
Interop
.Sys.RLimit* __limits_native);
916
private static partial int PathConf(string path, global::
Interop
.Sys.PathConfName name)
946
static extern unsafe int __PInvoke(byte* __path_native, global::
Interop
.Sys.PathConfName __name_native);
1011
internal static partial int Access(string path, global::
Interop
.Sys.AccessMode mode)
1041
static extern unsafe int __PInvoke(byte* __path_native, global::
Interop
.Sys.AccessMode __mode_native);
1051
internal static partial int Access(global::System.ReadOnlySpan<char> path, global::
Interop
.Sys.AccessMode mode)
1081
static extern unsafe int __PInvoke(byte* __path_native, global::
Interop
.Sys.AccessMode __mode_native);
1091
internal static partial int FStat(global::System.Runtime.InteropServices.SafeHandle fd, out global::
Interop
.Sys.FileStatus output)
1106
fixed (global::
Interop
.Sys.FileStatus* __output_native = &output)
1124
static extern unsafe int __PInvoke(nint __fd_native, global::
Interop
.Sys.FileStatus* __output_native);
1134
internal static partial int Stat(string path, out global::
Interop
.Sys.FileStatus output)
1149
fixed (global::
Interop
.Sys.FileStatus* __output_native = &output)
1167
static extern unsafe int __PInvoke(byte* __path_native, global::
Interop
.Sys.FileStatus* __output_native);
1177
internal static partial int LStat(string path, out global::
Interop
.Sys.FileStatus output)
1192
fixed (global::
Interop
.Sys.FileStatus* __output_native = &output)
1210
static extern unsafe int __PInvoke(byte* __path_native, global::
Interop
.Sys.FileStatus* __output_native);
1220
internal static partial int Stat(global::System.ReadOnlySpan<char> path, out global::
Interop
.Sys.FileStatus output)
1235
fixed (global::
Interop
.Sys.FileStatus* __output_native = &output)
1253
static extern unsafe int __PInvoke(byte* __path_native, global::
Interop
.Sys.FileStatus* __output_native);
1263
internal static partial int LStat(global::System.ReadOnlySpan<char> path, out global::
Interop
.Sys.FileStatus output)
1278
fixed (global::
Interop
.Sys.FileStatus* __output_native = &output)
1296
static extern unsafe int __PInvoke(byte* __path_native, global::
Interop
.Sys.FileStatus* __output_native);
1415
internal static partial int GetSpaceInfoForMountPoint(string name, out global::
Interop
.Sys.MountPointInformation mpi)
1430
fixed (global::
Interop
.Sys.MountPointInformation* __mpi_native = &mpi)
1448
static extern unsafe int __PInvoke(byte* __name_native, global::
Interop
.Sys.MountPointInformation* __mpi_native);
Microsoft\Win32\SafeHandles\SafeProcessHandle.Unix.cs (21)
79
int result =
Interop
.Sys.Kill(processId, 0);
83
Interop
.ErrorInfo errorInfo =
Interop
.Sys.GetLastErrorInfo();
85
if (errorInfo.Error ==
Interop
.Error.EPERM)
90
if (errorInfo.Error ==
Interop
.Error.ESRCH || errorInfo.Error ==
Interop
.Error.EINVAL)
114
int signalNumber =
Interop
.Sys.GetPlatformSignalNumber(signal);
120
int killResult =
Interop
.Sys.Kill(ProcessId, signalNumber);
123
Interop
.ErrorInfo errorInfo =
Interop
.Sys.GetLastErrorInfo();
126
if (errorInfo.Error ==
Interop
.Error.ESRCH)
263
Interop
.Sys.AllocArgvArray(argv, ref argvPtr);
264
Interop
.Sys.AllocEnvpArray(startInfo.Environment, ref envpPtr);
377
throw new Win32Exception(
Interop
.Errors.ERROR_NO_ASSOCIATION, SR.Format(SR.UseShellExecuteVerbNotSupported, verb));
408
filename = Process.GetPathToOpenFile() ?? throw new Win32Exception(
Interop
.Errors.ERROR_NO_ASSOCIATION, SR.UseShellExecuteNoOpenProgram);
439
Interop
.ErrorInfo error =
Interop
.Error.ENOENT.Info();
460
errno =
Interop
.Sys.ForkAndExecProcess(
493
new
Interop
.ErrorInfo(errno).Error ==
Interop
.Error.ENOEXEC)
498
throw ProcessUtils.CreateExceptionForErrorStartingProcess(new
Interop
.ErrorInfo(errno).GetErrorMessage(), errno, resolvedFilename, cwd);
src\runtime\src\libraries\Common\src\Interop\Linux\cgroups\Interop.cgroups.cs (6)
234
Interop
.Error error =
Interop
.procfs.GetFileSystemTypeForRealPath(SysFsCgroupFileSystemPath, out string format);
235
if (error ==
Interop
.Error.SUCCESS)
326
return TryFindHierarchyMount(cgroupVersion,
Interop
.procfs.ProcMountInfoFilePath, subsystem, out root, out path);
347
if (
Interop
.procfs.TryParseMountInfoLine(line, out
Interop
.procfs.ParsedMount mount))
src\runtime\src\libraries\Common\src\Interop\Unix\Interop.Errors.cs (6)
124
_error =
Interop
.Sys.ConvertErrorPlatformToPal(errno);
141
get { return _rawErrno == -1 ? (_rawErrno =
Interop
.Sys.ConvertErrorPalToPlatform(_error)) : _rawErrno; }
146
return
Interop
.Sys.StrError(RawErrno);
220
public static
Interop
.ErrorInfo Info(this
Interop
.Error error)
222
return new
Interop
.ErrorInfo(error);
src\runtime\src\libraries\Common\src\Interop\Unix\System.Native\Interop.GetGroupList.cs (1)
26
rv =
Interop
.Sys.GetGroupList(userName, primaryGroupId, pGroups, &ngroups);
src\runtime\src\libraries\Common\src\Interop\Unix\System.Native\Interop.GetPwUid.cs (5)
37
const int BufLen =
Interop
.Sys.Passwd.InitialBufferSize;
64
Interop
.Sys.Passwd passwd;
65
int error =
Interop
.Sys.GetPwUidR(uid, out passwd, buf, bufLen);
83
var errorInfo = new
Interop
.ErrorInfo(error);
87
if (errorInfo.Error ==
Interop
.Error.ERANGE)
System\Diagnostics\Process.Linux.cs (16)
52
bootTimeTicks =
Interop
.Sys.GetBootTimeTicks();
91
Interop
.procfs.ParsedStat stat = GetStat();
110
if (!ProcessManager.TryGetProcPid(_processId, out
Interop
.procfs.ProcPid procPid))
114
string path =
Interop
.procfs.GetFileDescriptorDirectoryPathForProcess(procPid);
138
if (
Interop
.Sys.SchedGetAffinity(_processId, out set) != 0)
149
if (
Interop
.Sys.SchedSetAffinity(_processId, ref value) != 0)
166
if (!
Interop
.cgroups.TryGetMemoryLimit(out ulong rsslim))
206
internal static string? GetExePath(
Interop
.procfs.ProcPid procPid)
208
return procPid ==
Interop
.procfs.ProcPid.Self ? Environment.ProcessPath :
209
Interop
.Sys.ReadLink(
Interop
.procfs.GetExeFilePathForProcess(procPid));
215
internal static unsafe string GetUntruncatedProcessName(
Interop
.procfs.ProcPid procPid, ref
Interop
.procfs.ParsedStat stat)
217
string cmdLineFilePath =
Interop
.procfs.GetCmdLinePathForProcess(procPid);
314
private
Interop
.procfs.ParsedStat GetStat()
317
Interop
.procfs.ParsedStat stat;
System\Diagnostics\Process.Multiplexing.Unix.cs (26)
45
if (
Interop
.Sys.Fcntl.DangerousSetIsNonBlocking(outputFd, 1) != 0
46
||
Interop
.Sys.Fcntl.DangerousSetIsNonBlocking(errorFd, 1) != 0)
52
Interop
.PollEvent[] pollFds = new
Interop
.PollEvent[2];
73
if (pollFds[i].TriggeredEvents ==
Interop
.PollEvents.POLLNONE)
132
Span<
Interop
.PollEvent> pollFds,
145
pollFds[numFds].Events =
Interop
.PollEvents.POLLIN;
146
pollFds[numFds].TriggeredEvents =
Interop
.PollEvents.POLLNONE;
154
pollFds[numFds].Events =
Interop
.PollEvents.POLLIN;
155
pollFds[numFds].TriggeredEvents =
Interop
.PollEvents.POLLNONE;
168
Span<
Interop
.PollEvent> pollFds,
182
Interop
.Error pollError;
185
fixed (
Interop
.PollEvent* pPollFds = pollFds)
187
pollError =
Interop
.Sys.Poll(pPollFds, (uint)numFds, pollTimeout, &triggered);
191
if (pollError !=
Interop
.Error.SUCCESS)
193
if (pollError ==
Interop
.Error.EINTR)
198
throw new Win32Exception(
Interop
.Sys.ConvertErrorPalToPlatform(pollError));
276
if (
Interop
.Sys.Fcntl.DangerousSetIsNonBlocking(outputFd, 1) != 0 ||
Interop
.Sys.Fcntl.DangerousSetIsNonBlocking(errorFd, 1) != 0)
281
Span<
Interop
.PollEvent> pollFds = stackalloc
Interop
.PollEvent[2];
294
if (pollFds[i].TriggeredEvents ==
Interop
.PollEvents.POLLNONE)
333
int bytesRead =
Interop
.Sys.Read(handle, pBuffer + offset, buffer.Length - offset);
336
Interop
.ErrorInfo errorInfo =
Interop
.Sys.GetLastErrorInfo();
337
if (errorInfo.Error ==
Interop
.Error.EAGAIN)
System\Diagnostics\Process.Unix.cs (21)
78
int signalNumber =
Interop
.Sys.GetPlatformSignalNumber(signal);
84
int killResult =
Interop
.Sys.Kill(_processId, signalNumber);
87
Interop
.Error error =
Interop
.Sys.GetLastError();
90
if (error ==
Interop
.Error.ESRCH)
131
int killResult =
Interop
.Sys.Kill(process._processId,
Interop
.Sys.GetPlatformSignalNumber(PosixSignal.SIGKILL));
134
Interop
.ErrorInfo errorInfo =
Interop
.Sys.GetLastErrorInfo();
136
if (errorInfo.Error !=
Interop
.Error.ESRCH)
170
int stopResult =
Interop
.Sys.Kill(_processId,
Interop
.Sys.GetPlatformSIGSTOP());
173
Interop
.ErrorInfo errorInfo =
Interop
.Sys.GetLastErrorInfo();
175
if (errorInfo.Error !=
Interop
.Error.ESRCH)
329
int errno =
Interop
.Sys.GetPriority(
Interop
.Sys.PriorityWhich.PRIO_PROCESS, _processId, out int pri);
361
int result =
Interop
.Sys.SetPriority(
Interop
.Sys.PriorityWhich.PRIO_PROCESS, _processId, pri);
467
ticksPerSecond =
Interop
.Sys.SysConf(
Interop
.Sys.SysConfName._SC_CLK_TCK);
System\Diagnostics\ProcessManager.Linux.cs (33)
38
if (TryGetProcPid(processId, out
Interop
.procfs.ProcPid procPid) &&
39
Interop
.procfs.TryReadStatFile(procPid, out
Interop
.procfs.ParsedStat stat))
53
if (TryGetProcPid(processId, out
Interop
.procfs.ProcPid procPid))
55
modules =
Interop
.procfs.ParseMapsModules(procPid);
84
if (!TryGetProcPid(pid, out
Interop
.procfs.ProcPid procPid) ||
85
!
Interop
.procfs.TryReadStatFile(procPid, out
Interop
.procfs.ParsedStat stat))
100
Interop
.procfs.TryReadStatusFile(procPid, out
Interop
.procfs.ParsedStatus status);
107
internal static unsafe ProcessInfo CreateProcessInfo(
Interop
.procfs.ProcPid procPid, ref
Interop
.procfs.ParsedStat procFsStat, ref
Interop
.procfs.ParsedStatus procFsStatus, string? processName = null)
131
string tasksDir =
Interop
.procfs.GetTaskDirectoryPathForProcess(procPid);
139
Interop
.procfs.ParsedStat stat;
141
Interop
.procfs.TryReadStatFile(procPid, tid, out stat))
177
foreach (string procDir in Directory.EnumerateDirectories(
Interop
.procfs.RootPath))
232
internal static bool TryReadStatFile(int pid, out
Interop
.procfs.ParsedStat stat)
234
if (!TryGetProcPid(pid, out
Interop
.procfs.ProcPid procPid))
239
return
Interop
.procfs.TryReadStatFile(procPid, out stat);
242
internal static bool TryReadStatusFile(int pid, out
Interop
.procfs.ParsedStatus status)
244
if (!TryGetProcPid(pid, out
Interop
.procfs.ProcPid procPid))
249
return
Interop
.procfs.TryReadStatusFile(procPid, out status);
252
internal static bool TryReadStatFile(int pid, int tid, out
Interop
.procfs.ParsedStat stat)
254
if (!TryGetProcPid(pid, out
Interop
.procfs.ProcPid procPid))
259
return
Interop
.procfs.TryReadStatFile(procPid, tid, out stat);
262
internal static bool TryGetProcPid(int pid, out
Interop
.procfs.ProcPid procPid)
267
procPid =
Interop
.procfs.ProcPid.Self;
273
procPid = (
Interop
.procfs.ProcPid)pid;
278
procPid =
Interop
.procfs.ProcPid.Invalid;
291
if (
Interop
.Sys.ReadLink($"{
Interop
.procfs.RootPath}{
Interop
.procfs.Self}") is string target &&
System\Diagnostics\ProcessManager.Unix.cs (4)
30
int output =
Interop
.Sys.Kill(processId, 0);
32
return 0 == output || (-1 == output &&
Interop
.Error.EPERM ==
Interop
.Sys.GetLastError());
49
machineName !=
Interop
.Sys.GetHostName();
System\Diagnostics\ProcessThread.Linux.cs (7)
23
Interop
.procfs.ParsedStat stat = GetStat();
24
return
Interop
.Sys.GetThreadPriorityFromNiceValue((int)stat.nice);
43
Interop
.procfs.ParsedStat stat = GetStat();
62
Interop
.procfs.ParsedStat stat = GetStat();
78
Interop
.procfs.ParsedStat stat = GetStat();
83
private
Interop
.procfs.ParsedStat GetStat()
85
Interop
.procfs.ParsedStat stat;
System\Diagnostics\ProcessUtils.ConfigureTerminalForChildProcesses.Unix.cs (5)
25
Interop
.Sys.ConfigureTerminalForChildProcess(childUsesTerminal: true);
34
Interop
.Sys.ConfigureTerminalForChildProcess(childUsesTerminal: false);
41
Interop
.Sys.SetDelayedSigChildConsoleConfigurationHandler(&DelayedSigChildConsoleConfiguration);
54
Interop
.Sys.ConfigureTerminalForChildProcess(childUsesTerminal: false);
65
internal static bool IsTerminal(SafeFileHandle? standardHandle) => standardHandle is not null &&
Interop
.Sys.IsATty(standardHandle);
System\Diagnostics\ProcessUtils.Unix.cs (19)
22
internal static bool SupportsAtomicNonInheritablePipeCreation =>
Interop
.Sys.IsAtomicNonInheritablePipeCreationSupported;
25
=>
Interop
.Sys.Access(fullPath,
Interop
.Sys.AccessMode.X_OK) == 0 &&
26
Interop
.Sys.Stat(fullPath, out
Interop
.Sys.FileStatus fileStatus) == 0 &&
27
(fileStatus.Mode &
Interop
.Sys.FileTypes.S_IFMT) !=
Interop
.Sys.FileTypes.S_IFDIR;
102
if (!
Interop
.Sys.InitializeTerminalAndSignalHandling())
108
Interop
.Sys.RegisterForSigChld(&OnSigChild);
128
uint[]? groups =
Interop
.Sys.GetGroupList(startInfo.UserName, groupId!.Value);
139
Interop
.Sys.Passwd? passwd;
143
const int BufLen =
Interop
.Sys.Passwd.InitialBufferSize;
175
private static unsafe bool TryGetPasswd(string name, byte* buf, int bufLen, out
Interop
.Sys.Passwd? passwd)
178
Interop
.Sys.Passwd tempPasswd;
179
int error =
Interop
.Sys.GetPwNamR(name, out tempPasswd, buf, bufLen);
196
var errorInfo = new
Interop
.ErrorInfo(error);
200
if (errorInfo.Error ==
Interop
.Error.ERANGE)
337
Interop
.ErrorInfo error =
Interop
.Error.ENOENT.Info();
System\Diagnostics\ProcessWaitState.Unix.cs (8)
369
int killResult =
Interop
.Sys.Kill(_processId, 0); // 0 means don't send a signal, used to check if process is still alive
379
Interop
.Error errno =
Interop
.Sys.GetLastError();
380
if (errno ==
Interop
.Error.ESRCH)
385
else if (errno ==
Interop
.Error.EPERM)
588
int waitResult =
Interop
.Sys.WaitPidExitedNoHang(_processId, out exitCode, out terminatingSignal);
622
pid =
Interop
.Sys.WaitIdAnyExitedNoHangNoWait();
694
pid =
Interop
.Sys.WaitPidExitedNoHang(-1, out exitCode, out terminatingSignal);