198 references to Interop
System.Diagnostics.Process (198)
LibraryImports.g.cs (33)
79
private static partial int PathConf(string path, global::
Interop
.Sys.PathConfName name)
108
static extern unsafe int __PInvoke(byte* __path_native, global::
Interop
.Sys.PathConfName __name_native);
117
internal static partial int FStat(global::System.Runtime.InteropServices.SafeHandle fd, out global::
Interop
.Sys.FileStatus output)
130
fixed (global::
Interop
.Sys.FileStatus* __output_native = &output)
149
static extern unsafe int __PInvoke(nint __fd_native, global::
Interop
.Sys.FileStatus* __output_native);
158
internal static partial int Stat(string path, out global::
Interop
.Sys.FileStatus output)
171
fixed (global::
Interop
.Sys.FileStatus* __output_native = &output)
190
static extern unsafe int __PInvoke(byte* __path_native, global::
Interop
.Sys.FileStatus* __output_native);
199
internal static partial int LStat(string path, out global::
Interop
.Sys.FileStatus output)
212
fixed (global::
Interop
.Sys.FileStatus* __output_native = &output)
231
static extern unsafe int __PInvoke(byte* __path_native, global::
Interop
.Sys.FileStatus* __output_native);
610
internal static partial nuint ZSTD_decompressStream(global::Microsoft.Win32.SafeHandles.SafeZstdDecompressHandle dctx, ref global::
Interop
.Zstd.ZstdOutBuffer output, ref global::
Interop
.Zstd.ZstdInBuffer input)
621
fixed (global::
Interop
.Zstd.ZstdInBuffer* __input_native = &input)
622
fixed (global::
Interop
.Zstd.ZstdOutBuffer* __output_native = &output)
638
static extern unsafe nuint __PInvoke(nint __dctx_native, global::
Interop
.Zstd.ZstdOutBuffer* __output_native, global::
Interop
.Zstd.ZstdInBuffer* __input_native);
647
internal static partial nuint ZSTD_DCtx_setParameter(global::Microsoft.Win32.SafeHandles.SafeZstdDecompressHandle dctx, global::
Interop
.Zstd.ZstdDParameter param, int value)
672
static extern unsafe nuint __PInvoke(nint __dctx_native, global::
Interop
.Zstd.ZstdDParameter __param_native, int __value_native);
715
internal static partial nuint ZSTD_DCtx_reset(global::Microsoft.Win32.SafeHandles.SafeZstdDecompressHandle dctx, global::
Interop
.Zstd.ZstdResetDirective reset)
740
static extern unsafe nuint __PInvoke(nint __dctx_native, global::
Interop
.Zstd.ZstdResetDirective __reset_native);
749
internal static partial nuint ZSTD_compressStream2(global::Microsoft.Win32.SafeHandles.SafeZstdCompressHandle cctx, ref global::
Interop
.Zstd.ZstdOutBuffer output, ref global::
Interop
.Zstd.ZstdInBuffer input, global::
Interop
.Zstd.ZstdEndDirective endOp)
760
fixed (global::
Interop
.Zstd.ZstdInBuffer* __input_native = &input)
761
fixed (global::
Interop
.Zstd.ZstdOutBuffer* __output_native = &output)
777
static extern unsafe nuint __PInvoke(nint __cctx_native, global::
Interop
.Zstd.ZstdOutBuffer* __output_native, global::
Interop
.Zstd.ZstdInBuffer* __input_native, global::
Interop
.Zstd.ZstdEndDirective __endOp_native);
786
internal static partial nuint ZSTD_CCtx_setParameter(global::Microsoft.Win32.SafeHandles.SafeZstdCompressHandle cctx, global::
Interop
.Zstd.ZstdCParameter param, int value)
811
static extern unsafe nuint __PInvoke(nint __cctx_native, global::
Interop
.Zstd.ZstdCParameter __param_native, int __value_native);
854
internal static partial nuint ZSTD_CCtx_reset(global::Microsoft.Win32.SafeHandles.SafeZstdCompressHandle cctx, global::
Interop
.Zstd.ZstdResetDirective reset)
879
static extern unsafe nuint __PInvoke(nint __cctx_native, global::
Interop
.Zstd.ZstdResetDirective __reset_native);
Microsoft\Win32\SafeHandles\SafeProcessHandle.Unix.cs (12)
69
int signalNumber =
Interop
.Sys.GetPlatformSignalNumber(signal);
75
int killResult =
Interop
.Sys.Kill(ProcessId, signalNumber);
78
Interop
.ErrorInfo errorInfo =
Interop
.Sys.GetLastErrorInfo();
81
if (errorInfo.Error ==
Interop
.Error.ESRCH)
171
throw new Win32Exception(
Interop
.Errors.ERROR_NO_ASSOCIATION);
233
Interop
.ErrorInfo error =
Interop
.Error.ENOENT.Info();
254
errno =
Interop
.Sys.ForkAndExecProcess(
287
new
Interop
.ErrorInfo(errno).Error ==
Interop
.Error.ENOEXEC)
292
throw ProcessUtils.CreateExceptionForErrorStartingProcess(new
Interop
.ErrorInfo(errno).GetErrorMessage(), errno, resolvedFilename, cwd);
src\libraries\Common\src\Interop\Linux\cgroups\Interop.cgroups.cs (6)
210
Interop
.Error error =
Interop
.procfs.GetFileSystemTypeForRealPath(SysFsCgroupFileSystemPath, out string format);
211
if (error ==
Interop
.Error.SUCCESS)
302
return TryFindHierarchyMount(cgroupVersion,
Interop
.procfs.ProcMountInfoFilePath, subsystem, out root, out path);
323
if (
Interop
.procfs.TryParseMountInfoLine(line, out
Interop
.procfs.ParsedMount mount))
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\libraries\Common\src\Interop\Unix\System.Native\Interop.GetGroupList.cs (1)
26
rv =
Interop
.Sys.GetGroupList(userName, primaryGroupId, pGroups, &ngroups);
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)
src\libraries\Common\src\Interop\Unix\System.Native\Interop.IsMemberOfGroup.cs (3)
30
rv =
Interop
.Sys.GetGroups(groups.Length, pGroups);
38
else if (rv == -1 &&
Interop
.Sys.GetLastError() ==
Interop
.Error.EINVAL)
System\Diagnostics\Process.Linux.cs (16)
56
bootTimeTicks =
Interop
.Sys.GetBootTimeTicks();
103
Interop
.procfs.ParsedStat stat = GetStat();
129
if (!ProcessManager.TryGetProcPid(_processId, out
Interop
.procfs.ProcPid procPid))
133
string path =
Interop
.procfs.GetFileDescriptorDirectoryPathForProcess(procPid);
157
if (
Interop
.Sys.SchedGetAffinity(_processId, out set) != 0)
168
if (
Interop
.Sys.SchedSetAffinity(_processId, ref value) != 0)
185
if (!
Interop
.cgroups.TryGetMemoryLimit(out ulong rsslim))
225
internal static string? GetExePath(
Interop
.procfs.ProcPid procPid)
227
return procPid ==
Interop
.procfs.ProcPid.Self ? Environment.ProcessPath :
228
Interop
.Sys.ReadLink(
Interop
.procfs.GetExeFilePathForProcess(procPid));
234
internal static string GetUntruncatedProcessName(
Interop
.procfs.ProcPid procPid, ref
Interop
.procfs.ParsedStat stat)
236
string cmdLineFilePath =
Interop
.procfs.GetCmdLinePathForProcess(procPid);
333
private
Interop
.procfs.ParsedStat GetStat()
336
Interop
.procfs.ParsedStat stat;
System\Diagnostics\Process.Multiplexing.Unix.cs (19)
32
if (
Interop
.Sys.Fcntl.DangerousSetIsNonBlocking(outputFd, 1) != 0 ||
Interop
.Sys.Fcntl.DangerousSetIsNonBlocking(errorFd, 1) != 0)
37
Span<
Interop
.PollEvent> pollFds = stackalloc
Interop
.PollEvent[2];
55
pollFds[numFds].Events =
Interop
.PollEvents.POLLIN;
56
pollFds[numFds].TriggeredEvents =
Interop
.PollEvents.POLLNONE;
64
pollFds[numFds].Events =
Interop
.PollEvents.POLLIN;
65
pollFds[numFds].TriggeredEvents =
Interop
.PollEvents.POLLNONE;
78
fixed (
Interop
.PollEvent* pPollFds = pollFds)
80
Interop
.Error error =
Interop
.Sys.Poll(pPollFds, (uint)numFds, pollTimeout, &triggered);
81
if (error !=
Interop
.Error.SUCCESS)
83
if (error ==
Interop
.Error.EINTR)
90
throw new Win32Exception(
Interop
.Sys.ConvertErrorPalToPlatform(error));
102
if (pollFds[i].TriggeredEvents ==
Interop
.PollEvents.POLLNONE)
141
int bytesRead =
Interop
.Sys.Read(handle, pBuffer + offset, buffer.Length - offset);
144
Interop
.ErrorInfo errorInfo =
Interop
.Sys.GetLastErrorInfo();
145
if (errorInfo.Error ==
Interop
.Error.EAGAIN)
System\Diagnostics\Process.Unix.cs (21)
72
int killResult =
Interop
.Sys.Kill(_processId,
Interop
.Sys.GetPlatformSignalNumber(PosixSignal.SIGKILL));
75
Interop
.Error error =
Interop
.Sys.GetLastError();
78
if (error ==
Interop
.Error.ESRCH)
108
int stopResult =
Interop
.Sys.Kill(_processId,
Interop
.Sys.GetPlatformSIGSTOP());
111
Interop
.Error error =
Interop
.Sys.GetLastError();
113
if (error !=
Interop
.Error.ESRCH)
122
int killResult =
Interop
.Sys.Kill(_processId,
Interop
.Sys.GetPlatformSignalNumber(PosixSignal.SIGKILL));
125
Interop
.Error error =
Interop
.Sys.GetLastError();
127
if (error !=
Interop
.Error.ESRCH)
262
int errno =
Interop
.Sys.GetPriority(
Interop
.Sys.PriorityWhich.PRIO_PROCESS, _processId, out int pri);
294
int result =
Interop
.Sys.SetPriority(
Interop
.Sys.PriorityWhich.PRIO_PROCESS, _processId, pri);
385
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 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;
26
Interop
.Sys.FileStatus fileinfo;
28
if (
Interop
.Sys.Stat(fullPath, out fileinfo) < 0)
34
if ((fileinfo.Mode &
Interop
.Sys.FileTypes.S_IFMT) ==
Interop
.Sys.FileTypes.S_IFDIR)
53
uint euid =
Interop
.Sys.GetEUid();
75
if (
Interop
.Sys.IsMemberOfGroup(fileinfo.Gid))
96
if (!
Interop
.Sys.InitializeTerminalAndSignalHandling())
102
Interop
.Sys.RegisterForSigChld(&OnSigChild);
122
uint[]? groups =
Interop
.Sys.GetGroupList(startInfo.UserName, groupId!.Value);
133
Interop
.Sys.Passwd? passwd;
137
const int BufLen =
Interop
.Sys.Passwd.InitialBufferSize;
169
private static unsafe bool TryGetPasswd(string name, byte* buf, int bufLen, out
Interop
.Sys.Passwd? passwd)
172
Interop
.Sys.Passwd tempPasswd;
173
int error =
Interop
.Sys.GetPwNamR(name, out tempPasswd, buf, bufLen);
190
var errorInfo = new
Interop
.ErrorInfo(error);
194
if (errorInfo.Error ==
Interop
.Error.ERANGE)
251
if (
Interop
.Sys.Access(resolvedFilename,
Interop
.Sys.AccessMode.X_OK) == 0)
System\Diagnostics\ProcessWaitState.Unix.cs (8)
354
int killResult =
Interop
.Sys.Kill(_processId, 0); // 0 means don't send a signal, used to check if process is still alive
364
Interop
.Error errno =
Interop
.Sys.GetLastError();
365
if (errno ==
Interop
.Error.ESRCH)
370
else if (errno ==
Interop
.Error.EPERM)
571
int waitResult =
Interop
.Sys.WaitPidExitedNoHang(_processId, out exitCode);
605
pid =
Interop
.Sys.WaitIdAnyExitedNoHangNoWait();
676
pid =
Interop
.Sys.WaitPidExitedNoHang(-1, out exitCode);