blob: a48985297f43290e69242ac13f7547d2681e5067 [file] [log] [blame]
<!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/libprocess/include/process/io.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&#160;Page</span></a></li>
<li><a href="pages.html"><span>Related&#160;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&#160;List</span></a></li>
<li><a href="globals.html"><span>File&#160;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_043a76de98701f9bddf61b5e98f305ff.html">libprocess</a></li><li class="navelem"><a class="el" href="dir_eac18f7a64f6f8afbd1493ef4e09abdb.html">include</a></li><li class="navelem"><a class="el" href="dir_1894286df79cf582d947dbc4268b06cf.html">process</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">io.hpp</div> </div>
</div><!--header-->
<div class="contents">
<a href="3rdparty_2libprocess_2include_2process_2io_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>&#160;<span class="comment">// Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);</span></div>
<div class="line"><a name="l00002"></a><span class="lineno"> 2</span>&#160;<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>&#160;<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>&#160;<span class="comment">//</span></div>
<div class="line"><a name="l00005"></a><span class="lineno"> 5</span>&#160;<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>&#160;<span class="comment">//</span></div>
<div class="line"><a name="l00007"></a><span class="lineno"> 7</span>&#160;<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>&#160;<span class="comment">// distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</span></div>
<div class="line"><a name="l00009"></a><span class="lineno"> 9</span>&#160;<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>&#160;<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>&#160;<span class="comment">// limitations under the License</span></div>
<div class="line"><a name="l00012"></a><span class="lineno"> 12</span>&#160;</div>
<div class="line"><a name="l00013"></a><span class="lineno"> 13</span>&#160;<span class="preprocessor">#ifndef __PROCESS_IO_HPP__</span></div>
<div class="line"><a name="l00014"></a><span class="lineno"> 14</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define __PROCESS_IO_HPP__</span></div>
<div class="line"><a name="l00015"></a><span class="lineno"> 15</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00016"></a><span class="lineno"> 16</span>&#160;<span class="preprocessor">#include &lt;cstring&gt;</span> <span class="comment">// For size_t.</span></div>
<div class="line"><a name="l00017"></a><span class="lineno"> 17</span>&#160;<span class="preprocessor">#include &lt;string&gt;</span></div>
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span>&#160;</div>
<div class="line"><a name="l00019"></a><span class="lineno"> 19</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="future_8hpp.html">process/future.hpp</a>&gt;</span></div>
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span>&#160;</div>
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="nothing_8hpp.html">stout/nothing.hpp</a>&gt;</span></div>
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span>&#160;<span class="preprocessor">#ifdef __WINDOWS__</span></div>
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#include &lt;<a class="code" href="3rdparty_2stout_2include_2stout_2windows_8hpp.html">stout/windows.hpp</a>&gt;</span></div>
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span>&#160;<span class="preprocessor">#endif // __WINDOWS__</span></div>
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespaceos.html#ae19e4161a51b86a1f330f3bf1dc75389">process</a> {</div>
<div class="line"><a name="l00027"></a><span class="lineno"><a class="line" href="namespaceprocess_1_1io.html"> 27</a></span>&#160;<span class="keyword">namespace </span>io {</div>
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span>&#160;</div>
<div class="line"><a name="l00034"></a><span class="lineno"><a class="line" href="namespaceprocess_1_1io.html#aca1f059ca9f0d7360631c621debeb879"> 34</a></span>&#160;<span class="keyword">const</span> <span class="keywordtype">short</span> <a class="code" href="namespaceprocess_1_1io.html#aca1f059ca9f0d7360631c621debeb879">READ</a> = 0x01;</div>
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span>&#160;</div>
<div class="line"><a name="l00039"></a><span class="lineno"><a class="line" href="namespaceprocess_1_1io.html#ab005316d71b45c5b05de0a6234c6f8fc"> 39</a></span>&#160;<span class="keyword">const</span> <span class="keywordtype">short</span> <a class="code" href="namespaceprocess_1_1io.html#ab005316d71b45c5b05de0a6234c6f8fc">WRITE</a> = 0x02;</div>
<div class="line"><a name="l00040"></a><span class="lineno"> 40</span>&#160;</div>
<div class="line"><a name="l00046"></a><span class="lineno"><a class="line" href="namespaceprocess_1_1io.html#a34d62916736c1dfebd1585cf51f19d0c"> 46</a></span>&#160;<span class="keyword">const</span> <span class="keywordtype">size_t</span> <a class="code" href="namespaceprocess_1_1io.html#a34d62916736c1dfebd1585cf51f19d0c">BUFFERED_READ_SIZE</a> = 16*4096;</div>
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>&#160;</div>
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span>&#160;<span class="comment">// TODO(benh): Add a version which takes multiple file descriptors.</span></div>
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>&#160;<a class="code" href="classprocess_1_1Future.html">Future&lt;short&gt;</a> <a class="code" href="namespaceprocess_1_1io.html#af71c45e0a85e21f6b39060f4e716cebf">poll</a>(<a class="code" href="int__fd_8hpp.html#aea4dbda01c90455f158ffa9b924c2f07">int_fd</a> fd, <span class="keywordtype">short</span> events);</div>
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span>&#160;</div>
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span>&#160;</div>
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>&#160;<a class="code" href="classprocess_1_1Future.html">Future&lt;size_t&gt;</a> <a class="code" href="namespaceprocess_1_1io.html#a4c34d22e475e29f12ac739921dcc580f">read</a>(<a class="code" href="int__fd_8hpp.html#aea4dbda01c90455f158ffa9b924c2f07">int_fd</a> fd, <span class="keywordtype">void</span>* data, <span class="keywordtype">size_t</span> <a class="code" href="namespaceos_1_1stat.html#aac17a91dd3f91341b8c4021025e89b04">size</a>);</div>
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>&#160;</div>
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>&#160;</div>
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span>&#160;<a class="code" href="classprocess_1_1Future.html">Future&lt;std::string&gt;</a> <a class="code" href="namespaceprocess_1_1io.html#a4c34d22e475e29f12ac739921dcc580f">read</a>(<a class="code" href="int__fd_8hpp.html#aea4dbda01c90455f158ffa9b924c2f07">int_fd</a> fd);</div>
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span>&#160;</div>
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span>&#160;</div>
<div class="line"><a name="l00098"></a><span class="lineno"> 98</span>&#160;<a class="code" href="classprocess_1_1Future.html">Future&lt;size_t&gt;</a> <a class="code" href="namespaceprocess_1_1io.html#a49105dc036ad04225c92bd673da5ce39">write</a>(<a class="code" href="int__fd_8hpp.html#aea4dbda01c90455f158ffa9b924c2f07">int_fd</a> fd, <span class="keyword">const</span> <span class="keywordtype">void</span>* data, <span class="keywordtype">size_t</span> <a class="code" href="namespaceos_1_1stat.html#aac17a91dd3f91341b8c4021025e89b04">size</a>);</div>
<div class="line"><a name="l00099"></a><span class="lineno"> 99</span>&#160;</div>
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span>&#160;</div>
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span>&#160;<a class="code" href="classprocess_1_1Future.html">Future&lt;Nothing&gt;</a> <a class="code" href="namespaceprocess_1_1io.html#a49105dc036ad04225c92bd673da5ce39">write</a>(<a class="code" href="int__fd_8hpp.html#aea4dbda01c90455f158ffa9b924c2f07">int_fd</a> fd, <span class="keyword">const</span> std::string&amp; data);</div>
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span>&#160;</div>
<div class="line"><a name="l00125"></a><span class="lineno"> 125</span>&#160;<a class="code" href="classprocess_1_1Future.html">Future&lt;Nothing&gt;</a> <a class="code" href="namespaceprocess_1_1io.html#ab9c4a52a88fcc9983438e391643424ca">redirect</a>(</div>
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span>&#160; <a class="code" href="int__fd_8hpp.html#aea4dbda01c90455f158ffa9b924c2f07">int_fd</a> from,</div>
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>&#160; <a class="code" href="classOption.html">Option&lt;int_fd&gt;</a> to,</div>
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span>&#160; <span class="keywordtype">size_t</span> chunk = 4096,</div>
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span>&#160; <span class="keyword">const</span> std::vector&lt;lambda::function&lt;<span class="keywordtype">void</span>(<span class="keyword">const</span> std::string&amp;)&gt;&gt;&amp; hooks = {});</div>
<div class="line"><a name="l00130"></a><span class="lineno"> 130</span>&#160;</div>
<div class="line"><a name="l00131"></a><span class="lineno"> 131</span>&#160;} <span class="comment">// namespace io {</span></div>
<div class="line"><a name="l00132"></a><span class="lineno"> 132</span>&#160;} <span class="comment">// namespace process {</span></div>
<div class="line"><a name="l00133"></a><span class="lineno"> 133</span>&#160;</div>
<div class="line"><a name="l00134"></a><span class="lineno"> 134</span>&#160;<span class="preprocessor">#endif // __PROCESS_IO_HPP__</span></div>
<div class="ttc" id="namespaceprocess_1_1io_html_aca1f059ca9f0d7360631c621debeb879"><div class="ttname"><a href="namespaceprocess_1_1io.html#aca1f059ca9f0d7360631c621debeb879">process::io::READ</a></div><div class="ttdeci">const short READ</div><div class="ttdoc">A possible event while polling. </div><div class="ttdef"><b>Definition:</b> io.hpp:34</div></div>
<div class="ttc" id="classOption_html"><div class="ttname"><a href="classOption.html">Option&lt; int_fd &gt;</a></div></div>
<div class="ttc" id="namespaceprocess_1_1io_html_a34d62916736c1dfebd1585cf51f19d0c"><div class="ttname"><a href="namespaceprocess_1_1io.html#a34d62916736c1dfebd1585cf51f19d0c">process::io::BUFFERED_READ_SIZE</a></div><div class="ttdeci">const size_t BUFFERED_READ_SIZE</div><div class="ttdoc">Buffered read chunk size. </div><div class="ttdef"><b>Definition:</b> io.hpp:46</div></div>
<div class="ttc" id="namespaceprocess_1_1io_html_af71c45e0a85e21f6b39060f4e716cebf"><div class="ttname"><a href="namespaceprocess_1_1io.html#af71c45e0a85e21f6b39060f4e716cebf">process::io::poll</a></div><div class="ttdeci">Future&lt; short &gt; poll(int_fd fd, short events)</div><div class="ttdoc">Returns the events (a subset of the events specified) that can be performed on the specified file des...</div></div>
<div class="ttc" id="namespaceprocess_1_1io_html_ab9c4a52a88fcc9983438e391643424ca"><div class="ttname"><a href="namespaceprocess_1_1io.html#ab9c4a52a88fcc9983438e391643424ca">process::io::redirect</a></div><div class="ttdeci">Future&lt; Nothing &gt; redirect(int_fd from, Option&lt; int_fd &gt; to, size_t chunk=4096, const std::vector&lt; lambda::function&lt; void(const std::string &amp;)&gt;&gt; &amp;hooks={})</div><div class="ttdoc">Redirect output from the &amp;#39;from&amp;#39; file descriptor to the &amp;#39;to&amp;#39; file descriptor (or /dev/null if &amp;#39;to&amp;#39; is ...</div></div>
<div class="ttc" id="3rdparty_2stout_2include_2stout_2windows_8hpp_html"><div class="ttname"><a href="3rdparty_2stout_2include_2stout_2windows_8hpp.html">windows.hpp</a></div></div>
<div class="ttc" id="namespaceprocess_1_1io_html_a49105dc036ad04225c92bd673da5ce39"><div class="ttname"><a href="namespaceprocess_1_1io.html#a49105dc036ad04225c92bd673da5ce39">process::io::write</a></div><div class="ttdeci">Future&lt; size_t &gt; write(int_fd fd, const void *data, size_t size)</div><div class="ttdoc">Performs a single non-blocking write by polling on the specified file descriptor until data can be be...</div></div>
<div class="ttc" id="nothing_8hpp_html"><div class="ttname"><a href="nothing_8hpp.html">nothing.hpp</a></div></div>
<div class="ttc" id="namespaceprocess_1_1io_html_ab005316d71b45c5b05de0a6234c6f8fc"><div class="ttname"><a href="namespaceprocess_1_1io.html#ab005316d71b45c5b05de0a6234c6f8fc">process::io::WRITE</a></div><div class="ttdeci">const short WRITE</div><div class="ttdoc">A possible event while polling. </div><div class="ttdef"><b>Definition:</b> io.hpp:39</div></div>
<div class="ttc" id="namespaceos_1_1stat_html_aac17a91dd3f91341b8c4021025e89b04"><div class="ttname"><a href="namespaceos_1_1stat.html#aac17a91dd3f91341b8c4021025e89b04">os::stat::size</a></div><div class="ttdeci">Try&lt; Bytes &gt; size(const std::string &amp;path, const FollowSymlink follow=FOLLOW_SYMLINK)</div><div class="ttdef"><b>Definition:</b> stat.hpp:88</div></div>
<div class="ttc" id="future_8hpp_html"><div class="ttname"><a href="future_8hpp.html">future.hpp</a></div></div>
<div class="ttc" id="namespaceos_html_ae19e4161a51b86a1f330f3bf1dc75389"><div class="ttname"><a href="namespaceos.html#ae19e4161a51b86a1f330f3bf1dc75389">os::process</a></div><div class="ttdeci">Result&lt; Process &gt; process(pid_t pid)</div><div class="ttdef"><b>Definition:</b> freebsd.hpp:30</div></div>
<div class="ttc" id="namespaceprocess_1_1io_html_a4c34d22e475e29f12ac739921dcc580f"><div class="ttname"><a href="namespaceprocess_1_1io.html#a4c34d22e475e29f12ac739921dcc580f">process::io::read</a></div><div class="ttdeci">Future&lt; size_t &gt; read(int_fd fd, void *data, size_t size)</div><div class="ttdoc">Performs a single non-blocking read by polling on the specified file descriptor until any data can be...</div></div>
<div class="ttc" id="int__fd_8hpp_html_aea4dbda01c90455f158ffa9b924c2f07"><div class="ttname"><a href="int__fd_8hpp.html#aea4dbda01c90455f158ffa9b924c2f07">int_fd</a></div><div class="ttdeci">int int_fd</div><div class="ttdef"><b>Definition:</b> int_fd.hpp:35</div></div>
<div class="ttc" id="classprocess_1_1Future_html"><div class="ttname"><a href="classprocess_1_1Future.html">process::Future</a></div><div class="ttdef"><b>Definition:</b> future.hpp:56</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.5
</small></address>
</body>
</html>