http://git-wip-us.apache.org/repos/asf/mesos-site/blob/a3206036/content/api/latest/c++/3rdparty_2stout_2include_2stout_2windows_8hpp_source.html ---------------------------------------------------------------------- diff --git a/content/api/latest/c++/3rdparty_2stout_2include_2stout_2windows_8hpp_source.html b/content/api/latest/c++/3rdparty_2stout_2include_2stout_2windows_8hpp_source.html new file mode 100644 index 0000000..4ea3947 --- /dev/null +++ b/content/api/latest/c++/3rdparty_2stout_2include_2stout_2windows_8hpp_source.html @@ -0,0 +1,578 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.5"/> +<title>Apache Mesos: 3rdparty/stout/include/stout/windows.hpp 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="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 style="height: 56px;"> + <td style="padding-left: 0.5em;"> + <div id="projectname">Apache Mesos + </div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.5 --> + <div id="navrow1" class="tabs"> + <ul class="tablist"> + <li><a href="index.html"><span>Main Page</span></a></li> + <li><a href="pages.html"><span>Related Pages</span></a></li> + <li><a href="namespaces.html"><span>Namespaces</span></a></li> + <li><a href="annotated.html"><span>Classes</span></a></li> + <li class="current"><a href="files.html"><span>Files</span></a></li> + <li><a href="examples.html"><span>Examples</span></a></li> + </ul> + </div> + <div id="navrow2" class="tabs2"> + <ul class="tablist"> + <li><a href="files.html"><span>File List</span></a></li> + <li><a href="globals.html"><span>File Members</span></a></li> + </ul> + </div> +<div id="nav-path" class="navpath"> + <ul> +<li class="navelem"><a class="el" href="dir_8cab8f464681f7cc51cee77e79a434cd.html">3rdparty</a></li><li class="navelem"><a class="el" href="dir_aa547de1d719d14adccfca1dfb1735b3.html">stout</a></li><li class="navelem"><a class="el" href="dir_1a1b923d951dd999d43396870333fc33.html">include</a></li><li class="navelem"><a class="el" href="dir_dbd52553d038069c1ed93e3477ea333d.html">stout</a></li> </ul> +</div> +</div><!-- top --> +<div class="header"> + <div class="headertitle"> +<div class="title">windows.hpp</div> </div> +</div><!--header--> +<div class="contents"> +<a href="3rdparty_2stout_2include_2stout_2windows_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">// Licensed under the Apache License, Version 2.0 (the "License");</span></div> +<div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment">// you may not use this file except in compliance with the License.</span></div> +<div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment">// You may obtain a copy of the License at</span></div> +<div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment">//</span></div> +<div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment">// http://www.apache.org/licenses/LICENSE-2.0</span></div> +<div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment">//</span></div> +<div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment">// Unless required by applicable law or agreed to in writing, software</span></div> +<div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment">// distributed under the License is distributed on an "AS IS" BASIS,</span></div> +<div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment">// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div> +<div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment">// See the License for the specific language governing permissions and</span></div> +<div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="comment">// limitations under the License.</span></div> +<div class="line"><a name="l00012"></a><span class="lineno"> 12</span> </div> +<div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="preprocessor">#ifndef __STOUT_WINDOWS_HPP__</span></div> +<div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="preprocessor"></span><span class="preprocessor">#define __STOUT_WINDOWS_HPP__</span></div> +<div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="preprocessor"></span></div> +<div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="preprocessor">#include <direct.h></span> <span class="comment">// For `_mkdir`.</span></div> +<div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="preprocessor">#include <errno.h></span> <span class="comment">// For `_set_errno`.</span></div> +<div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="preprocessor">#include <fcntl.h></span> <span class="comment">// For file access flags like `_O_CREAT`.</span></div> +<div class="line"><a name="l00019"></a><span class="lineno"> 19</span> <span class="preprocessor">#include <io.h></span> <span class="comment">// For `_read`, `_write`.</span></div> +<div class="line"><a name="l00020"></a><span class="lineno"> 20</span> <span class="preprocessor">#include <process.h></span> <span class="comment">// For `_getpid`.</span></div> +<div class="line"><a name="l00021"></a><span class="lineno"> 21</span> <span class="preprocessor">#include <stdlib.h></span> <span class="comment">// For `_PATH_MAX`.</span></div> +<div class="line"><a name="l00022"></a><span class="lineno"> 22</span> </div> +<div class="line"><a name="l00023"></a><span class="lineno"> 23</span> <span class="preprocessor">#include <sys/stat.h></span> <span class="comment">// For permissions flags.</span></div> +<div class="line"><a name="l00024"></a><span class="lineno"> 24</span> </div> +<div class="line"><a name="l00025"></a><span class="lineno"> 25</span> <span class="preprocessor">#include <BaseTsd.h></span> <span class="comment">// For `SSIZE_T`.</span></div> +<div class="line"><a name="l00026"></a><span class="lineno"> 26</span> <span class="comment">// We include `Winsock2.h` before `Windows.h` explicitly to avoid symbold</span></div> +<div class="line"><a name="l00027"></a><span class="lineno"> 27</span> <span class="comment">// re-definitions. This is a known pattern in the windows community.</span></div> +<div class="line"><a name="l00028"></a><span class="lineno"> 28</span> <span class="preprocessor">#include <WS2tcpip.h></span></div> +<div class="line"><a name="l00029"></a><span class="lineno"> 29</span> <span class="preprocessor">#include <Winsock2.h></span></div> +<div class="line"><a name="l00030"></a><span class="lineno"> 30</span> <span class="preprocessor">#include <mswsock.h></span></div> +<div class="line"><a name="l00031"></a><span class="lineno"> 31</span> <span class="preprocessor">#include <winioctl.h></span></div> +<div class="line"><a name="l00032"></a><span class="lineno"> 32</span> <span class="preprocessor">#include <Windows.h></span></div> +<div class="line"><a name="l00033"></a><span class="lineno"> 33</span> </div> +<div class="line"><a name="l00034"></a><span class="lineno"> 34</span> <span class="preprocessor">#include <memory></span></div> +<div class="line"><a name="l00035"></a><span class="lineno"> 35</span> </div> +<div class="line"><a name="l00036"></a><span class="lineno"> 36</span> <span class="preprocessor">#include <glog/logging.h></span></div> +<div class="line"><a name="l00037"></a><span class="lineno"> 37</span> </div> +<div class="line"><a name="l00038"></a><span class="lineno"> 38</span> </div> +<div class="line"><a name="l00039"></a><span class="lineno"> 39</span> <span class="preprocessor">#ifdef _UNICODE</span></div> +<div class="line"><a name="l00040"></a><span class="lineno"> 40</span> <span class="preprocessor"></span><span class="comment">// Much of the core Windows API is available both in `string` and `wstring`</span></div> +<div class="line"><a name="l00041"></a><span class="lineno"> 41</span> <span class="comment">// varieties. To avoid polluting the namespace with two versions of every</span></div> +<div class="line"><a name="l00042"></a><span class="lineno"> 42</span> <span class="comment">// function, a common pattern in the Windows headers is to offer a single macro</span></div> +<div class="line"><a name="l00043"></a><span class="lineno"> 43</span> <span class="comment">// that expands to the `string` or `wstring` version, depending on whether the</span></div> +<div class="line"><a name="l00044"></a><span class="lineno"> 44</span> <span class="comment">// `_UNICODE` preprocessor symbol is set. For example, `GetMessage` will expand</span></div> +<div class="line"><a name="l00045"></a><span class="lineno"> 45</span> <span class="comment">// to either `GetMessageA` (the `string` version) or `GetMessageW` (the</span></div> +<div class="line"><a name="l00046"></a><span class="lineno"> 46</span> <span class="comment">// `wstring` version) depending on whether this symbol is defined.</span></div> +<div class="line"><a name="l00047"></a><span class="lineno"> 47</span> <span class="comment">//</span></div> +<div class="line"><a name="l00048"></a><span class="lineno"> 48</span> <span class="comment">// The downside of this is that it makes POSIX interop really hard. Hence, we</span></div> +<div class="line"><a name="l00049"></a><span class="lineno"> 49</span> <span class="comment">// refuse to compile if such a symbol is passed in during compilation.</span></div> +<div class="line"><a name="l00050"></a><span class="lineno"> 50</span> <span class="preprocessor">#error "Mesos doesn't currently support the `_UNICODE` Windows header constant"</span></div> +<div class="line"><a name="l00051"></a><span class="lineno"> 51</span> <span class="preprocessor"></span><span class="preprocessor">#endif // _UNICODE</span></div> +<div class="line"><a name="l00052"></a><span class="lineno"> 52</span> <span class="preprocessor"></span></div> +<div class="line"><a name="l00053"></a><span class="lineno"> 53</span> <span class="comment">// An RAII `HANDLE`.</span></div> +<div class="line"><a name="l00054"></a><span class="lineno"><a class="line" href="classSharedHandle.html"> 54</a></span> <span class="keyword">class </span><a class="code" href="classSharedHandle.html">SharedHandle</a> : <span class="keyword">public</span> std::shared_ptr<void></div> +<div class="line"><a name="l00055"></a><span class="lineno"> 55</span> {</div> +<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>  static_assert(std::is_same<HANDLE, void*>::value,</div> +<div class="line"><a name="l00057"></a><span class="lineno"> 57</span>  <span class="stringliteral">"Expected `HANDLE` to be of type `void*`."</span>);</div> +<div class="line"><a name="l00058"></a><span class="lineno"> 58</span> </div> +<div class="line"><a name="l00059"></a><span class="lineno"> 59</span> <span class="keyword">public</span>:</div> +<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>  <span class="comment">// We delete the default constructor so that the callsite is forced to make</span></div> +<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  <span class="comment">// an explicit decision about what the empty `HANDLE` value should be, as it</span></div> +<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  <span class="comment">// is not the same for all `HANDLE` types. For example, `OpenProcess`</span></div> +<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  <span class="comment">// returns a `nullptr` for an invalid handle, but `CreateFile` returns an</span></div> +<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>  <span class="comment">// `INVALID_HANDLE_VALUE` instead. This inconsistency is inherent in the</span></div> +<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  <span class="comment">// Windows API.</span></div> +<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  <a class="code" href="classSharedHandle.html#ad2cfca1ab3db9839e617b569b225e0c0">SharedHandle</a>() = <span class="keyword">delete</span>;</div> +<div class="line"><a name="l00067"></a><span class="lineno"> 67</span> </div> +<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  <span class="keyword">template</span> <<span class="keyword">typename</span> Deleter></div> +<div class="line"><a name="l00069"></a><span class="lineno"><a class="line" href="classSharedHandle.html#a67dea37bc1c958578f992ccc40a40899"> 69</a></span>  <a class="code" href="classSharedHandle.html#a67dea37bc1c958578f992ccc40a40899">SharedHandle</a>(<a class="code" href="namespacerouting_1_1queueing_1_1ingress.html#a934208b6017d0a9aed90b6594bb8292f">HANDLE</a> handle, Deleter deleter)</div> +<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>  : std::shared_ptr<void>(handle, deleter) {}</div> +<div class="line"><a name="l00071"></a><span class="lineno"> 71</span> </div> +<div class="line"><a name="l00072"></a><span class="lineno"><a class="line" href="classSharedHandle.html#a800385e17e17cb826147968e748fd8fa"> 72</a></span>  <a class="code" href="namespacerouting_1_1queueing_1_1ingress.html#a934208b6017d0a9aed90b6594bb8292f">HANDLE</a> <a class="code" href="classSharedHandle.html#a800385e17e17cb826147968e748fd8fa">get_handle</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> this-><span class="keyword">get</span>(); }</div> +<div class="line"><a name="l00073"></a><span class="lineno"> 73</span> };</div> +<div class="line"><a name="l00074"></a><span class="lineno"> 74</span> </div> +<div class="line"><a name="l00075"></a><span class="lineno"> 75</span> </div> +<div class="line"><a name="l00076"></a><span class="lineno"> 76</span> <span class="comment">// Definitions and constants used for Windows compat.</span></div> +<div class="line"><a name="l00077"></a><span class="lineno"> 77</span> <span class="comment">//</span></div> +<div class="line"><a name="l00078"></a><span class="lineno"> 78</span> <span class="comment">// Gathers most of the Windows-compatibility definitions. This makes it</span></div> +<div class="line"><a name="l00079"></a><span class="lineno"> 79</span> <span class="comment">// possible for files throughout the codebase to remain relatively free of all</span></div> +<div class="line"><a name="l00080"></a><span class="lineno"> 80</span> <span class="comment">// the #if's we'd need to make them work.</span></div> +<div class="line"><a name="l00081"></a><span class="lineno"> 81</span> <span class="comment">//</span></div> +<div class="line"><a name="l00082"></a><span class="lineno"> 82</span> <span class="comment">// Roughly, the things that should go in this file are definitions and</span></div> +<div class="line"><a name="l00083"></a><span class="lineno"> 83</span> <span class="comment">// declarations that one would not mind being:</span></div> +<div class="line"><a name="l00084"></a><span class="lineno"> 84</span> <span class="comment">// * in global scope.</span></div> +<div class="line"><a name="l00085"></a><span class="lineno"> 85</span> <span class="comment">// * globally available throughout both the Stout codebase, and any code</span></div> +<div class="line"><a name="l00086"></a><span class="lineno"> 86</span> <span class="comment">// that uses it (such as Mesos).</span></div> +<div class="line"><a name="l00087"></a><span class="lineno"> 87</span> </div> +<div class="line"><a name="l00088"></a><span class="lineno"> 88</span> </div> +<div class="line"><a name="l00089"></a><span class="lineno"> 89</span> <span class="comment">// This code un-defines the global `GetMessage` macro defined by the Windows</span></div> +<div class="line"><a name="l00090"></a><span class="lineno"> 90</span> <span class="comment">// headers, and replaces it with an inline function that is equivalent.</span></div> +<div class="line"><a name="l00091"></a><span class="lineno"> 91</span> <span class="comment">//</span></div> +<div class="line"><a name="l00092"></a><span class="lineno"> 92</span> <span class="comment">// There are two reasons for doing this. The first is because this macro</span></div> +<div class="line"><a name="l00093"></a><span class="lineno"> 93</span> <span class="comment">// interferes with `google::protobufs::Reflection::GetMessage`. Replacing the</span></div> +<div class="line"><a name="l00094"></a><span class="lineno"> 94</span> <span class="comment">// `GetMessage` macro with an inline function allows people calling the</span></div> +<div class="line"><a name="l00095"></a><span class="lineno"> 95</span> <span class="comment">// `GetMessage` macro to carry on doing so with no code changes, but it will</span></div> +<div class="line"><a name="l00096"></a><span class="lineno"> 96</span> <span class="comment">// also allow us to use `google::protobufs::Reflection::GetMessage` without</span></div> +<div class="line"><a name="l00097"></a><span class="lineno"> 97</span> <span class="comment">// interference from the macro.</span></div> +<div class="line"><a name="l00098"></a><span class="lineno"> 98</span> <span class="comment">//</span></div> +<div class="line"><a name="l00099"></a><span class="lineno"> 99</span> <span class="comment">// The second is because we don't want to obliterate the `GetMessage` macro for</span></div> +<div class="line"><a name="l00100"></a><span class="lineno"> 100</span> <span class="comment">// people who include this header, either on purpose, or incidentally as part</span></div> +<div class="line"><a name="l00101"></a><span class="lineno"> 101</span> <span class="comment">// of some other Mesos header. The effect is that our need to call protobuf's</span></div> +<div class="line"><a name="l00102"></a><span class="lineno"> 102</span> <span class="comment">// `GetMessage` function has no deleterious effect on customers of this API.</span></div> +<div class="line"><a name="l00103"></a><span class="lineno"> 103</span> <span class="comment">//</span></div> +<div class="line"><a name="l00104"></a><span class="lineno"> 104</span> <span class="comment">// NOTE: the Windows headers also don't use define-once semantics for the</span></div> +<div class="line"><a name="l00105"></a><span class="lineno"> 105</span> <span class="comment">// `GetMessage` macro. In particular, this means that every time you include</span></div> +<div class="line"><a name="l00106"></a><span class="lineno"> 106</span> <span class="comment">// `Winuser.h` and a `GetMessage` macro isn't defined, the Windows headers will</span></div> +<div class="line"><a name="l00107"></a><span class="lineno"> 107</span> <span class="comment">// redefine it for you. The impact of this is that you should re-un-define the</span></div> +<div class="line"><a name="l00108"></a><span class="lineno"> 108</span> <span class="comment">// macro every time you include `Windows.h`; since we should be including</span></div> +<div class="line"><a name="l00109"></a><span class="lineno"> 109</span> <span class="comment">// `Windows.h` only from this file, we un-define it just after we include</span></div> +<div class="line"><a name="l00110"></a><span class="lineno"> 110</span> <span class="comment">// `Windows.h`.</span></div> +<div class="line"><a name="l00111"></a><span class="lineno"> 111</span> <span class="preprocessor">#ifdef GetMessage</span></div> +<div class="line"><a name="l00112"></a><span class="lineno"> 112</span> <span class="preprocessor"></span><span class="keyword">inline</span> BOOL GetMessageWindows(</div> +<div class="line"><a name="l00113"></a><span class="lineno"> 113</span>  LPMSG lpMsg,</div> +<div class="line"><a name="l00114"></a><span class="lineno"> 114</span>  HWND hWnd,</div> +<div class="line"><a name="l00115"></a><span class="lineno"> 115</span>  UINT wMsgFilterMin,</div> +<div class="line"><a name="l00116"></a><span class="lineno"> 116</span>  UINT wMsgFilterMax)</div> +<div class="line"><a name="l00117"></a><span class="lineno"> 117</span> {</div> +<div class="line"><a name="l00118"></a><span class="lineno"> 118</span>  <span class="keywordflow">return</span> GetMessage(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax);</div> +<div class="line"><a name="l00119"></a><span class="lineno"> 119</span> }</div> +<div class="line"><a name="l00120"></a><span class="lineno"> 120</span> <span class="preprocessor">#undef GetMessage</span></div> +<div class="line"><a name="l00121"></a><span class="lineno"> 121</span> <span class="preprocessor"></span><span class="keyword">inline</span> BOOL GetMessage(</div> +<div class="line"><a name="l00122"></a><span class="lineno"> 122</span>  LPMSG lpMsg,</div> +<div class="line"><a name="l00123"></a><span class="lineno"> 123</span>  HWND hWnd,</div> +<div class="line"><a name="l00124"></a><span class="lineno"> 124</span>  UINT wMsgFilterMin,</div> +<div class="line"><a name="l00125"></a><span class="lineno"> 125</span>  UINT wMsgFilterMax)</div> +<div class="line"><a name="l00126"></a><span class="lineno"> 126</span> {</div> +<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>  <span class="keywordflow">return</span> GetMessageWindows(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax);</div> +<div class="line"><a name="l00128"></a><span class="lineno"> 128</span> }</div> +<div class="line"><a name="l00129"></a><span class="lineno"> 129</span> <span class="preprocessor">#endif // GetMessage</span></div> +<div class="line"><a name="l00130"></a><span class="lineno"> 130</span> <span class="preprocessor"></span></div> +<div class="line"><a name="l00131"></a><span class="lineno"> 131</span> </div> +<div class="line"><a name="l00132"></a><span class="lineno"> 132</span> <span class="comment">// Define constants used for Windows compat. Allows a lot of code on</span></div> +<div class="line"><a name="l00133"></a><span class="lineno"> 133</span> <span class="comment">// Windows and POSIX systems to be the same, because we can pass the</span></div> +<div class="line"><a name="l00134"></a><span class="lineno"> 134</span> <span class="comment">// same constants to functions we call to do things like file I/O.</span></div> +<div class="line"><a name="l00135"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#afcf80a6d91178952d107ad00b165752b"> 135</a></span> <span class="preprocessor">#define STDIN_FILENO 0</span></div> +<div class="line"><a name="l00136"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#abd165ee6474b5b75bf075842fff13a04"> 136</a></span> <span class="preprocessor"></span><span class="preprocessor">#define STDOUT_FILENO 1</span></div> +<div class="line"><a name="l00137"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#ae2fe1725bb5e9823d089c46b9ed5266e"> 137</a></span> <span class="preprocessor"></span><span class="preprocessor">#define STDERR_FILENO 2</span></div> +<div class="line"><a name="l00138"></a><span class="lineno"> 138</span> <span class="preprocessor"></span></div> +<div class="line"><a name="l00139"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a24a7a0ceb1e8f5f44cb1038bb829030d"> 139</a></span> <span class="preprocessor">#define R_OK 0x4</span></div> +<div class="line"><a name="l00140"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#ae5acf4043c0903cda7436b108e29e8e6"> 140</a></span> <span class="preprocessor"></span><span class="preprocessor">#define W_OK 0x2</span></div> +<div class="line"><a name="l00141"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a5e995ef7690698b62bf016b14fbc45ca"> 141</a></span> <span class="preprocessor"></span><span class="preprocessor">#define X_OK 0x0 // No such permission on Windows.</span></div> +<div class="line"><a name="l00142"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#af837744613408b57dc3654fbc3bcf900"> 142</a></span> <span class="preprocessor"></span><span class="preprocessor">#define F_OK 0x0</span></div> +<div class="line"><a name="l00143"></a><span class="lineno"> 143</span> <span class="preprocessor"></span></div> +<div class="line"><a name="l00144"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a7a68c9ffaac7dbcd652225dd7c06a54b"> 144</a></span> <span class="preprocessor">#define O_RDONLY _O_RDONLY</span></div> +<div class="line"><a name="l00145"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a11b644a8526139c4cc1850dac1271ced"> 145</a></span> <span class="preprocessor"></span><span class="preprocessor">#define O_WRONLY _O_WRONLY</span></div> +<div class="line"><a name="l00146"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#abb0586253488ee61072b73557eeb873b"> 146</a></span> <span class="preprocessor"></span><span class="preprocessor">#define O_RDWR _O_RDWR</span></div> +<div class="line"><a name="l00147"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a1cf6b1de1fffedaa1d26b189e9a8d2cc"> 147</a></span> <span class="preprocessor"></span><span class="preprocessor">#define O_CREAT _O_CREAT</span></div> +<div class="line"><a name="l00148"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#ad1d67e453fb3031f40f8cd3403773813"> 148</a></span> <span class="preprocessor"></span><span class="preprocessor">#define O_TRUNC _O_TRUNC</span></div> +<div class="line"><a name="l00149"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#ae036f789407d21f07b211552d67b3214"> 149</a></span> <span class="preprocessor"></span><span class="preprocessor">#define O_APPEND _O_APPEND</span></div> +<div class="line"><a name="l00150"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#ad6d8fbe4e494b4dbe051612572d3f757"> 150</a></span> <span class="preprocessor"></span><span class="preprocessor">#define O_CLOEXEC _O_NOINHERIT</span></div> +<div class="line"><a name="l00151"></a><span class="lineno"> 151</span> <span class="preprocessor"></span></div> +<div class="line"><a name="l00152"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#afd80ecbe3170ca4fc85b65cda8659f82"> 152</a></span> <span class="preprocessor">#define MAXHOSTNAMELEN NI_MAXHOST</span></div> +<div class="line"><a name="l00153"></a><span class="lineno"> 153</span> <span class="preprocessor"></span></div> +<div class="line"><a name="l00154"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#ae688d728e1acdfe5988c7db45d6f0166"> 154</a></span> <span class="preprocessor">#define PATH_MAX _MAX_PATH</span></div> +<div class="line"><a name="l00155"></a><span class="lineno"> 155</span> <span class="preprocessor"></span></div> +<div class="line"><a name="l00156"></a><span class="lineno"> 156</span> <span class="comment">// NOTE: for details on what this value should be, consult [1], [2], and [3].</span></div> +<div class="line"><a name="l00157"></a><span class="lineno"> 157</span> <span class="comment">//</span></div> +<div class="line"><a name="l00158"></a><span class="lineno"> 158</span> <span class="comment">// [1] http://www.opensource.apple.com/source/gnumake/gnumake-119/make/w32/include/dirent.h</span></div> +<div class="line"><a name="l00159"></a><span class="lineno"> 159</span> <span class="comment">// [2] https://en.wikipedia.org/wiki/Comparison_of_file_systems#Limits</span></div> +<div class="line"><a name="l00160"></a><span class="lineno"> 160</span> <span class="comment">// [3] https://msdn.microsoft.com/en-us/library/930f87yf.aspx</span></div> +<div class="line"><a name="l00161"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a1381461ccf8dfff5cf9aba8e7b741b1a"> 161</a></span> <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a1381461ccf8dfff5cf9aba8e7b741b1a">NAME_MAX</a> = <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#ae688d728e1acdfe5988c7db45d6f0166">PATH_MAX</a>;</div> +<div class="line"><a name="l00162"></a><span class="lineno"> 162</span> </div> +<div class="line"><a name="l00163"></a><span class="lineno"> 163</span> <span class="comment">// Corresponds to `mode_t` defined in sys/types.h of the POSIX spec.</span></div> +<div class="line"><a name="l00164"></a><span class="lineno"> 164</span> <span class="comment">// See large "permissions API" comment below for an explanation of</span></div> +<div class="line"><a name="l00165"></a><span class="lineno"> 165</span> <span class="comment">// why this is an int instead of unsigned short (as is common on</span></div> +<div class="line"><a name="l00166"></a><span class="lineno"> 166</span> <span class="comment">// POSIX).</span></div> +<div class="line"><a name="l00167"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a8a35dd1207a16dfa8b1d4163176d828c"> 167</a></span> <span class="keyword">typedef</span> <span class="keywordtype">int</span> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a8a35dd1207a16dfa8b1d4163176d828c">mode_t</a>;</div> +<div class="line"><a name="l00168"></a><span class="lineno"> 168</span> </div> +<div class="line"><a name="l00169"></a><span class="lineno"> 169</span> <span class="comment">// `DWORD` is expected to be the type holding PIDs throughout the Windows API,</span></div> +<div class="line"><a name="l00170"></a><span class="lineno"> 170</span> <span class="comment">// including functions like `OpenProcess`.</span></div> +<div class="line"><a name="l00171"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#ab03ced250ed239bc3b50b669493997f9"> 171</a></span> <span class="keyword">typedef</span> DWORD <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#ab03ced250ed239bc3b50b669493997f9">pid_t</a>;</div> +<div class="line"><a name="l00172"></a><span class="lineno"> 172</span> </div> +<div class="line"><a name="l00173"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#afc544433253791fc5f87b8203c9b6e63"> 173</a></span> <span class="keyword">typedef</span> <span class="keywordtype">int</span> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#afc544433253791fc5f87b8203c9b6e63">uid_t</a>;</div> +<div class="line"><a name="l00174"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a78ecefd3a9f3f0c110b9f6f038b690eb"> 174</a></span> <span class="keyword">typedef</span> <span class="keywordtype">int</span> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a78ecefd3a9f3f0c110b9f6f038b690eb">gid_t</a>;</div> +<div class="line"><a name="l00175"></a><span class="lineno"> 175</span> </div> +<div class="line"><a name="l00176"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a894c4d58faeee7675b9e7e8244de1386"> 176</a></span> <span class="keyword">typedef</span> SSIZE_T <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a894c4d58faeee7675b9e7e8244de1386">ssize_t</a>;</div> +<div class="line"><a name="l00177"></a><span class="lineno"> 177</span> </div> +<div class="line"><a name="l00178"></a><span class="lineno"> 178</span> <span class="comment">// Socket flags. Define behavior of a socket when it (e.g.) shuts down. We map</span></div> +<div class="line"><a name="l00179"></a><span class="lineno"> 179</span> <span class="comment">// the Windows versions of these flags to their POSIX equivalents so we don't</span></div> +<div class="line"><a name="l00180"></a><span class="lineno"> 180</span> <span class="comment">// have to change any socket code.</span></div> +<div class="line"><a name="l00181"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a337bdc938215c39cd21ddd11106189c6"> 181</a></span> constexpr <span class="keywordtype">int</span> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a337bdc938215c39cd21ddd11106189c6">SHUT_RD</a> = SD_RECEIVE;</div> +<div class="line"><a name="l00182"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#ac3d4e32482af3ec2158643d9996d78da"> 182</a></span> constexpr <span class="keywordtype">int</span> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#ac3d4e32482af3ec2158643d9996d78da">SHUT_WR</a> = SD_SEND;</div> +<div class="line"><a name="l00183"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#abc5dbd13b73a0a66d7fa25364a3f7d77"> 183</a></span> constexpr <span class="keywordtype">int</span> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#abc5dbd13b73a0a66d7fa25364a3f7d77">SHUT_RDWR</a> = SD_BOTH;</div> +<div class="line"><a name="l00184"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a8810ebeb993fc304af15b6cb1544ddf1"> 184</a></span> constexpr <span class="keywordtype">int</span> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a8810ebeb993fc304af15b6cb1544ddf1">MSG_NOSIGNAL</a> = 0; <span class="comment">// `SIGPIPE` signal does not exist on Windows.</span></div> +<div class="line"><a name="l00185"></a><span class="lineno"> 185</span> </div> +<div class="line"><a name="l00186"></a><span class="lineno"> 186</span> <span class="comment">// The following functions are usually macros on POSIX; we provide them here as</span></div> +<div class="line"><a name="l00187"></a><span class="lineno"> 187</span> <span class="comment">// functions to avoid having global macros lying around. Note that these</span></div> +<div class="line"><a name="l00188"></a><span class="lineno"> 188</span> <span class="comment">// operate on the `_stat` struct (a Windows version of the standard POSIX</span></div> +<div class="line"><a name="l00189"></a><span class="lineno"> 189</span> <span class="comment">// `stat` struct), of which the `st_mode` field is known to be an `int`.</span></div> +<div class="line"><a name="l00190"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#abc71c1741c013cc1f2fb33c5e1e6f139"> 190</a></span> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#abc71c1741c013cc1f2fb33c5e1e6f139">S_ISDIR</a>(<span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="namespaceos_1_1stat.html#a0b77d3699a25c2c39a29b36062f07321">mode</a>)</div> +<div class="line"><a name="l00191"></a><span class="lineno"> 191</span> {</div> +<div class="line"><a name="l00192"></a><span class="lineno"> 192</span>  <span class="keywordflow">return</span> (mode & S_IFMT) == S_IFDIR; <span class="comment">// Directory.</span></div> +<div class="line"><a name="l00193"></a><span class="lineno"> 193</span> }</div> +<div class="line"><a name="l00194"></a><span class="lineno"> 194</span> </div> +<div class="line"><a name="l00195"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a4c11a40f6ccc71f875e8f11929aad707"> 195</a></span> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a4c11a40f6ccc71f875e8f11929aad707">S_ISREG</a>(<span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="namespaceos_1_1stat.html#a0b77d3699a25c2c39a29b36062f07321">mode</a>)</div> +<div class="line"><a name="l00196"></a><span class="lineno"> 196</span> {</div> +<div class="line"><a name="l00197"></a><span class="lineno"> 197</span>  <span class="keywordflow">return</span> (mode & S_IFMT) == S_IFREG; <span class="comment">// File.</span></div> +<div class="line"><a name="l00198"></a><span class="lineno"> 198</span> }</div> +<div class="line"><a name="l00199"></a><span class="lineno"> 199</span> </div> +<div class="line"><a name="l00200"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a74ba556c8168bb9556a34cf25d5fbb4a"> 200</a></span> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a74ba556c8168bb9556a34cf25d5fbb4a">S_ISCHR</a>(<span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="namespaceos_1_1stat.html#a0b77d3699a25c2c39a29b36062f07321">mode</a>)</div> +<div class="line"><a name="l00201"></a><span class="lineno"> 201</span> {</div> +<div class="line"><a name="l00202"></a><span class="lineno"> 202</span>  <span class="keywordflow">return</span> (mode & S_IFMT) == S_IFCHR; <span class="comment">// Character device.</span></div> +<div class="line"><a name="l00203"></a><span class="lineno"> 203</span> }</div> +<div class="line"><a name="l00204"></a><span class="lineno"> 204</span> </div> +<div class="line"><a name="l00205"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#ac0d1cccc8a710f9b2ca7e8f25892d2a5"> 205</a></span> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#ac0d1cccc8a710f9b2ca7e8f25892d2a5">S_ISFIFO</a>(<span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="namespaceos_1_1stat.html#a0b77d3699a25c2c39a29b36062f07321">mode</a>)</div> +<div class="line"><a name="l00206"></a><span class="lineno"> 206</span> {</div> +<div class="line"><a name="l00207"></a><span class="lineno"> 207</span>  <span class="keywordflow">return</span> (mode & S_IFMT) == _S_IFIFO; <span class="comment">// Pipe.</span></div> +<div class="line"><a name="l00208"></a><span class="lineno"> 208</span> }</div> +<div class="line"><a name="l00209"></a><span class="lineno"> 209</span> </div> +<div class="line"><a name="l00210"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a292ccd479f68ea0e4b53ee393f165872"> 210</a></span> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a292ccd479f68ea0e4b53ee393f165872">S_ISBLK</a>(<span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="namespaceos_1_1stat.html#a0b77d3699a25c2c39a29b36062f07321">mode</a>)</div> +<div class="line"><a name="l00211"></a><span class="lineno"> 211</span> {</div> +<div class="line"><a name="l00212"></a><span class="lineno"> 212</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>; <span class="comment">// Block special device.</span></div> +<div class="line"><a name="l00213"></a><span class="lineno"> 213</span> }</div> +<div class="line"><a name="l00214"></a><span class="lineno"> 214</span> </div> +<div class="line"><a name="l00215"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a953b4d8769906f7afe486c0ee0955fd3"> 215</a></span> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a953b4d8769906f7afe486c0ee0955fd3">S_ISSOCK</a>(<span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="namespaceos_1_1stat.html#a0b77d3699a25c2c39a29b36062f07321">mode</a>)</div> +<div class="line"><a name="l00216"></a><span class="lineno"> 216</span> {</div> +<div class="line"><a name="l00217"></a><span class="lineno"> 217</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>; <span class="comment">// Socket.</span></div> +<div class="line"><a name="l00218"></a><span class="lineno"> 218</span> }</div> +<div class="line"><a name="l00219"></a><span class="lineno"> 219</span> </div> +<div class="line"><a name="l00220"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a255249008157db126b6981929505f9e4"> 220</a></span> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a255249008157db126b6981929505f9e4">S_ISLNK</a>(<span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="namespaceos_1_1stat.html#a0b77d3699a25c2c39a29b36062f07321">mode</a>)</div> +<div class="line"><a name="l00221"></a><span class="lineno"> 221</span> {</div> +<div class="line"><a name="l00222"></a><span class="lineno"> 222</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>; <span class="comment">// Symbolic link.</span></div> +<div class="line"><a name="l00223"></a><span class="lineno"> 223</span> }</div> +<div class="line"><a name="l00224"></a><span class="lineno"> 224</span> </div> +<div class="line"><a name="l00225"></a><span class="lineno"> 225</span> <span class="comment">// Permissions API. (cf. MESOS-3176 to track ongoing permissions work.)</span></div> +<div class="line"><a name="l00226"></a><span class="lineno"> 226</span> <span class="comment">//</span></div> +<div class="line"><a name="l00227"></a><span class="lineno"> 227</span> <span class="comment">// We are currently able to emulate a subset of the POSIX permissions model</span></div> +<div class="line"><a name="l00228"></a><span class="lineno"> 228</span> <span class="comment">// with the Windows model:</span></div> +<div class="line"><a name="l00229"></a><span class="lineno"> 229</span> <span class="comment">// [x] User write permissions.</span></div> +<div class="line"><a name="l00230"></a><span class="lineno"> 230</span> <span class="comment">// [x] User read permissions.</span></div> +<div class="line"><a name="l00231"></a><span class="lineno"> 231</span> <span class="comment">// [ ] User execute permissions.</span></div> +<div class="line"><a name="l00232"></a><span class="lineno"> 232</span> <span class="comment">// [ ] Group permissions of any sort.</span></div> +<div class="line"><a name="l00233"></a><span class="lineno"> 233</span> <span class="comment">// [ ] Other permissions of any sort.</span></div> +<div class="line"><a name="l00234"></a><span class="lineno"> 234</span> <span class="comment">// [x] Flags to control "fallback" behavior (e.g., we might choose</span></div> +<div class="line"><a name="l00235"></a><span class="lineno"> 235</span> <span class="comment">// to fall back to user readability when the user passes the</span></div> +<div class="line"><a name="l00236"></a><span class="lineno"> 236</span> <span class="comment">// group readability flag in, since we currently do not support</span></div> +<div class="line"><a name="l00237"></a><span class="lineno"> 237</span> <span class="comment">// group readability).</span></div> +<div class="line"><a name="l00238"></a><span class="lineno"> 238</span> <span class="comment">//</span></div> +<div class="line"><a name="l00239"></a><span class="lineno"> 239</span> <span class="comment">//</span></div> +<div class="line"><a name="l00240"></a><span class="lineno"> 240</span> <span class="comment">// Rationale:</span></div> +<div class="line"><a name="l00241"></a><span class="lineno"> 241</span> <span class="comment">// Windows currently implements two permissions models: (1) an extremely</span></div> +<div class="line"><a name="l00242"></a><span class="lineno"> 242</span> <span class="comment">// primitive permission model it largely inherited from DOS, and (2) the Access</span></div> +<div class="line"><a name="l00243"></a><span class="lineno"> 243</span> <span class="comment">// Control List (ACL) API. Because there is no trivial way to map the classic</span></div> +<div class="line"><a name="l00244"></a><span class="lineno"> 244</span> <span class="comment">// POSIX model into the ACL model, we have implemented POSIX-style permissions</span></div> +<div class="line"><a name="l00245"></a><span class="lineno"> 245</span> <span class="comment">// in terms of the DOS model. The result is the permissions limitations above.</span></div> +<div class="line"><a name="l00246"></a><span class="lineno"> 246</span> <span class="comment">//</span></div> +<div class="line"><a name="l00247"></a><span class="lineno"> 247</span> <span class="comment">//</span></div> +<div class="line"><a name="l00248"></a><span class="lineno"> 248</span> <span class="comment">// Flag implementation:</span></div> +<div class="line"><a name="l00249"></a><span class="lineno"> 249</span> <span class="comment">// Flags fall into the following two categories.</span></div> +<div class="line"><a name="l00250"></a><span class="lineno"> 250</span> <span class="comment">// (1) Flags which exist in both permission models, but which have</span></div> +<div class="line"><a name="l00251"></a><span class="lineno"> 251</span> <span class="comment">// different names (e.g., `S_IRUSR` in POSIX is called `_S_IREAD` on</span></div> +<div class="line"><a name="l00252"></a><span class="lineno"> 252</span> <span class="comment">// Windows). In this case, we define the POSIX name to be the Windows</span></div> +<div class="line"><a name="l00253"></a><span class="lineno"> 253</span> <span class="comment">// value (e.g., we define `S_IRUSR` to have the same value as `_S_IREAD`),</span></div> +<div class="line"><a name="l00254"></a><span class="lineno"> 254</span> <span class="comment">// so that we can pass the POSIX name into Windows functions like</span></div> +<div class="line"><a name="l00255"></a><span class="lineno"> 255</span> <span class="comment">// `_open`.</span></div> +<div class="line"><a name="l00256"></a><span class="lineno"> 256</span> <span class="comment">// (2) Flags which exist only on POSIX (e.g., `S_IXUSR`). Here we</span></div> +<div class="line"><a name="l00257"></a><span class="lineno"> 257</span> <span class="comment">// define the POSIX name to be the value given in the glibc</span></div> +<div class="line"><a name="l00258"></a><span class="lineno"> 258</span> <span class="comment">// documentation[1], shifted left by 16 bits (since `mode_t`</span></div> +<div class="line"><a name="l00259"></a><span class="lineno"> 259</span> <span class="comment">// is unsigned short on POSIX and `int` on Windows). We give these</span></div> +<div class="line"><a name="l00260"></a><span class="lineno"> 260</span> <span class="comment">// flags glibc values to stay consistent, and so that existing</span></div> +<div class="line"><a name="l00261"></a><span class="lineno"> 261</span> <span class="comment">// calls to functions like `open` do not break when they try to</span></div> +<div class="line"><a name="l00262"></a><span class="lineno"> 262</span> <span class="comment">// use a flag that doesn't exist on Windows. But, of course,</span></div> +<div class="line"><a name="l00263"></a><span class="lineno"> 263</span> <span class="comment">// these flags do not affect the execution of these functions.</span></div> +<div class="line"><a name="l00264"></a><span class="lineno"> 264</span> <span class="comment">//</span></div> +<div class="line"><a name="l00265"></a><span class="lineno"> 265</span> <span class="comment">//</span></div> +<div class="line"><a name="l00266"></a><span class="lineno"> 266</span> <span class="comment">// Flag strictness:</span></div> +<div class="line"><a name="l00267"></a><span class="lineno"> 267</span> <span class="comment">// Because the current implementation does not directly support setting or</span></div> +<div class="line"><a name="l00268"></a><span class="lineno"> 268</span> <span class="comment">// getting group or other permission bits on the Windows platform, there is a</span></div> +<div class="line"><a name="l00269"></a><span class="lineno"> 269</span> <span class="comment">// question of what we should fall back to when these flags are passed in to</span></div> +<div class="line"><a name="l00270"></a><span class="lineno"> 270</span> <span class="comment">// Stout methods.</span></div> +<div class="line"><a name="l00271"></a><span class="lineno"> 271</span> <span class="comment">//</span></div> +<div class="line"><a name="l00272"></a><span class="lineno"> 272</span> <span class="comment">// TODO(hausdorff): Investigate permissions mappings.</span></div> +<div class="line"><a name="l00273"></a><span class="lineno"> 273</span> <span class="comment">// We force "strictness" of the permission flag semantics:</span></div> +<div class="line"><a name="l00274"></a><span class="lineno"> 274</span> <span class="comment">// * The group permissions flags will not fall back to anything, and will be</span></div> +<div class="line"><a name="l00275"></a><span class="lineno"> 275</span> <span class="comment">// completely ignored.</span></div> +<div class="line"><a name="l00276"></a><span class="lineno"> 276</span> <span class="comment">// * Other permissions: Same as above, but with other permissions.</span></div> +<div class="line"><a name="l00277"></a><span class="lineno"> 277</span> <span class="comment">//</span></div> +<div class="line"><a name="l00278"></a><span class="lineno"> 278</span> <span class="comment">//</span></div> +<div class="line"><a name="l00279"></a><span class="lineno"> 279</span> <span class="comment">// Execute permissions:</span></div> +<div class="line"><a name="l00280"></a><span class="lineno"> 280</span> <span class="comment">// Because DOS has no notion of "execute permissions", we define execute</span></div> +<div class="line"><a name="l00281"></a><span class="lineno"> 281</span> <span class="comment">// permissions to be read permissions. This is not ideal, but it is closest to</span></div> +<div class="line"><a name="l00282"></a><span class="lineno"> 282</span> <span class="comment">// being accurate.</span></div> +<div class="line"><a name="l00283"></a><span class="lineno"> 283</span> <span class="comment">//</span></div> +<div class="line"><a name="l00284"></a><span class="lineno"> 284</span> <span class="comment">//</span></div> +<div class="line"><a name="l00285"></a><span class="lineno"> 285</span> <span class="comment">// [1] http://www.delorie.com/gnu/docs/glibc/libc_288.html</span></div> +<div class="line"><a name="l00286"></a><span class="lineno"> 286</span> </div> +<div class="line"><a name="l00287"></a><span class="lineno"> 287</span> </div> +<div class="line"><a name="l00288"></a><span class="lineno"> 288</span> <span class="comment">// User permission flags.</span></div> +<div class="line"><a name="l00289"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a66cff14a0638cde9f422c7a4b0938e61"> 289</a></span> <span class="keyword">const</span> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a8a35dd1207a16dfa8b1d4163176d828c">mode_t</a> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a66cff14a0638cde9f422c7a4b0938e61">S_IRUSR</a> = <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a8a35dd1207a16dfa8b1d4163176d828c">mode_t</a>(_S_IREAD); <span class="comment">// Readable by user.</span></div> +<div class="line"><a name="l00290"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#aead39710af2622ee9b0d412f62e90aa5"> 290</a></span> <span class="keyword">const</span> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a8a35dd1207a16dfa8b1d4163176d828c">mode_t</a> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#aead39710af2622ee9b0d412f62e90aa5">S_IWUSR</a> = <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a8a35dd1207a16dfa8b1d4163176d828c">mode_t</a>(_S_IWRITE); <span class="comment">// Writeable by user.</span></div> +<div class="line"><a name="l00291"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a4b9804a141ece40bfe29a8230f755de3"> 291</a></span> <span class="keyword">const</span> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a8a35dd1207a16dfa8b1d4163176d828c">mode_t</a> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a4b9804a141ece40bfe29a8230f755de3">S_IXUSR</a> = <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a66cff14a0638cde9f422c7a4b0938e61">S_IRUSR</a>; <span class="comment">// Fallback to user read.</span></div> +<div class="line"><a name="l00292"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a7263fafb4db5d82a74d63e6f2f82c119"> 292</a></span> <span class="keyword">const</span> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a8a35dd1207a16dfa8b1d4163176d828c">mode_t</a> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a7263fafb4db5d82a74d63e6f2f82c119">S_IRWXU</a> = <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a66cff14a0638cde9f422c7a4b0938e61">S_IRUSR</a> | <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#aead39710af2622ee9b0d412f62e90aa5">S_IWUSR</a> | <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a4b9804a141ece40bfe29a8230f755de3">S_IXUSR</a>;</div> +<div class="line"><a name="l00293"></a><span class="lineno"> 293</span> </div> +<div class="line"><a name="l00294"></a><span class="lineno"> 294</span> </div> +<div class="line"><a name="l00295"></a><span class="lineno"> 295</span> <span class="comment">// Group permission flags. Lossy mapping to Windows permissions. See</span></div> +<div class="line"><a name="l00296"></a><span class="lineno"> 296</span> <span class="comment">// note above about flag strictness for explanation.</span></div> +<div class="line"><a name="l00297"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a55fad1c3746e1b8a6a00c10998e91d91"> 297</a></span> <span class="keyword">const</span> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a8a35dd1207a16dfa8b1d4163176d828c">mode_t</a> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a55fad1c3746e1b8a6a00c10998e91d91">S_IRGRP</a> = 0x00200000; <span class="comment">// No-op.</span></div> +<div class="line"><a name="l00298"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a104b6f6389e148475ffedf6ff89bb4b4"> 298</a></span> <span class="keyword">const</span> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a8a35dd1207a16dfa8b1d4163176d828c">mode_t</a> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a104b6f6389e148475ffedf6ff89bb4b4">S_IWGRP</a> = 0x00100000; <span class="comment">// No-op.</span></div> +<div class="line"><a name="l00299"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a5550c0f23427e2286bdf67311f245c1a"> 299</a></span> <span class="keyword">const</span> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a8a35dd1207a16dfa8b1d4163176d828c">mode_t</a> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a5550c0f23427e2286bdf67311f245c1a">S_IXGRP</a> = 0x00080000; <span class="comment">// No-op.</span></div> +<div class="line"><a name="l00300"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#ae82daeec3d114157ac3099de74c0c12c"> 300</a></span> <span class="keyword">const</span> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a8a35dd1207a16dfa8b1d4163176d828c">mode_t</a> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#ae82daeec3d114157ac3099de74c0c12c">S_IRWXG</a> = <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a55fad1c3746e1b8a6a00c10998e91d91">S_IRGRP</a> | <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a104b6f6389e148475ffedf6ff89bb4b4">S_IWGRP</a> | <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a5550c0f23427e2286bdf67311f245c1a">S_IXGRP</a>;</div> +<div class="line"><a name="l00301"></a><span class="lineno"> 301</span> </div> +<div class="line"><a name="l00302"></a><span class="lineno"> 302</span> </div> +<div class="line"><a name="l00303"></a><span class="lineno"> 303</span> <span class="comment">// Other permission flags. Lossy mapping to Windows permissions. See</span></div> +<div class="line"><a name="l00304"></a><span class="lineno"> 304</span> <span class="comment">// note above about flag stictness for explanation.</span></div> +<div class="line"><a name="l00305"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a90d7514882640a8cd7b8da14138103b7"> 305</a></span> <span class="keyword">const</span> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a8a35dd1207a16dfa8b1d4163176d828c">mode_t</a> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a90d7514882640a8cd7b8da14138103b7">S_IROTH</a> = 0x00040000; <span class="comment">// No-op.</span></div> +<div class="line"><a name="l00306"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#aa80ed5bd3460d4c6351b8f4f1fc7e113"> 306</a></span> <span class="keyword">const</span> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a8a35dd1207a16dfa8b1d4163176d828c">mode_t</a> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#aa80ed5bd3460d4c6351b8f4f1fc7e113">S_IWOTH</a> = 0x00020000; <span class="comment">// No-op.</span></div> +<div class="line"><a name="l00307"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#ad8f972ab510ada61a27150aae9066e87"> 307</a></span> <span class="keyword">const</span> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a8a35dd1207a16dfa8b1d4163176d828c">mode_t</a> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#ad8f972ab510ada61a27150aae9066e87">S_IXOTH</a> = 0x00010000; <span class="comment">// No-op.</span></div> +<div class="line"><a name="l00308"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#ad458428f53a34e96c15508642515a22c"> 308</a></span> <span class="keyword">const</span> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a8a35dd1207a16dfa8b1d4163176d828c">mode_t</a> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#ad458428f53a34e96c15508642515a22c">S_IRWXO</a> = <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a90d7514882640a8cd7b8da14138103b7">S_IROTH</a> | <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#aa80ed5bd3460d4c6351b8f4f1fc7e113">S_IWOTH</a> | <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#ad8f972ab510ada61a27150aae9066e87">S_IXOTH</a>;</div> +<div class="line"><a name="l00309"></a><span class="lineno"> 309</span> </div> +<div class="line"><a name="l00310"></a><span class="lineno"> 310</span> </div> +<div class="line"><a name="l00311"></a><span class="lineno"> 311</span> <span class="comment">// Flags for set-ID-on-exec.</span></div> +<div class="line"><a name="l00312"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#ad5e72f5d6976766f19df07de0fe396af"> 312</a></span> <span class="keyword">const</span> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a8a35dd1207a16dfa8b1d4163176d828c">mode_t</a> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#ad5e72f5d6976766f19df07de0fe396af">S_ISUID</a> = 0x08000000; <span class="comment">// No-op.</span></div> +<div class="line"><a name="l00313"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a37128804bcbf50f3b90aa953a9838e69"> 313</a></span> <span class="keyword">const</span> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a8a35dd1207a16dfa8b1d4163176d828c">mode_t</a> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a37128804bcbf50f3b90aa953a9838e69">S_ISGID</a> = 0x04000000; <span class="comment">// No-op.</span></div> +<div class="line"><a name="l00314"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a72447377d3eed3788e1b39679b310cf3"> 314</a></span> <span class="keyword">const</span> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a8a35dd1207a16dfa8b1d4163176d828c">mode_t</a> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a72447377d3eed3788e1b39679b310cf3">S_ISVTX</a> = 0x02000000; <span class="comment">// No-op.</span></div> +<div class="line"><a name="l00315"></a><span class="lineno"> 315</span> </div> +<div class="line"><a name="l00316"></a><span class="lineno"> 316</span> </div> +<div class="line"><a name="l00317"></a><span class="lineno"> 317</span> <span class="comment">// Flags not supported by Windows.</span></div> +<div class="line"><a name="l00318"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a2ecbb6269fcd18d1c24f57e832e0c826"> 318</a></span> <span class="keyword">const</span> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a8a35dd1207a16dfa8b1d4163176d828c">mode_t</a> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a2ecbb6269fcd18d1c24f57e832e0c826">O_SYNC</a> = 0x00000000; <span class="comment">// No-op.</span></div> +<div class="line"><a name="l00319"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a77e5b4350976a72c8b7592fcf5339d2c"> 319</a></span> <span class="keyword">const</span> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a8a35dd1207a16dfa8b1d4163176d828c">mode_t</a> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a77e5b4350976a72c8b7592fcf5339d2c">O_NONBLOCK</a> = 0x00000000; <span class="comment">// No-op.</span></div> +<div class="line"><a name="l00320"></a><span class="lineno"> 320</span> </div> +<div class="line"><a name="l00321"></a><span class="lineno"> 321</span> <span class="comment">// Linux signal flags not used in Windows. We define them per</span></div> +<div class="line"><a name="l00322"></a><span class="lineno"> 322</span> <span class="comment">// `Linux sys/signal.h` to branch properly for Windows</span></div> +<div class="line"><a name="l00323"></a><span class="lineno"> 323</span> <span class="comment">// processes' stop, resume and kill.</span></div> +<div class="line"><a name="l00324"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a583621044da0b9775420b5e6795e22c1"> 324</a></span> <span class="keyword">const</span> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a8a35dd1207a16dfa8b1d4163176d828c">mode_t</a> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a583621044da0b9775420b5e6795e22c1">SIGCONT</a> = 0x00000009; <span class="comment">// Signal Cont.</span></div> +<div class="line"><a name="l00325"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a299f699bc9fdaaf73479c52af4ace22d"> 325</a></span> <span class="keyword">const</span> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a8a35dd1207a16dfa8b1d4163176d828c">mode_t</a> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a299f699bc9fdaaf73479c52af4ace22d">SIGSTOP</a> = 0x00000011; <span class="comment">// Signal Stop.</span></div> +<div class="line"><a name="l00326"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a1c2b5693161bbc9d516ef5d16c7b54f5"> 326</a></span> <span class="keyword">const</span> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a8a35dd1207a16dfa8b1d4163176d828c">mode_t</a> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a1c2b5693161bbc9d516ef5d16c7b54f5">SIGKILL</a> = 0x00000013; <span class="comment">// Signal Kill.</span></div> +<div class="line"><a name="l00327"></a><span class="lineno"> 327</span> </div> +<div class="line"><a name="l00328"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a62c88b2ce7fd7f9c5dfa981befe35c48"> 328</a></span> <span class="keyword">inline</span> <span class="keyword">auto</span> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a62c88b2ce7fd7f9c5dfa981befe35c48">strerror_r</a>(<span class="keywordtype">int</span> errnum, <span class="keywordtype">char</span>* buffer, <span class="keywordtype">size_t</span> length) -></div> +<div class="line"><a name="l00329"></a><span class="lineno"> 329</span> decltype(strerror_s(buffer, length, errnum))</div> +<div class="line"><a name="l00330"></a><span class="lineno"> 330</span> {</div> +<div class="line"><a name="l00331"></a><span class="lineno"> 331</span>  <span class="keywordflow">return</span> strerror_s(buffer, length, errnum);</div> +<div class="line"><a name="l00332"></a><span class="lineno"> 332</span> }</div> +<div class="line"><a name="l00333"></a><span class="lineno"> 333</span> </div> +<div class="line"><a name="l00334"></a><span class="lineno"> 334</span> </div> +<div class="line"><a name="l00335"></a><span class="lineno"> 335</span> <span class="comment">// File I/O function aliases.</span></div> +<div class="line"><a name="l00336"></a><span class="lineno"> 336</span> <span class="comment">//</span></div> +<div class="line"><a name="l00337"></a><span class="lineno"> 337</span> <span class="comment">// NOTE: The use of `auto` and the trailing return type in the following</span></div> +<div class="line"><a name="l00338"></a><span class="lineno"> 338</span> <span class="comment">// functions are meant to make it easier for Linux developers to use and</span></div> +<div class="line"><a name="l00339"></a><span class="lineno"> 339</span> <span class="comment">// maintain the code. It is an explicit marker that we are using the compiler</span></div> +<div class="line"><a name="l00340"></a><span class="lineno"> 340</span> <span class="comment">// to guarantee that the return type is identical to whatever is in the Windows</span></div> +<div class="line"><a name="l00341"></a><span class="lineno"> 341</span> <span class="comment">// implementation of the standard.</span></div> +<div class="line"><a name="l00342"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a11ddc12643f91eac70d638512b07e96a"> 342</a></span> <span class="keyword">inline</span> <span class="keyword">auto</span> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a11ddc12643f91eac70d638512b07e96a">chdir</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* path) -></div> +<div class="line"><a name="l00343"></a><span class="lineno"> 343</span> decltype(_chdir(path))</div> +<div class="line"><a name="l00344"></a><span class="lineno"> 344</span> {</div> +<div class="line"><a name="l00345"></a><span class="lineno"> 345</span>  <span class="keywordflow">return</span> _chdir(path);</div> +<div class="line"><a name="l00346"></a><span class="lineno"> 346</span> }</div> +<div class="line"><a name="l00347"></a><span class="lineno"> 347</span> </div> +<div class="line"><a name="l00348"></a><span class="lineno"> 348</span> </div> +<div class="line"><a name="l00349"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#aaebcdd83125f05efdf43f167afda1b96"> 349</a></span> <span class="keyword">inline</span> <span class="keywordtype">char</span>* <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#aaebcdd83125f05efdf43f167afda1b96">getcwd</a>(<span class="keywordtype">char</span>* path, <span class="keywordtype">size_t</span> maxlen)</div> +<div class="line"><a name="l00350"></a><span class="lineno"> 350</span> {</div> +<div class="line"><a name="l00351"></a><span class="lineno"> 351</span>  CHECK_LE(maxlen, INT_MAX);</div> +<div class="line"><a name="l00352"></a><span class="lineno"> 352</span>  <span class="keywordflow">return</span> _getcwd(path, static_cast<int>(maxlen));</div> +<div class="line"><a name="l00353"></a><span class="lineno"> 353</span> }</div> +<div class="line"><a name="l00354"></a><span class="lineno"> 354</span> </div> +<div class="line"><a name="l00355"></a><span class="lineno"> 355</span> </div> +<div class="line"><a name="l00356"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a7c14ffcd8b1139a0f616fd448c9a9876"> 356</a></span> <span class="keyword">inline</span> <span class="keyword">auto</span> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a7c14ffcd8b1139a0f616fd448c9a9876">mkdir</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* path, <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a8a35dd1207a16dfa8b1d4163176d828c">mode_t</a> <a class="code" href="namespaceos_1_1stat.html#a0b77d3699a25c2c39a29b36062f07321">mode</a>) -></div> +<div class="line"><a name="l00357"></a><span class="lineno"> 357</span> decltype(_mkdir(path))</div> +<div class="line"><a name="l00358"></a><span class="lineno"> 358</span> {</div> +<div class="line"><a name="l00359"></a><span class="lineno"> 359</span>  <span class="keywordflow">return</span> _mkdir(path);</div> +<div class="line"><a name="l00360"></a><span class="lineno"> 360</span> }</div> +<div class="line"><a name="l00361"></a><span class="lineno"> 361</span> </div> +<div class="line"><a name="l00362"></a><span class="lineno"> 362</span> </div> +<div class="line"><a name="l00363"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a7b14e8340f5ee18e76204f49bb001d8f"> 363</a></span> <span class="keyword">inline</span> <span class="keyword">auto</span> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a7b14e8340f5ee18e76204f49bb001d8f">mktemp</a>(<span class="keywordtype">char</span>* path) -></div> +<div class="line"><a name="l00364"></a><span class="lineno"> 364</span> decltype(_mktemp(path))</div> +<div class="line"><a name="l00365"></a><span class="lineno"> 365</span> {</div> +<div class="line"><a name="l00366"></a><span class="lineno"> 366</span>  <span class="keywordflow">return</span> _mktemp(path);</div> +<div class="line"><a name="l00367"></a><span class="lineno"> 367</span> }</div> +<div class="line"><a name="l00368"></a><span class="lineno"> 368</span> </div> +<div class="line"><a name="l00369"></a><span class="lineno"> 369</span> </div> +<div class="line"><a name="l00370"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a43b86a5123375ac18f9947711905a689"> 370</a></span> <span class="keyword">inline</span> <span class="keyword">auto</span> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a43b86a5123375ac18f9947711905a689">mkstemp</a>(<span class="keywordtype">char</span>* path) -></div> +<div class="line"><a name="l00371"></a><span class="lineno"> 371</span> decltype(_mktemp_s(path, strlen(path) + 1))</div> +<div class="line"><a name="l00372"></a><span class="lineno"> 372</span> {</div> +<div class="line"><a name="l00373"></a><span class="lineno"> 373</span>  <span class="comment">// NOTE: in the POSIX spec, `mkstemp` will generate a random filename from</span></div> +<div class="line"><a name="l00374"></a><span class="lineno"> 374</span>  <span class="comment">// the `path` template, `open` that filename, and return the resulting file</span></div> +<div class="line"><a name="l00375"></a><span class="lineno"> 375</span>  <span class="comment">// descriptor. On Windows, `_mktemp_s` will actually only generate the path,</span></div> +<div class="line"><a name="l00376"></a><span class="lineno"> 376</span>  <span class="comment">// so here we actually have to call `open` ourselves to get a file descriptor</span></div> +<div class="line"><a name="l00377"></a><span class="lineno"> 377</span>  <span class="comment">// we can return as a result.</span></div> +<div class="line"><a name="l00378"></a><span class="lineno"> 378</span>  <span class="keywordflow">if</span> (_mktemp_s(path, strlen(path) + 1) != 0) {</div> +<div class="line"><a name="l00379"></a><span class="lineno"> 379</span>  <span class="keywordflow">return</span> -1;</div> +<div class="line"><a name="l00380"></a><span class="lineno"> 380</span>  }</div> +<div class="line"><a name="l00381"></a><span class="lineno"> 381</span> </div> +<div class="line"><a name="l00382"></a><span class="lineno"> 382</span>  <span class="comment">// NOTE: We open the file with read / write access for the given user, an</span></div> +<div class="line"><a name="l00383"></a><span class="lineno"> 383</span>  <span class="comment">// attempt to match POSIX's specification of `mkstemp`. We use `_S_IREAD` and</span></div> +<div class="line"><a name="l00384"></a><span class="lineno"> 384</span>  <span class="comment">// `_S_IWRITE` here instead of the POSIX equivalents. On Windows the file is</span></div> +<div class="line"><a name="l00385"></a><span class="lineno"> 385</span>  <span class="comment">// is not present, we use `_O_CREAT` option when opening the file.</span></div> +<div class="line"><a name="l00386"></a><span class="lineno"> 386</span>  <span class="keywordflow">return</span> _open(path, _O_CREAT, _S_IREAD | _S_IWRITE);</div> +<div class="line"><a name="l00387"></a><span class="lineno"> 387</span> }</div> +<div class="line"><a name="l00388"></a><span class="lineno"> 388</span> </div> +<div class="line"><a name="l00389"></a><span class="lineno"> 389</span> </div> +<div class="line"><a name="l00390"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a0ed376d39d5461e0bd7216e8016c0912"> 390</a></span> <span class="keyword">inline</span> <span class="keyword">auto</span> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a0ed376d39d5461e0bd7216e8016c0912">realpath</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* path, <span class="keywordtype">char</span>* resolved) -></div> +<div class="line"><a name="l00391"></a><span class="lineno"> 391</span> decltype(_fullpath(resolved, path, <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#ae688d728e1acdfe5988c7db45d6f0166">PATH_MAX</a>))</div> +<div class="line"><a name="l00392"></a><span class="lineno"> 392</span> {</div> +<div class="line"><a name="l00393"></a><span class="lineno"> 393</span>  <span class="keywordflow">return</span> _fullpath(resolved, path, <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#ae688d728e1acdfe5988c7db45d6f0166">PATH_MAX</a>);</div> +<div class="line"><a name="l00394"></a><span class="lineno"> 394</span> }</div> +<div class="line"><a name="l00395"></a><span class="lineno"> 395</span> </div> +<div class="line"><a name="l00396"></a><span class="lineno"> 396</span> </div> +<div class="line"><a name="l00397"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a183c9254867f964281aabd1098ee04ce"> 397</a></span> <span class="keyword">inline</span> <span class="keyword">auto</span> <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a183c9254867f964281aabd1098ee04ce">access</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* fileName, <span class="keywordtype">int</span> accessMode) -></div> +<div class="line"><a name="l00398"></a><span class="lineno"> 398</span> decltype(_access(fileName, accessMode))</div> +<div class="line"><a name="l00399"></a><span class="lineno"> 399</span> {</div> +<div class="line"><a name="l00400"></a><span class="lineno"> 400</span>  <span class="keywordflow">return</span> _access(fileName, accessMode);</div> +<div class="line"><a name="l00401"></a><span class="lineno"> 401</span> }</div> +<div class="line"><a name="l00402"></a><span class="lineno"> 402</span> </div> +<div class="line"><a name="l00403"></a><span class="lineno"> 403</span> </div> +<div class="line"><a name="l00404"></a><span class="lineno"> 404</span> <span class="comment">// NOTE: Signals do not exist on Windows, so all signals are unknown.</span></div> +<div class="line"><a name="l00405"></a><span class="lineno"> 405</span> <span class="comment">// If the signal number is unknown, the Posix specification leaves the</span></div> +<div class="line"><a name="l00406"></a><span class="lineno"> 406</span> <span class="comment">// return value of `strsignal` unspecified.</span></div> +<div class="line"><a name="l00407"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a3858fc90369448097210e69437ca7c66"> 407</a></span> <span class="keyword">inline</span> <span class="keyword">const</span> <span class="keywordtype">char</span>* <a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a3858fc90369448097210e69437ca7c66">strsignal</a>(<span class="keywordtype">int</span> signum)</div> +<div class="line"><a name="l00408"></a><span class="lineno"> 408</span> {</div> +<div class="line"><a name="l00409"></a><span class="lineno"> 409</span>  <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> UNKNOWN_STRSIGNAL[] = <span class="stringliteral">"Unknown signal"</span>;</div> +<div class="line"><a name="l00410"></a><span class="lineno"> 410</span>  <span class="keywordflow">return</span> UNKNOWN_STRSIGNAL;</div> +<div class="line"><a name="l00411"></a><span class="lineno"> 411</span> }</div> +<div class="line"><a name="l00412"></a><span class="lineno"> 412</span> </div> +<div class="line"><a name="l00413"></a><span class="lineno"> 413</span> </div> +<div class="line"><a name="l00414"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a57e9c8c5fa13bf86bc779a9f6f408b7c"> 414</a></span> <span class="preprocessor">#define SIGPIPE 100</span></div> +<div class="line"><a name="l00415"></a><span class="lineno"> 415</span> <span class="preprocessor"></span></div> +<div class="line"><a name="l00416"></a><span class="lineno"> 416</span> <span class="comment">// `os::system` returns -1 if the processor cannot be started</span></div> +<div class="line"><a name="l00417"></a><span class="lineno"> 417</span> <span class="comment">// therefore any return value indicates the process has been started</span></div> +<div class="line"><a name="l00418"></a><span class="lineno"> 418</span> <span class="preprocessor">#ifndef WIFEXITED</span></div> +<div class="line"><a name="l00419"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#af9a4ddf9eee6c4a3bc9be070d59b7ccf"> 419</a></span> <span class="preprocessor"></span><span class="preprocessor">#define WIFEXITED(x) ((x) != -1)</span></div> +<div class="line"><a name="l00420"></a><span class="lineno"> 420</span> <span class="preprocessor"></span><span class="preprocessor">#endif // WIFEXITED</span></div> +<div class="line"><a name="l00421"></a><span class="lineno"> 421</span> <span class="preprocessor"></span></div> +<div class="line"><a name="l00422"></a><span class="lineno"> 422</span> <span class="comment">// Returns the exit status of the child.</span></div> +<div class="line"><a name="l00423"></a><span class="lineno"> 423</span> <span class="preprocessor">#ifndef WEXITSTATUS</span></div> +<div class="line"><a name="l00424"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#ae0c8840076dd63d5e2367fff4f7f46f3"> 424</a></span> <span class="preprocessor"></span><span class="preprocessor">#define WEXITSTATUS(x) (x & 0xFF)</span></div> +<div class="line"><a name="l00425"></a><span class="lineno"> 425</span> <span class="preprocessor"></span><span class="preprocessor">#endif // WEXITSTATUS</span></div> +<div class="line"><a name="l00426"></a><span class="lineno"> 426</span> <span class="preprocessor"></span></div> +<div class="line"><a name="l00427"></a><span class="lineno"> 427</span> <span class="preprocessor">#ifndef WIFSIGNALED</span></div> +<div class="line"><a name="l00428"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a6953e62fd0dec274a397678d31c344b4"> 428</a></span> <span class="preprocessor"></span><span class="preprocessor">#define WIFSIGNALED(x) ((x) != -1)</span></div> +<div class="line"><a name="l00429"></a><span class="lineno"> 429</span> <span class="preprocessor"></span><span class="preprocessor">#endif // WIFSIGNALED</span></div> +<div class="line"><a name="l00430"></a><span class="lineno"> 430</span> <span class="preprocessor"></span></div> +<div class="line"><a name="l00431"></a><span class="lineno"> 431</span> <span class="comment">// Returns the number of the signal that caused the child process to</span></div> +<div class="line"><a name="l00432"></a><span class="lineno"> 432</span> <span class="comment">// terminate, only be used if WIFSIGNALED is true.</span></div> +<div class="line"><a name="l00433"></a><span class="lineno"> 433</span> <span class="preprocessor">#ifndef WTERMSIG</span></div> +<div class="line"><a name="l00434"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#aeba4d421572a9d681c73c347f24ad348"> 434</a></span> <span class="preprocessor"></span><span class="preprocessor">#define WTERMSIG(x) 0</span></div> +<div class="line"><a name="l00435"></a><span class="lineno"> 435</span> <span class="preprocessor"></span><span class="preprocessor">#endif // WTERMSIG</span></div> +<div class="line"><a name="l00436"></a><span class="lineno"> 436</span> <span class="preprocessor"></span></div> +<div class="line"><a name="l00437"></a><span class="lineno"> 437</span> <span class="comment">// Whether the child produced a core dump, only be used if WIFSIGNALED is true.</span></div> +<div class="line"><a name="l00438"></a><span class="lineno"> 438</span> <span class="preprocessor">#ifndef WCOREDUMP</span></div> +<div class="line"><a name="l00439"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#a6db11dadebdde2109e82adc8e02befc9"> 439</a></span> <span class="preprocessor"></span><span class="preprocessor">#define WCOREDUMP(x) false</span></div> +<div class="line"><a name="l00440"></a><span class="lineno"> 440</span> <span class="preprocessor"></span><span class="preprocessor">#endif // WCOREDUMP</span></div> +<div class="line"><a name="l00441"></a><span class="lineno"> 441</span> <span class="preprocessor"></span></div> +<div class="line"><a name="l00442"></a><span class="lineno"> 442</span> <span class="comment">// Whether the child was stopped by delivery of a signal.</span></div> +<div class="line"><a name="l00443"></a><span class="lineno"> 443</span> <span class="preprocessor">#ifndef WIFSTOPPED</span></div> +<div class="line"><a name="l00444"></a><span class="lineno"><a class="line" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html#ae2b610235f988f4f3109f02a2f395727"> 444</a></span> <span class="preprocessor"></span><span class="preprocessor">#define WIFSTOPPED(x) false</span></div> +<div class="line"><a name="l00445"></a><span class="lineno"> 445</span> <span class="preprocessor"></span><span class="preprocessor">#endif // WIFSTOPPED</span></div> +<div class="line"><a name="l00446"></a><span class="lineno"> 446</span> <span class="preprocessor"></span></div> +<div class="line"><a name="l00447"></a><span class="lineno"> 447</span> <span class="comment">// Whether the child was stopped by delivery of a signal.</span></div> +<div class="line"><a name="l00448"></a><span class="lineno"> 448</span> <span class="preprocessor">#ifndef WSTOPSIG</span></div> +<div class
<TRUNCATED>