/usr/share/doc/process-cpp/html/index.html is in libprocess-cpp-doc 3.0.1-0ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | <!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.9.1"/>
<title>process-cpp: Main Page</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="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</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">process-cpp
 <span id="projectnumber">3.0.0</span>
</div>
<div id="projectbrief">A simple convenience library for handling processes in C++11.</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.9.1 -->
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('index.html','');});
</script>
<div id="doc-content">
<div class="header">
<div class="headertitle">
<div class="title">process-cpp Documentation</div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p>process-cpp is a simple and straightforward wrapper around process creation and control targeted towards linux. It helps both with handling child processes and with interacting with the current process. Some of its features include:</p>
<ul>
<li>Thread-safe get/set/unset operation on the current process's environment.</li>
<li>Throwing and non-throwing overloads of functions when system calls are involved.</li>
<li>Seamless redirection of input, output and error streams of child processes.</li>
<li>Type-safe interaction with the virtual proc filesystem, both for reading & writing.</li>
</ul>
<p>The library's main purpose is to assist in testing and when a software component needs to carry out process creation/control tasks, e.g., a graphical shell. To this end, the library is extensively tested and tries to ensure fail-safe operation as much as possible.</p>
<h2>A simple echo </h2>
<div class="fragment"><div class="line"><span class="comment">// Fork and run a simple echo:</span></div>
<div class="line">posix::ChildProcess child = <a class="code" href="namespacecore_1_1posix.html#a58bc55b73f041ceb027ccffb5db2a91a">posix::fork</a>(</div>
<div class="line"> []()</div>
<div class="line"> {</div>
<div class="line"> std::string line;</div>
<div class="line"> <span class="keywordflow">while</span>(<span class="keyword">true</span>)</div>
<div class="line"> {</div>
<div class="line"> <a class="code" href="namespacecore_1_1posix_1_1this__process.html#aed98fde0381b8c17f2dfe3c517afc6c0">std::cin</a> >> line;</div>
<div class="line"> <a class="code" href="namespacecore_1_1posix_1_1this__process.html#a0680ea514b328e552f0575ad1ca5b7c3">std::cout</a> << line << std::endl;</div>
<div class="line"> }</div>
<div class="line"> <span class="keywordflow">return</span> EXIT_FAILURE;</div>
<div class="line"> },</div>
<div class="line"> posix::StandardStreamFlags()</div>
<div class="line"> .set(posix::StandardStream::stdin)</div>
<div class="line"> .set(posix::StandardStream::stdout));</div>
<div class="line"></div>
<div class="line"><span class="comment">// Check that the resulting process has a valid pid.</span></div>
<div class="line">EXPECT_TRUE(child.pid() > 0);</div>
<div class="line"></div>
<div class="line"><span class="comment">// Check on echo functionality.</span></div>
<div class="line"><span class="keyword">const</span> std::string echo_value{<span class="stringliteral">"42"</span>};</div>
<div class="line">child.<a class="code" href="classcore_1_1posix_1_1ChildProcess.html#a7cc82423210f5c00bfa95fc7d2de92c9">cin</a>() << echo_value << std::endl;</div>
<div class="line">std::string line; child.cout() >> line;</div>
<div class="line">EXPECT_EQ(echo_value, line);</div>
<div class="line"></div>
<div class="line"><span class="comment">// Stop the process and synchronize with the process changing state.</span></div>
<div class="line">EXPECT_NO_THROW(child.send_signal(posix::Signal::sig_stop));</div>
<div class="line"><span class="keyword">auto</span> result = child.wait_for(posix::wait::Flag::untraced);</div>
<div class="line">EXPECT_EQ(posix::wait::Result::Status::stopped,</div>
<div class="line"> result.status);</div>
<div class="line">EXPECT_EQ(posix::Signal::sig_stop,</div>
<div class="line"> result.detail.if_stopped.signal);</div>
<div class="line"></div>
<div class="line"><span class="comment">// Kill the stopped process and synchronize to its state change.</span></div>
<div class="line">EXPECT_NO_THROW(child.send_signal(posix::Signal::sig_kill));</div>
<div class="line">result = child.wait_for(posix::wait::Flag::untraced);</div>
<div class="line">EXPECT_EQ(posix::wait::Result::Status::signaled,</div>
<div class="line"> result.status);</div>
<div class="line">EXPECT_EQ(posix::Signal::sig_kill,</div>
<div class="line"> result.detail.if_signaled.signal);</div>
</div><!-- fragment --><h2>Adjusting OOM Score Values </h2>
<div class="fragment"><div class="line"><span class="comment">// Setup the manipulator with a well-known value.</span></div>
<div class="line">posix::linux::proc::process::OomScoreAdj oom_score_adj</div>
<div class="line">{</div>
<div class="line"> posix::linux::proc::process::OomScoreAdj::max_value()</div>
<div class="line">};</div>
<div class="line"><span class="comment">// Apply the manipulator to the current process</span></div>
<div class="line">EXPECT_NO_THROW(<a class="code" href="namespacecore_1_1posix_1_1this__process.html#ad16dacb78f22187927bc6eac0ed47546">posix::this_process::instance</a>() << oom_score_adj);</div>
<div class="line"><span class="comment">// Read back the manipulators value for the current process</span></div>
<div class="line">EXPECT_NO_THROW(<a class="code" href="namespacecore_1_1posix_1_1this__process.html#ad16dacb78f22187927bc6eac0ed47546">posix::this_process::instance</a>() >> oom_score_adj);</div>
<div class="line"><span class="comment">// And check that applying the manipulator was successful.</span></div>
<div class="line">EXPECT_EQ(posix::linux::proc::process::OomScoreAdj::max_value(),</div>
<div class="line"> oom_score_adj.value);</div>
<div class="line"><span class="comment">// Instantiate the observer...</span></div>
<div class="line">posix::linux::proc::process::OomScore oom_score;</div>
<div class="line"><span class="comment">// ... and fill in its value for the current process.</span></div>
<div class="line">EXPECT_NO_THROW(<a class="code" href="namespacecore_1_1posix_1_1this__process.html#ad16dacb78f22187927bc6eac0ed47546">posix::this_process::instance</a>() >> oom_score);</div>
<div class="line"><span class="comment">// Check that applying the manipulator before results in adjustments to the</span></div>
<div class="line"><span class="comment">// OOM score.</span></div>
<div class="line">EXPECT_TRUE(is_approximately_equal(oom_score.value, posix::linux::proc::process::OomScoreAdj::max_value()));</div>
</div><!-- fragment --> </div></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">Generated on Mon Nov 30 2015 23:13:37 for process-cpp by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.9.1 </li>
</ul>
</div>
</body>
</html>
|