Files
tgstation-server/_posix_process_features_8cs_source.html

358 lines
65 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>tgstation-server: src/Tgstation.Server.Host/System/PosixProcessFeatures.cs Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">tgstation-server<span id="projectnumber">&#160;6.19.3</span>
</div>
<div id="projectbrief">The /tg/station 13 server suite</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.8 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function() { init_codefold(0); });
/* @license-end */
</script>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_34761767c1c3cd212f9d2f80ea0828a8.html">Tgstation.Server.Host</a></li><li class="navelem"><a class="el" href="dir_3d220027e29e19c608b6d51ce3029c32.html">System</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle"><div class="title">PosixProcessFeatures.cs</div></div>
</div><!--header-->
<div class="contents">
<a href="_posix_process_features_8cs.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span><span class="keyword">using </span>System;</div>
<div class="line"><a id="l00002" name="l00002"></a><span class="lineno"> 2</span><span class="keyword">using </span>System.Collections.Generic;</div>
<div class="line"><a id="l00003" name="l00003"></a><span class="lineno"> 3</span><span class="keyword">using </span>System.Globalization;</div>
<div class="line"><a id="l00004" name="l00004"></a><span class="lineno"> 4</span><span class="keyword">using </span>System.IO;</div>
<div class="line"><a id="l00005" name="l00005"></a><span class="lineno"> 5</span><span class="keyword">using </span>System.Linq;</div>
<div class="line"><a id="l00006" name="l00006"></a><span class="lineno"> 6</span><span class="keyword">using </span>System.Text;</div>
<div class="line"><a id="l00007" name="l00007"></a><span class="lineno"> 7</span><span class="keyword">using </span>System.Threading;</div>
<div class="line"><a id="l00008" name="l00008"></a><span class="lineno"> 8</span><span class="keyword">using </span>System.Threading.Tasks;</div>
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno"> 9</span> </div>
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno"> 10</span><span class="keyword">using </span>Microsoft.Extensions.Hosting;</div>
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno"> 11</span><span class="keyword">using </span>Microsoft.Extensions.Logging;</div>
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno"> 12</span><span class="keyword">using </span>Mono.Unix;</div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span><span class="keyword">using </span>Mono.Unix.Native;</div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span> </div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"> 15</span><span class="keyword">using </span><a class="code hl_namespace" href="namespace_tgstation_1_1_server_1_1_api_1_1_models.html">Tgstation.Server.Api.Models</a>;</div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span><span class="keyword">using </span><a class="code hl_namespace" href="namespace_tgstation_1_1_server_1_1_host_1_1_i_o.html">Tgstation.Server.Host.IO</a>;</div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span><span class="keyword">using </span><a class="code hl_namespace" href="namespace_tgstation_1_1_server_1_1_host_1_1_jobs.html">Tgstation.Server.Host.Jobs</a>;</div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span> </div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span><span class="keyword">namespace </span><a class="code hl_namespace" href="namespace_tgstation_1_1_server_1_1_host_1_1_system.html">Tgstation.Server.Host.System</a></div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span>{</div>
<div class="foldopen" id="foldopen00022" data-start="{" data-end="};">
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html"> 22</a></span> <span class="keyword">sealed</span> <span class="keyword">class </span><a class="code hl_class" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html">PosixProcessFeatures</a> : <a class="code hl_interface" href="interface_tgstation_1_1_server_1_1_host_1_1_system_1_1_i_process_features.html">IProcessFeatures</a>, <a class="code hl_class" href="class_i_hosted_service.html">IHostedService</a></div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span> {</div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a69fb163df991e3c562e552d712f99d45"> 27</a></span> <span class="keyword">const</span> <span class="keywordtype">short</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a69fb163df991e3c562e552d712f99d45">SelfOomAdjust</a> = 1;</div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span> </div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a59d18c936ead8cb55ded4f7506675dfb"> 32</a></span> <span class="keyword">const</span> <span class="keywordtype">short</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a59d18c936ead8cb55ded4f7506675dfb">ChildProcessOomAdjust</a> = <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a69fb163df991e3c562e552d712f99d45">SelfOomAdjust</a> + 1;</div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> </div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a3a2559612f724db16314713f64da1d2f"> 37</a></span> readonly Lazy&lt;IProcessExecutor&gt; <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a3a2559612f724db16314713f64da1d2f">lazyLoadedProcessExecutor</a>;</div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span> </div>
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a1de594c25d7d9e7e5d159675b2c03873"> 42</a></span> readonly <a class="code hl_interface" href="interface_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_i_i_o_manager.html">IIOManager</a> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a1de594c25d7d9e7e5d159675b2c03873">ioManager</a>;</div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span> </div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#ad86bb907f2d4419d609e89b8802dc73b"> 47</a></span> readonly ILogger&lt;PosixProcessFeatures&gt; <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#ad86bb907f2d4419d609e89b8802dc73b">logger</a>;</div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> </div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a1a771719cebd9c87aaa3101c666de5fb"> 52</a></span> <span class="keywordtype">short</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a1a771719cebd9c87aaa3101c666de5fb">baselineOomAdjust</a>;</div>
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> </div>
<div class="foldopen" id="foldopen00060" data-start="{" data-end="}">
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a5c76e566e66544a36a2bab1650903201"> 60</a></span> <span class="keyword">public</span> <a class="code hl_function" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a5c76e566e66544a36a2bab1650903201">PosixProcessFeatures</a>(Lazy&lt;IProcessExecutor&gt; <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a3a2559612f724db16314713f64da1d2f">lazyLoadedProcessExecutor</a>, <a class="code hl_interface" href="interface_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_i_i_o_manager.html">IIOManager</a> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a1de594c25d7d9e7e5d159675b2c03873">ioManager</a>, ILogger&lt;PosixProcessFeatures&gt; <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#ad86bb907f2d4419d609e89b8802dc73b">logger</a>)</div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> {</div>
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span> this.lazyLoadedProcessExecutor = <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a3a2559612f724db16314713f64da1d2f">lazyLoadedProcessExecutor</a> ?? <span class="keywordflow">throw</span> <span class="keyword">new</span> ArgumentNullException(nameof(<a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a3a2559612f724db16314713f64da1d2f">lazyLoadedProcessExecutor</a>));</div>
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> this.ioManager = <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a1de594c25d7d9e7e5d159675b2c03873">ioManager</a> ?? <span class="keywordflow">throw</span> <span class="keyword">new</span> ArgumentNullException(nameof(<a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a1de594c25d7d9e7e5d159675b2c03873">ioManager</a>));</div>
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span> this.logger = <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#ad86bb907f2d4419d609e89b8802dc73b">logger</a> ?? <span class="keywordflow">throw</span> <span class="keyword">new</span> ArgumentNullException(nameof(<a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#ad86bb907f2d4419d609e89b8802dc73b">logger</a>));</div>
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> }</div>
</div>
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span> </div>
<div class="foldopen" id="foldopen00068" data-start="{" data-end="}">
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a49c4196d80413533d81efa2915bfaeb1"> 68</a></span> <span class="keyword">public</span> <span class="keywordtype">void</span> <a class="code hl_function" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a49c4196d80413533d81efa2915bfaeb1">ResumeProcess</a>(global::System.Diagnostics.Process process)</div>
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span> {</div>
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span> var result = Syscall.kill(process.Id, Signum.SIGCONT);</div>
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span> <span class="keywordflow">if</span> (result != 0)</div>
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span> <span class="keywordflow">throw</span> <span class="keyword">new</span> UnixIOException(Stdlib.GetLastError());</div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span> }</div>
</div>
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span> </div>
<div class="foldopen" id="foldopen00076" data-start="{" data-end="}">
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a1c0faded339a483cc9e2f513ec7d5cee"> 76</a></span> <span class="keyword">public</span> <span class="keywordtype">void</span> <a class="code hl_function" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a1c0faded339a483cc9e2f513ec7d5cee">SuspendProcess</a>(global::System.Diagnostics.Process process)</div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span> {</div>
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> var result = Syscall.kill(process.Id, Signum.SIGSTOP);</div>
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> <span class="keywordflow">if</span> (result != 0)</div>
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span> <span class="keywordflow">throw</span> <span class="keyword">new</span> UnixIOException(Stdlib.GetLastError());</div>
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span> }</div>
</div>
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno"> 82</span> </div>
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#adad0e0b8968836ca4ef4253d8dbb9b85"> 84</a></span> <span class="keyword">public</span> <span class="keywordtype">string</span> <a class="code hl_function" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#adad0e0b8968836ca4ef4253d8dbb9b85">GetExecutingUsername</a>(global::System.Diagnostics.Process process)</div>
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno"> 85</span> =&gt; <span class="keywordflow">throw</span> <span class="keyword">new</span> NotSupportedException();</div>
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno"> 86</span> </div>
<div class="foldopen" id="foldopen00088" data-start="{" data-end="}">
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a41eeadd8f3fa1380151384ec76881d7f"> 88</a></span> <span class="keyword">public</span> async ValueTask <a class="code hl_function" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a41eeadd8f3fa1380151384ec76881d7f">CreateDump</a>(global::System.Diagnostics.Process process, <span class="keywordtype">string</span> outputFile, <span class="keywordtype">bool</span> minidump, CancellationToken cancellationToken)</div>
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span> {</div>
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno"> 90</span> ArgumentNullException.ThrowIfNull(process);</div>
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span> ArgumentNullException.ThrowIfNull(outputFile);</div>
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno"> 92</span> </div>
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno"> 93</span> <span class="keywordtype">string</span>? gcorePath = <span class="keyword">null</span>;</div>
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span> <span class="keywordflow">foreach</span> (var path <span class="keywordflow">in</span> <a class="code hl_function" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a4192ddc001b09818f387ce5d85e23266">GetPotentialGCorePaths</a>())</div>
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno"> 95</span> <span class="keywordflow">if</span> (await <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a1de594c25d7d9e7e5d159675b2c03873">ioManager</a>.<a class="code hl_function" href="interface_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_i_i_o_manager.html#ad4de873180481f7afa206b6282158d62">FileExists</a>(path, cancellationToken))</div>
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno"> 96</span> {</div>
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno"> 97</span> gcorePath = path;</div>
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno"> 98</span> <span class="keywordflow">break</span>;</div>
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno"> 99</span> }</div>
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno"> 100</span> </div>
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno"> 101</span> <span class="keywordflow">if</span> (gcorePath == <span class="keyword">null</span>)</div>
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno"> 102</span> <span class="keywordflow">throw</span> <span class="keyword">new</span> <a class="code hl_class" href="class_tgstation_1_1_server_1_1_host_1_1_jobs_1_1_job_exception.html">JobException</a>(<a class="code hl_enumeration" href="namespace_tgstation_1_1_server_1_1_api_1_1_models.html#a1a6adb59dd51244efabf4e548e7075c8">ErrorCode</a>.MissingGCore);</div>
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno"> 103</span> </div>
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno"> 104</span> <span class="keywordtype">int</span> pid;</div>
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno"> 105</span> <span class="keywordflow">try</span></div>
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno"> 106</span> {</div>
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno"> 107</span> <span class="keywordflow">if</span> (process.HasExited)</div>
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno"> 108</span> <span class="keywordflow">throw</span> <span class="keyword">new</span> <a class="code hl_class" href="class_tgstation_1_1_server_1_1_host_1_1_jobs_1_1_job_exception.html">JobException</a>(<a class="code hl_enumeration" href="namespace_tgstation_1_1_server_1_1_api_1_1_models.html#a1a6adb59dd51244efabf4e548e7075c8">ErrorCode</a>.GameServerOffline);</div>
<div class="line"><a id="l00109" name="l00109"></a><span class="lineno"> 109</span> </div>
<div class="line"><a id="l00110" name="l00110"></a><span class="lineno"> 110</span> pid = process.Id;</div>
<div class="line"><a id="l00111" name="l00111"></a><span class="lineno"> 111</span> }</div>
<div class="line"><a id="l00112" name="l00112"></a><span class="lineno"> 112</span> <span class="keywordflow">catch</span> (InvalidOperationException ex)</div>
<div class="line"><a id="l00113" name="l00113"></a><span class="lineno"> 113</span> {</div>
<div class="line"><a id="l00114" name="l00114"></a><span class="lineno"> 114</span> <span class="keywordflow">throw</span> <span class="keyword">new</span> <a class="code hl_class" href="class_tgstation_1_1_server_1_1_host_1_1_jobs_1_1_job_exception.html">JobException</a>(<a class="code hl_enumeration" href="namespace_tgstation_1_1_server_1_1_api_1_1_models.html#a1a6adb59dd51244efabf4e548e7075c8">ErrorCode</a>.GameServerOffline, ex);</div>
<div class="line"><a id="l00115" name="l00115"></a><span class="lineno"> 115</span> }</div>
<div class="line"><a id="l00116" name="l00116"></a><span class="lineno"> 116</span> </div>
<div class="line"><a id="l00117" name="l00117"></a><span class="lineno"> 117</span> <span class="keywordtype">string</span>? output;</div>
<div class="line"><a id="l00118" name="l00118"></a><span class="lineno"> 118</span> <span class="keywordtype">int</span> exitCode;</div>
<div class="line"><a id="l00119" name="l00119"></a><span class="lineno"> 119</span> await <span class="keyword">using</span> (var gcoreProc = await <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a3a2559612f724db16314713f64da1d2f">lazyLoadedProcessExecutor</a>.Value.LaunchProcess(</div>
<div class="line"><a id="l00120" name="l00120"></a><span class="lineno"> 120</span> gcorePath,</div>
<div class="line"><a id="l00121" name="l00121"></a><span class="lineno"> 121</span> Environment.CurrentDirectory,</div>
<div class="line"><a id="l00122" name="l00122"></a><span class="lineno"> 122</span> $<span class="stringliteral">&quot;{(!minidump ? &quot;</span>-a <span class="stringliteral">&quot; : String.Empty)}-o {outputFile} {process.Id}&quot;</span>,</div>
<div class="line"><a id="l00123" name="l00123"></a><span class="lineno"> 123</span> cancellationToken,</div>
<div class="line"><a id="l00124" name="l00124"></a><span class="lineno"> 124</span> readStandardHandles: <span class="keyword">true</span>,</div>
<div class="line"><a id="l00125" name="l00125"></a><span class="lineno"> 125</span> noShellExecute: <span class="keyword">true</span>))</div>
<div class="line"><a id="l00126" name="l00126"></a><span class="lineno"> 126</span> {</div>
<div class="line"><a id="l00127" name="l00127"></a><span class="lineno"> 127</span> <span class="keyword">using</span> (cancellationToken.Register(() =&gt; gcoreProc.Terminate()))</div>
<div class="line"><a id="l00128" name="l00128"></a><span class="lineno"> 128</span> exitCode = (await gcoreProc.Lifetime).Value;</div>
<div class="line"><a id="l00129" name="l00129"></a><span class="lineno"> 129</span> </div>
<div class="line"><a id="l00130" name="l00130"></a><span class="lineno"> 130</span> output = await gcoreProc.GetCombinedOutput(cancellationToken);</div>
<div class="line"><a id="l00131" name="l00131"></a><span class="lineno"> 131</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#ad86bb907f2d4419d609e89b8802dc73b">logger</a>.LogDebug(<span class="stringliteral">&quot;gcore output:{newline}{output}&quot;</span>, Environment.NewLine, output);</div>
<div class="line"><a id="l00132" name="l00132"></a><span class="lineno"> 132</span> }</div>
<div class="line"><a id="l00133" name="l00133"></a><span class="lineno"> 133</span> </div>
<div class="line"><a id="l00134" name="l00134"></a><span class="lineno"> 134</span> <span class="keywordflow">if</span> (exitCode != 0)</div>
<div class="line"><a id="l00135" name="l00135"></a><span class="lineno"> 135</span> <span class="keywordflow">throw</span> <span class="keyword">new</span> <a class="code hl_class" href="class_tgstation_1_1_server_1_1_host_1_1_jobs_1_1_job_exception.html">JobException</a>(</div>
<div class="line"><a id="l00136" name="l00136"></a><span class="lineno"> 136</span> <a class="code hl_enumeration" href="namespace_tgstation_1_1_server_1_1_api_1_1_models.html#a1a6adb59dd51244efabf4e548e7075c8">ErrorCode</a>.GCoreFailure,</div>
<div class="line"><a id="l00137" name="l00137"></a><span class="lineno"> 137</span> <span class="keyword">new</span> <a class="code hl_class" href="class_tgstation_1_1_server_1_1_host_1_1_jobs_1_1_job_exception.html">JobException</a>(</div>
<div class="line"><a id="l00138" name="l00138"></a><span class="lineno"> 138</span> $<span class="stringliteral">&quot;Exit Code: {exitCode}{Environment.NewLine}Output:{Environment.NewLine}{output}&quot;</span>));</div>
<div class="line"><a id="l00139" name="l00139"></a><span class="lineno"> 139</span> </div>
<div class="line"><a id="l00140" name="l00140"></a><span class="lineno"> 140</span> <span class="comment">// gcore outputs name.pid so remove the pid part</span></div>
<div class="line"><a id="l00141" name="l00141"></a><span class="lineno"> 141</span> var generatedGCoreFile = $<span class="stringliteral">&quot;{outputFile}.{pid}&quot;</span>;</div>
<div class="line"><a id="l00142" name="l00142"></a><span class="lineno"> 142</span> await <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a1de594c25d7d9e7e5d159675b2c03873">ioManager</a>.<a class="code hl_function" href="interface_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_i_i_o_manager.html#a2dff052035f4d3d0c689d0e89d8deecd">MoveFile</a>(generatedGCoreFile, outputFile, cancellationToken);</div>
<div class="line"><a id="l00143" name="l00143"></a><span class="lineno"> 143</span> }</div>
</div>
<div class="line"><a id="l00144" name="l00144"></a><span class="lineno"> 144</span> </div>
<div class="foldopen" id="foldopen00146" data-start="{" data-end="}">
<div class="line"><a id="l00146" name="l00146"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a3c52667945d2a79849d2f1b8c52e7876"> 146</a></span> <span class="keyword">public</span> async ValueTask&lt;int&gt; <a class="code hl_function" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a3c52667945d2a79849d2f1b8c52e7876">HandleProcessStart</a>(global::System.Diagnostics.Process process, CancellationToken cancellationToken)</div>
<div class="line"><a id="l00147" name="l00147"></a><span class="lineno"> 147</span> {</div>
<div class="line"><a id="l00148" name="l00148"></a><span class="lineno"> 148</span> ArgumentNullException.ThrowIfNull(process);</div>
<div class="line"><a id="l00149" name="l00149"></a><span class="lineno"> 149</span> var pid = process.Id;</div>
<div class="line"><a id="l00150" name="l00150"></a><span class="lineno"> 150</span> <span class="keywordflow">try</span></div>
<div class="line"><a id="l00151" name="l00151"></a><span class="lineno"> 151</span> {</div>
<div class="line"><a id="l00152" name="l00152"></a><span class="lineno"> 152</span> <span class="comment">// make sure all processes we spawn are killed _before_ us</span></div>
<div class="line"><a id="l00153" name="l00153"></a><span class="lineno"> 153</span> await <a class="code hl_function" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#aa7edd56e392dfb1ec1b1b34fd9b56e79">AdjustOutOfMemoryScore</a>(pid, <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a59d18c936ead8cb55ded4f7506675dfb">ChildProcessOomAdjust</a>, cancellationToken);</div>
<div class="line"><a id="l00154" name="l00154"></a><span class="lineno"> 154</span> }</div>
<div class="line"><a id="l00155" name="l00155"></a><span class="lineno"> 155</span> <span class="keywordflow">catch</span> (<a class="code hl_class" href="class_exception.html">Exception</a> ex) when (ex is not OperationCanceledException)</div>
<div class="line"><a id="l00156" name="l00156"></a><span class="lineno"> 156</span> {</div>
<div class="line"><a id="l00157" name="l00157"></a><span class="lineno"> 157</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#ad86bb907f2d4419d609e89b8802dc73b">logger</a>.LogWarning(ex, <span class="stringliteral">&quot;Failed to adjust OOM killer score for pid {pid}!&quot;</span>, pid);</div>
<div class="line"><a id="l00158" name="l00158"></a><span class="lineno"> 158</span> }</div>
<div class="line"><a id="l00159" name="l00159"></a><span class="lineno"> 159</span> </div>
<div class="line"><a id="l00160" name="l00160"></a><span class="lineno"> 160</span> <span class="keywordflow">return</span> pid;</div>
<div class="line"><a id="l00161" name="l00161"></a><span class="lineno"> 161</span> }</div>
</div>
<div class="line"><a id="l00162" name="l00162"></a><span class="lineno"> 162</span> </div>
<div class="foldopen" id="foldopen00164" data-start="{" data-end="}">
<div class="line"><a id="l00164" name="l00164"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#acf10e5a7e3f1d0482288f88babd2261f"> 164</a></span> <span class="keyword">public</span> async Task <a class="code hl_function" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#acf10e5a7e3f1d0482288f88babd2261f">StartAsync</a>(CancellationToken cancellationToken)</div>
<div class="line"><a id="l00165" name="l00165"></a><span class="lineno"> 165</span> {</div>
<div class="line"><a id="l00166" name="l00166"></a><span class="lineno"> 166</span> <span class="comment">// let this all throw</span></div>
<div class="line"><a id="l00167" name="l00167"></a><span class="lineno"> 167</span> <span class="keywordtype">string</span> originalString;</div>
<div class="line"><a id="l00168" name="l00168"></a><span class="lineno"> 168</span> {</div>
<div class="line"><a id="l00169" name="l00169"></a><span class="lineno"> 169</span> <span class="comment">// can&#39;t use ReadAllBytes here, /proc files have 0 length so the buffer is initialized to empty</span></div>
<div class="line"><a id="l00170" name="l00170"></a><span class="lineno"> 170</span> <span class="comment">// https://stackoverflow.com/questions/12237712/how-can-i-show-the-size-of-files-in-proc-it-should-not-be-size-zero</span></div>
<div class="line"><a id="l00171" name="l00171"></a><span class="lineno"> 171</span> await <span class="keyword">using </span>var fileStream = <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a1de594c25d7d9e7e5d159675b2c03873">ioManager</a>.<a class="code hl_function" href="interface_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_i_i_o_manager.html#a055862f1ac46e7aaf3b68a936fedb9c1">CreateAsyncReadStream</a>(</div>
<div class="line"><a id="l00172" name="l00172"></a><span class="lineno"> 172</span> <span class="stringliteral">&quot;/proc/self/oom_score_adj&quot;</span>, <span class="keyword">true</span>, <span class="keyword">true</span>);</div>
<div class="line"><a id="l00173" name="l00173"></a><span class="lineno"> 173</span> <span class="keyword">using </span>var reader = <span class="keyword">new</span> StreamReader(fileStream, Encoding.UTF8, leaveOpen: <span class="keyword">true</span>);</div>
<div class="line"><a id="l00174" name="l00174"></a><span class="lineno"> 174</span> originalString = await reader.ReadToEndAsync(cancellationToken);</div>
<div class="line"><a id="l00175" name="l00175"></a><span class="lineno"> 175</span> }</div>
<div class="line"><a id="l00176" name="l00176"></a><span class="lineno"> 176</span> </div>
<div class="line"><a id="l00177" name="l00177"></a><span class="lineno"> 177</span> var trimmedString = originalString.Trim();</div>
<div class="line"><a id="l00178" name="l00178"></a><span class="lineno"> 178</span> </div>
<div class="line"><a id="l00179" name="l00179"></a><span class="lineno"> 179</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#ad86bb907f2d4419d609e89b8802dc73b">logger</a>.LogTrace(<span class="stringliteral">&quot;Original oom_score_adj is \&quot;{original}\&quot;&quot;</span>, trimmedString);</div>
<div class="line"><a id="l00180" name="l00180"></a><span class="lineno"> 180</span> </div>
<div class="line"><a id="l00181" name="l00181"></a><span class="lineno"> 181</span> var originalOomAdjust = Int16.Parse(trimmedString, CultureInfo.InvariantCulture);</div>
<div class="line"><a id="l00182" name="l00182"></a><span class="lineno"> 182</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a1a771719cebd9c87aaa3101c666de5fb">baselineOomAdjust</a> = Math.Clamp(originalOomAdjust, (<span class="keywordtype">short</span>)-1000, (short)1000);</div>
<div class="line"><a id="l00183" name="l00183"></a><span class="lineno"> 183</span> </div>
<div class="line"><a id="l00184" name="l00184"></a><span class="lineno"> 184</span> <span class="keywordflow">if</span> (<a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a1a771719cebd9c87aaa3101c666de5fb">baselineOomAdjust</a> == 1000)</div>
<div class="line"><a id="l00185" name="l00185"></a><span class="lineno"> 185</span> <span class="keywordflow">if</span> (originalOomAdjust != <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a1a771719cebd9c87aaa3101c666de5fb">baselineOomAdjust</a>)</div>
<div class="line"><a id="l00186" name="l00186"></a><span class="lineno"> 186</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#ad86bb907f2d4419d609e89b8802dc73b">logger</a>.LogWarning(<span class="stringliteral">&quot;oom_score_adj is at it&#39;s limit of 1000 (Clamped from {original}). TGS cannot guarantee the kill order of its parent/child processes!&quot;</span>, originalOomAdjust);</div>
<div class="line"><a id="l00187" name="l00187"></a><span class="lineno"> 187</span> <span class="keywordflow">else</span></div>
<div class="line"><a id="l00188" name="l00188"></a><span class="lineno"> 188</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#ad86bb907f2d4419d609e89b8802dc73b">logger</a>.LogWarning(<span class="stringliteral">&quot;oom_score_adj is at it&#39;s limit of 1000. TGS cannot guarantee the kill order of its parent/child processes!&quot;</span>);</div>
<div class="line"><a id="l00189" name="l00189"></a><span class="lineno"> 189</span> </div>
<div class="line"><a id="l00190" name="l00190"></a><span class="lineno"> 190</span> <span class="keywordflow">try</span></div>
<div class="line"><a id="l00191" name="l00191"></a><span class="lineno"> 191</span> {</div>
<div class="line"><a id="l00192" name="l00192"></a><span class="lineno"> 192</span> <span class="comment">// we do not want to be killed before the host watchdog</span></div>
<div class="line"><a id="l00193" name="l00193"></a><span class="lineno"> 193</span> await <a class="code hl_function" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#aa7edd56e392dfb1ec1b1b34fd9b56e79">AdjustOutOfMemoryScore</a>(<span class="keyword">null</span>, <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a69fb163df991e3c562e552d712f99d45">SelfOomAdjust</a>, cancellationToken);</div>
<div class="line"><a id="l00194" name="l00194"></a><span class="lineno"> 194</span> }</div>
<div class="line"><a id="l00195" name="l00195"></a><span class="lineno"> 195</span> <span class="keywordflow">catch</span> (<a class="code hl_class" href="class_exception.html">Exception</a> ex) when (ex is not OperationCanceledException)</div>
<div class="line"><a id="l00196" name="l00196"></a><span class="lineno"> 196</span> {</div>
<div class="line"><a id="l00197" name="l00197"></a><span class="lineno"> 197</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#ad86bb907f2d4419d609e89b8802dc73b">logger</a>.LogWarning(ex, <span class="stringliteral">&quot;Could not increase oom_score_adj!&quot;</span>);</div>
<div class="line"><a id="l00198" name="l00198"></a><span class="lineno"> 198</span> }</div>
<div class="line"><a id="l00199" name="l00199"></a><span class="lineno"> 199</span> }</div>
</div>
<div class="line"><a id="l00200" name="l00200"></a><span class="lineno"> 200</span> </div>
<div class="line"><a id="l00202" name="l00202"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#add130243de2bf65fc7fca6ac8e7e6d1a"> 202</a></span> <span class="keyword">public</span> Task <a class="code hl_function" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#add130243de2bf65fc7fca6ac8e7e6d1a">StopAsync</a>(CancellationToken cancellationToken) =&gt; Task.CompletedTask;</div>
<div class="line"><a id="l00203" name="l00203"></a><span class="lineno"> 203</span> </div>
<div class="foldopen" id="foldopen00211" data-start="{" data-end="}">
<div class="line"><a id="l00211" name="l00211"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#aa7edd56e392dfb1ec1b1b34fd9b56e79"> 211</a></span> ValueTask <a class="code hl_function" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#aa7edd56e392dfb1ec1b1b34fd9b56e79">AdjustOutOfMemoryScore</a>(<span class="keywordtype">int</span>? pid, <span class="keywordtype">short</span> adjustment, CancellationToken cancellationToken)</div>
<div class="line"><a id="l00212" name="l00212"></a><span class="lineno"> 212</span> {</div>
<div class="line"><a id="l00213" name="l00213"></a><span class="lineno"> 213</span> var adjustedValue = Math.Clamp(<a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a1a771719cebd9c87aaa3101c666de5fb">baselineOomAdjust</a> + adjustment, -1000, 1000);</div>
<div class="line"><a id="l00214" name="l00214"></a><span class="lineno"> 214</span> </div>
<div class="line"><a id="l00215" name="l00215"></a><span class="lineno"> 215</span> var pidStr = pid.HasValue</div>
<div class="line"><a id="l00216" name="l00216"></a><span class="lineno"> 216</span> ? pid.Value.ToString(CultureInfo.InvariantCulture)</div>
<div class="line"><a id="l00217" name="l00217"></a><span class="lineno"> 217</span> : <span class="stringliteral">&quot;self&quot;</span>;</div>
<div class="line"><a id="l00218" name="l00218"></a><span class="lineno"> 218</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#ad86bb907f2d4419d609e89b8802dc73b">logger</a>.LogTrace(</div>
<div class="line"><a id="l00219" name="l00219"></a><span class="lineno"> 219</span> <span class="stringliteral">&quot;Setting oom_score_adj of {pid} to {adjustment}...&quot;</span>, pidStr, adjustedValue);</div>
<div class="line"><a id="l00220" name="l00220"></a><span class="lineno"> 220</span> <span class="keywordflow">return</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a1de594c25d7d9e7e5d159675b2c03873">ioManager</a>.<a class="code hl_function" href="interface_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_i_i_o_manager.html#a9aeb8b83ea3f4b13a183b6ac55b35a70">WriteAllBytes</a>(</div>
<div class="line"><a id="l00221" name="l00221"></a><span class="lineno"> 221</span> $<span class="stringliteral">&quot;/proc/{pidStr}/oom_score_adj&quot;</span>,</div>
<div class="line"><a id="l00222" name="l00222"></a><span class="lineno"> 222</span> Encoding.UTF8.GetBytes(adjustedValue.ToString(CultureInfo.InvariantCulture)),</div>
<div class="line"><a id="l00223" name="l00223"></a><span class="lineno"> 223</span> cancellationToken);</div>
<div class="line"><a id="l00224" name="l00224"></a><span class="lineno"> 224</span> }</div>
</div>
<div class="line"><a id="l00225" name="l00225"></a><span class="lineno"> 225</span> </div>
<div class="foldopen" id="foldopen00230" data-start="{" data-end="}">
<div class="line"><a id="l00230" name="l00230"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a4192ddc001b09818f387ce5d85e23266"> 230</a></span> IEnumerable&lt;string&gt; <a class="code hl_function" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a4192ddc001b09818f387ce5d85e23266">GetPotentialGCorePaths</a>()</div>
<div class="line"><a id="l00231" name="l00231"></a><span class="lineno"> 231</span> {</div>
<div class="line"><a id="l00232" name="l00232"></a><span class="lineno"> 232</span> var enviromentPath = Environment.GetEnvironmentVariable(<span class="stringliteral">&quot;PATH&quot;</span>);</div>
<div class="line"><a id="l00233" name="l00233"></a><span class="lineno"> 233</span> IEnumerable&lt;string&gt; enumerator;</div>
<div class="line"><a id="l00234" name="l00234"></a><span class="lineno"> 234</span> <span class="keywordflow">if</span> (enviromentPath == <span class="keyword">null</span>)</div>
<div class="line"><a id="l00235" name="l00235"></a><span class="lineno"> 235</span> enumerator = Enumerable.Empty&lt;<span class="keywordtype">string</span>&gt;();</div>
<div class="line"><a id="l00236" name="l00236"></a><span class="lineno"> 236</span> <span class="keywordflow">else</span></div>
<div class="line"><a id="l00237" name="l00237"></a><span class="lineno"> 237</span> {</div>
<div class="line"><a id="l00238" name="l00238"></a><span class="lineno"> 238</span> var paths = enviromentPath.Split(<span class="charliteral">&#39;;&#39;</span>);</div>
<div class="line"><a id="l00239" name="l00239"></a><span class="lineno"> 239</span> enumerator = paths</div>
<div class="line"><a id="l00240" name="l00240"></a><span class="lineno"> 240</span> .Select(x =&gt; x.Split(<span class="charliteral">&#39;:&#39;</span>))</div>
<div class="line"><a id="l00241" name="l00241"></a><span class="lineno"> 241</span> .SelectMany(x =&gt; x);</div>
<div class="line"><a id="l00242" name="l00242"></a><span class="lineno"> 242</span> }</div>
<div class="line"><a id="l00243" name="l00243"></a><span class="lineno"> 243</span> </div>
<div class="line"><a id="l00244" name="l00244"></a><span class="lineno"> 244</span> var exeName = <span class="stringliteral">&quot;gcore&quot;</span>;</div>
<div class="line"><a id="l00245" name="l00245"></a><span class="lineno"> 245</span> </div>
<div class="line"><a id="l00246" name="l00246"></a><span class="lineno"> 246</span> enumerator = enumerator</div>
<div class="line"><a id="l00247" name="l00247"></a><span class="lineno"> 247</span> .Concat(<span class="keyword">new</span> List&lt;string&gt;(2)</div>
<div class="line"><a id="l00248" name="l00248"></a><span class="lineno"> 248</span> {</div>
<div class="line"><a id="l00249" name="l00249"></a><span class="lineno"> 249</span> <span class="stringliteral">&quot;/usr/bin&quot;</span>,</div>
<div class="line"><a id="l00250" name="l00250"></a><span class="lineno"> 250</span> <span class="stringliteral">&quot;/usr/share/bin&quot;</span>,</div>
<div class="line"><a id="l00251" name="l00251"></a><span class="lineno"> 251</span> <span class="stringliteral">&quot;/bin&quot;</span>,</div>
<div class="line"><a id="l00252" name="l00252"></a><span class="lineno"> 252</span> });</div>
<div class="line"><a id="l00253" name="l00253"></a><span class="lineno"> 253</span> </div>
<div class="line"><a id="l00254" name="l00254"></a><span class="lineno"> 254</span> enumerator = enumerator.Select(x =&gt; <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a1de594c25d7d9e7e5d159675b2c03873">ioManager</a>.<a class="code hl_function" href="interface_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_i_i_o_manager.html#a286f4eb5c679683b7e519847a6c3574e">ConcatPath</a>(x, exeName));</div>
<div class="line"><a id="l00255" name="l00255"></a><span class="lineno"> 255</span> </div>
<div class="line"><a id="l00256" name="l00256"></a><span class="lineno"> 256</span> <span class="keywordflow">return</span> enumerator;</div>
<div class="line"><a id="l00257" name="l00257"></a><span class="lineno"> 257</span> }</div>
</div>
<div class="line"><a id="l00258" name="l00258"></a><span class="lineno"> 258</span> }</div>
</div>
<div class="line"><a id="l00259" name="l00259"></a><span class="lineno"> 259</span>}</div>
<div class="ttc" id="aclass_exception_html"><div class="ttname"><a href="class_exception.html">Exception</a></div></div>
<div class="ttc" id="aclass_i_hosted_service_html"><div class="ttname"><a href="class_i_hosted_service.html">IHostedService</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_jobs_1_1_job_exception_html"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_jobs_1_1_job_exception.html">Tgstation.Server.Host.Jobs.JobException</a></div><div class="ttdoc">Operation exceptions thrown from the context of a Models.Job.</div><div class="ttdef"><b>Definition</b> <a href="_job_exception_8cs_source.html#l00010">JobException.cs:11</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features_html"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html">Tgstation.Server.Host.System.PosixProcessFeatures</a></div><div class="ttdef"><b>Definition</b> <a href="_posix_process_features_8cs_source.html#l00022">PosixProcessFeatures.cs:23</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features_html_a1a771719cebd9c87aaa3101c666de5fb"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a1a771719cebd9c87aaa3101c666de5fb">Tgstation.Server.Host.System.PosixProcessFeatures.baselineOomAdjust</a></div><div class="ttdeci">short baselineOomAdjust</div><div class="ttdoc">The original value of oom_score_adj as read from the /proc/ filesystem. Inherited from parent process...</div><div class="ttdef"><b>Definition</b> <a href="_posix_process_features_8cs_source.html#l00052">PosixProcessFeatures.cs:52</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features_html_a1c0faded339a483cc9e2f513ec7d5cee"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a1c0faded339a483cc9e2f513ec7d5cee">Tgstation.Server.Host.System.PosixProcessFeatures.SuspendProcess</a></div><div class="ttdeci">void SuspendProcess(global::System.Diagnostics.Process process)</div><div class="ttdoc">Suspend a given process .</div><div class="ttdef"><b>Definition</b> <a href="_posix_process_features_8cs_source.html#l00076">PosixProcessFeatures.cs:76</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features_html_a1de594c25d7d9e7e5d159675b2c03873"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a1de594c25d7d9e7e5d159675b2c03873">Tgstation.Server.Host.System.PosixProcessFeatures.ioManager</a></div><div class="ttdeci">readonly IIOManager ioManager</div><div class="ttdoc">The IIOManager for the PosixProcessFeatures.</div><div class="ttdef"><b>Definition</b> <a href="_posix_process_features_8cs_source.html#l00042">PosixProcessFeatures.cs:42</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features_html_a3a2559612f724db16314713f64da1d2f"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a3a2559612f724db16314713f64da1d2f">Tgstation.Server.Host.System.PosixProcessFeatures.lazyLoadedProcessExecutor</a></div><div class="ttdeci">readonly Lazy&lt; IProcessExecutor &gt; lazyLoadedProcessExecutor</div><div class="ttdoc">Lazy&lt;T&gt; loaded IProcessExecutor.</div><div class="ttdef"><b>Definition</b> <a href="_posix_process_features_8cs_source.html#l00037">PosixProcessFeatures.cs:37</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features_html_a3c52667945d2a79849d2f1b8c52e7876"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a3c52667945d2a79849d2f1b8c52e7876">Tgstation.Server.Host.System.PosixProcessFeatures.HandleProcessStart</a></div><div class="ttdeci">async ValueTask&lt; int &gt; HandleProcessStart(global::System.Diagnostics.Process process, CancellationToken cancellationToken)</div><div class="ttdoc">Run events on starting a process.A ValueTask&lt;TResult&gt; resulting in the process ID.</div><div class="ttdef"><b>Definition</b> <a href="_posix_process_features_8cs_source.html#l00146">PosixProcessFeatures.cs:146</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features_html_a4192ddc001b09818f387ce5d85e23266"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a4192ddc001b09818f387ce5d85e23266">Tgstation.Server.Host.System.PosixProcessFeatures.GetPotentialGCorePaths</a></div><div class="ttdeci">IEnumerable&lt; string &gt; GetPotentialGCorePaths()</div><div class="ttdoc">Gets potential paths to the gcore executable.</div><div class="ttdef"><b>Definition</b> <a href="_posix_process_features_8cs_source.html#l00230">PosixProcessFeatures.cs:230</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features_html_a41eeadd8f3fa1380151384ec76881d7f"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a41eeadd8f3fa1380151384ec76881d7f">Tgstation.Server.Host.System.PosixProcessFeatures.CreateDump</a></div><div class="ttdeci">async ValueTask CreateDump(global::System.Diagnostics.Process process, string outputFile, bool minidump, CancellationToken cancellationToken)</div><div class="ttdoc">Create a dump file for a given process .A ValueTask representing the running operation.</div><div class="ttdef"><b>Definition</b> <a href="_posix_process_features_8cs_source.html#l00088">PosixProcessFeatures.cs:88</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features_html_a49c4196d80413533d81efa2915bfaeb1"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a49c4196d80413533d81efa2915bfaeb1">Tgstation.Server.Host.System.PosixProcessFeatures.ResumeProcess</a></div><div class="ttdeci">void ResumeProcess(global::System.Diagnostics.Process process)</div><div class="ttdoc">Resume a given suspended global::System.Diagnostics.Process.</div><div class="ttdef"><b>Definition</b> <a href="_posix_process_features_8cs_source.html#l00068">PosixProcessFeatures.cs:68</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features_html_a59d18c936ead8cb55ded4f7506675dfb"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a59d18c936ead8cb55ded4f7506675dfb">Tgstation.Server.Host.System.PosixProcessFeatures.ChildProcessOomAdjust</a></div><div class="ttdeci">const short ChildProcessOomAdjust</div><div class="ttdoc">Difference from baselineOomAdjust to set the oom_score_adj of child processes to. 1 higher than ourse...</div><div class="ttdef"><b>Definition</b> <a href="_posix_process_features_8cs_source.html#l00032">PosixProcessFeatures.cs:32</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features_html_a5c76e566e66544a36a2bab1650903201"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a5c76e566e66544a36a2bab1650903201">Tgstation.Server.Host.System.PosixProcessFeatures.PosixProcessFeatures</a></div><div class="ttdeci">PosixProcessFeatures(Lazy&lt; IProcessExecutor &gt; lazyLoadedProcessExecutor, IIOManager ioManager, ILogger&lt; PosixProcessFeatures &gt; logger)</div><div class="ttdoc">Initializes a new instance of the PosixProcessFeatures class.</div><div class="ttdef"><b>Definition</b> <a href="_posix_process_features_8cs_source.html#l00060">PosixProcessFeatures.cs:60</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features_html_a69fb163df991e3c562e552d712f99d45"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#a69fb163df991e3c562e552d712f99d45">Tgstation.Server.Host.System.PosixProcessFeatures.SelfOomAdjust</a></div><div class="ttdeci">const short SelfOomAdjust</div><div class="ttdoc">Difference from baselineOomAdjust to set our own oom_score_adj to. 1 higher host watchdog.</div><div class="ttdef"><b>Definition</b> <a href="_posix_process_features_8cs_source.html#l00027">PosixProcessFeatures.cs:27</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features_html_aa7edd56e392dfb1ec1b1b34fd9b56e79"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#aa7edd56e392dfb1ec1b1b34fd9b56e79">Tgstation.Server.Host.System.PosixProcessFeatures.AdjustOutOfMemoryScore</a></div><div class="ttdeci">ValueTask AdjustOutOfMemoryScore(int? pid, short adjustment, CancellationToken cancellationToken)</div><div class="ttdoc">Set oom_score_adj for a given pid .</div><div class="ttdef"><b>Definition</b> <a href="_posix_process_features_8cs_source.html#l00211">PosixProcessFeatures.cs:211</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features_html_acf10e5a7e3f1d0482288f88babd2261f"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#acf10e5a7e3f1d0482288f88babd2261f">Tgstation.Server.Host.System.PosixProcessFeatures.StartAsync</a></div><div class="ttdeci">async Task StartAsync(CancellationToken cancellationToken)</div><div class="ttdef"><b>Definition</b> <a href="_posix_process_features_8cs_source.html#l00164">PosixProcessFeatures.cs:164</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features_html_ad86bb907f2d4419d609e89b8802dc73b"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#ad86bb907f2d4419d609e89b8802dc73b">Tgstation.Server.Host.System.PosixProcessFeatures.logger</a></div><div class="ttdeci">readonly ILogger&lt; PosixProcessFeatures &gt; logger</div><div class="ttdoc">The ILogger&lt;TCategoryName&gt; for the PosixProcessFeatures.</div><div class="ttdef"><b>Definition</b> <a href="_posix_process_features_8cs_source.html#l00047">PosixProcessFeatures.cs:47</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features_html_adad0e0b8968836ca4ef4253d8dbb9b85"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#adad0e0b8968836ca4ef4253d8dbb9b85">Tgstation.Server.Host.System.PosixProcessFeatures.GetExecutingUsername</a></div><div class="ttdeci">string GetExecutingUsername(global::System.Diagnostics.Process process)</div><div class="ttdoc">Get the name of the user executing a given process .The name of the user executing process .</div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features_html_add130243de2bf65fc7fca6ac8e7e6d1a"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_system_1_1_posix_process_features.html#add130243de2bf65fc7fca6ac8e7e6d1a">Tgstation.Server.Host.System.PosixProcessFeatures.StopAsync</a></div><div class="ttdeci">Task StopAsync(CancellationToken cancellationToken)</div></div>
<div class="ttc" id="ainterface_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_i_i_o_manager_html"><div class="ttname"><a href="interface_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_i_i_o_manager.html">Tgstation.Server.Host.IO.IIOManager</a></div><div class="ttdoc">Interface for using filesystems.</div><div class="ttdef"><b>Definition</b> <a href="_i_i_o_manager_8cs_source.html#l00013">IIOManager.cs:14</a></div></div>
<div class="ttc" id="ainterface_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_i_i_o_manager_html_a055862f1ac46e7aaf3b68a936fedb9c1"><div class="ttname"><a href="interface_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_i_i_o_manager.html#a055862f1ac46e7aaf3b68a936fedb9c1">Tgstation.Server.Host.IO.IIOManager.CreateAsyncReadStream</a></div><div class="ttdeci">Stream CreateAsyncReadStream(string path, bool sequential, bool shareWrite)</div><div class="ttdoc">Creates an asynchronous FileStream for sequential reading.</div></div>
<div class="ttc" id="ainterface_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_i_i_o_manager_html_a286f4eb5c679683b7e519847a6c3574e"><div class="ttname"><a href="interface_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_i_i_o_manager.html#a286f4eb5c679683b7e519847a6c3574e">Tgstation.Server.Host.IO.IIOManager.ConcatPath</a></div><div class="ttdeci">string ConcatPath(params string[] paths)</div><div class="ttdoc">Combines an array of strings into a path.</div></div>
<div class="ttc" id="ainterface_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_i_i_o_manager_html_a2dff052035f4d3d0c689d0e89d8deecd"><div class="ttname"><a href="interface_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_i_i_o_manager.html#a2dff052035f4d3d0c689d0e89d8deecd">Tgstation.Server.Host.IO.IIOManager.MoveFile</a></div><div class="ttdeci">Task MoveFile(string source, string destination, CancellationToken cancellationToken)</div><div class="ttdoc">Moves a file at source to destination .</div></div>
<div class="ttc" id="ainterface_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_i_i_o_manager_html_a9aeb8b83ea3f4b13a183b6ac55b35a70"><div class="ttname"><a href="interface_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_i_i_o_manager.html#a9aeb8b83ea3f4b13a183b6ac55b35a70">Tgstation.Server.Host.IO.IIOManager.WriteAllBytes</a></div><div class="ttdeci">ValueTask WriteAllBytes(string path, byte[] contents, CancellationToken cancellationToken)</div><div class="ttdoc">Writes some contents to a file at path overwriting previous content.</div></div>
<div class="ttc" id="ainterface_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_i_i_o_manager_html_ad4de873180481f7afa206b6282158d62"><div class="ttname"><a href="interface_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_i_i_o_manager.html#ad4de873180481f7afa206b6282158d62">Tgstation.Server.Host.IO.IIOManager.FileExists</a></div><div class="ttdeci">Task&lt; bool &gt; FileExists(string path, CancellationToken cancellationToken)</div><div class="ttdoc">Check that the file at path exists.</div></div>
<div class="ttc" id="ainterface_tgstation_1_1_server_1_1_host_1_1_system_1_1_i_process_features_html"><div class="ttname"><a href="interface_tgstation_1_1_server_1_1_host_1_1_system_1_1_i_process_features.html">Tgstation.Server.Host.System.IProcessFeatures</a></div><div class="ttdoc">Abstraction for suspending and resuming processes.</div><div class="ttdef"><b>Definition</b> <a href="_i_process_features_8cs_source.html#l00009">IProcessFeatures.cs:10</a></div></div>
<div class="ttc" id="anamespace_tgstation_1_1_server_1_1_api_1_1_models_html"><div class="ttname"><a href="namespace_tgstation_1_1_server_1_1_api_1_1_models.html">Tgstation.Server.Api.Models</a></div><div class="ttdef"><b>Definition</b> <a href="_tgstation_8_server_8_api_2_models_2_chat_channel_8cs_source.html#l00005">ChatChannel.cs:6</a></div></div>
<div class="ttc" id="anamespace_tgstation_1_1_server_1_1_api_1_1_models_html_a1a6adb59dd51244efabf4e548e7075c8"><div class="ttname"><a href="namespace_tgstation_1_1_server_1_1_api_1_1_models.html#a1a6adb59dd51244efabf4e548e7075c8">Tgstation.Server.Api.Models.ErrorCode</a></div><div class="ttdeci">ErrorCode</div><div class="ttdoc">Types of Response.ErrorMessageResponses that the API may return.</div><div class="ttdef"><b>Definition</b> <a href="_error_code_8cs_source.html#l00011">ErrorCode.cs:12</a></div></div>
<div class="ttc" id="anamespace_tgstation_1_1_server_1_1_host_1_1_i_o_html"><div class="ttname"><a href="namespace_tgstation_1_1_server_1_1_host_1_1_i_o.html">Tgstation.Server.Host.IO</a></div><div class="ttdef"><b>Definition</b> <a href="_buffered_file_stream_provider_8cs_source.html#l00008">BufferedFileStreamProvider.cs:9</a></div></div>
<div class="ttc" id="anamespace_tgstation_1_1_server_1_1_host_1_1_jobs_html"><div class="ttname"><a href="namespace_tgstation_1_1_server_1_1_host_1_1_jobs.html">Tgstation.Server.Host.Jobs</a></div><div class="ttdef"><b>Definition</b> <a href="_i_job_manager_8cs_source.html#l00007">IJobManager.cs:8</a></div></div>
<div class="ttc" id="anamespace_tgstation_1_1_server_1_1_host_1_1_system_html"><div class="ttname"><a href="namespace_tgstation_1_1_server_1_1_host_1_1_system.html">Tgstation.Server.Host.System</a></div><div class="ttdef"><b>Definition</b> <a href="_assembly_information_provider_8cs_source.html#l00008">AssemblyInformationProvider.cs:9</a></div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.8
</small></address>
</body>
</html>