blob: dc31710ef684f214d1ae34944e471cbdf5dc8ce6 [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.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Crashpad: crashpad::ScopedMmap Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="crashpad_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 id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Crashpad
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="namespacecrashpad.html">crashpad</a></li><li class="navelem"><a class="el" href="classcrashpad_1_1ScopedMmap.html">ScopedMmap</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classcrashpad_1_1ScopedMmap-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">crashpad::ScopedMmap Class Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>Maintains a memory-mapped region created by <code>mmap()</code>.
<a href="classcrashpad_1_1ScopedMmap.html#details">More...</a></p>
<p><code>#include &quot;util/posix/scoped_mmap.h&quot;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a87b285c49a6683ae3c610a6ec8499f18"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1ScopedMmap.html#a87b285c49a6683ae3c610a6ec8499f18">Reset</a> ()</td></tr>
<tr class="memdesc:a87b285c49a6683ae3c610a6ec8499f18"><td class="mdescLeft">&#160;</td><td class="mdescRight">Releases the memory-mapped region by calling <code>munmap()</code>. <a href="#a87b285c49a6683ae3c610a6ec8499f18">More...</a><br /></td></tr>
<tr class="separator:a87b285c49a6683ae3c610a6ec8499f18"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9b44f238c848c89e5d7e44397aa8f623"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1ScopedMmap.html#a9b44f238c848c89e5d7e44397aa8f623">ResetAddrLen</a> (void *<a class="el" href="classcrashpad_1_1ScopedMmap.html#a1cfd4d998cc115656c7af6ec54692f9f">addr</a>, size_t <a class="el" href="classcrashpad_1_1ScopedMmap.html#a430d138d22b27b5553baf7d47b05519d">len</a>)</td></tr>
<tr class="memdesc:a9b44f238c848c89e5d7e44397aa8f623"><td class="mdescLeft">&#160;</td><td class="mdescRight">Releases any existing memory-mapped region and sets the object to maintain an already-established mapping. <a href="#a9b44f238c848c89e5d7e44397aa8f623">More...</a><br /></td></tr>
<tr class="separator:a9b44f238c848c89e5d7e44397aa8f623"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7ffebf17ea68beb81637056c1371d2f9"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1ScopedMmap.html#a7ffebf17ea68beb81637056c1371d2f9">ResetMmap</a> (void *<a class="el" href="classcrashpad_1_1ScopedMmap.html#a1cfd4d998cc115656c7af6ec54692f9f">addr</a>, size_t <a class="el" href="classcrashpad_1_1ScopedMmap.html#a430d138d22b27b5553baf7d47b05519d">len</a>, int prot, int flags, int fd, off_t offset)</td></tr>
<tr class="memdesc:a7ffebf17ea68beb81637056c1371d2f9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Releases any existing memory-mapped region and establishes a new one by calling <code>mmap()</code>. <a href="#a7ffebf17ea68beb81637056c1371d2f9">More...</a><br /></td></tr>
<tr class="separator:a7ffebf17ea68beb81637056c1371d2f9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6ba22671a482ee2627e8e45f11c98b19"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1ScopedMmap.html#a6ba22671a482ee2627e8e45f11c98b19">Mprotect</a> (int prot)</td></tr>
<tr class="memdesc:a6ba22671a482ee2627e8e45f11c98b19"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the protection of the memory-mapped region by calling <code>mprotect()</code>. <a href="#a6ba22671a482ee2627e8e45f11c98b19">More...</a><br /></td></tr>
<tr class="separator:a6ba22671a482ee2627e8e45f11c98b19"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa855d9b16bd8f5be6ecf46507ef702ce"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1ScopedMmap.html#aa855d9b16bd8f5be6ecf46507ef702ce">is_valid</a> () const</td></tr>
<tr class="separator:aa855d9b16bd8f5be6ecf46507ef702ce"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1cfd4d998cc115656c7af6ec54692f9f"><td class="memItemLeft" align="right" valign="top"><a id="a1cfd4d998cc115656c7af6ec54692f9f"></a>
void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1ScopedMmap.html#a1cfd4d998cc115656c7af6ec54692f9f">addr</a> () const</td></tr>
<tr class="memdesc:a1cfd4d998cc115656c7af6ec54692f9f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the base address of the memory-mapped region. <br /></td></tr>
<tr class="separator:a1cfd4d998cc115656c7af6ec54692f9f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a73f38d8efda3d4c056d9fe06d5b0214e"><td class="memTemplParams" colspan="2"><a id="a73f38d8efda3d4c056d9fe06d5b0214e"></a>
template&lt;typename T &gt; </td></tr>
<tr class="memitem:a73f38d8efda3d4c056d9fe06d5b0214e"><td class="memTemplItemLeft" align="right" valign="top">T&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1ScopedMmap.html#a73f38d8efda3d4c056d9fe06d5b0214e">addr_as</a> () const</td></tr>
<tr class="memdesc:a73f38d8efda3d4c056d9fe06d5b0214e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the base address of the memory-mapped region, casted to a type of the caller’s choosing. <br /></td></tr>
<tr class="separator:a73f38d8efda3d4c056d9fe06d5b0214e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a430d138d22b27b5553baf7d47b05519d"><td class="memItemLeft" align="right" valign="top"><a id="a430d138d22b27b5553baf7d47b05519d"></a>
size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1ScopedMmap.html#a430d138d22b27b5553baf7d47b05519d">len</a> () const</td></tr>
<tr class="memdesc:a430d138d22b27b5553baf7d47b05519d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the size of the memory-mapped region. <br /></td></tr>
<tr class="separator:a430d138d22b27b5553baf7d47b05519d"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Maintains a memory-mapped region created by <code>mmap()</code>. </p>
<p>On destruction, any memory-mapped region managed by an object of this class will be released by calling <code>munmap()</code>. </p>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a id="aa855d9b16bd8f5be6ecf46507ef702ce"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa855d9b16bd8f5be6ecf46507ef702ce">&#9670;&nbsp;</a></span>is_valid()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">bool crashpad::ScopedMmap::is_valid </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<dl class="section return"><dt>Returns</dt><dd>Whether this object is managing a valid memory-mapped region. </dd></dl>
</div>
</div>
<a id="a6ba22671a482ee2627e8e45f11c98b19"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6ba22671a482ee2627e8e45f11c98b19">&#9670;&nbsp;</a></span>Mprotect()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool crashpad::ScopedMmap::Mprotect </td>
<td>(</td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>prot</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Sets the protection of the memory-mapped region by calling <code>mprotect()</code>. </p>
<p><em>prot</em> is passed directly to <code>mprotect()</code>.</p>
<dl class="section return"><dt>Returns</dt><dd><code>true</code> on success. <code>false</code> on failure, with a message logged. </dd></dl>
</div>
</div>
<a id="a87b285c49a6683ae3c610a6ec8499f18"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a87b285c49a6683ae3c610a6ec8499f18">&#9670;&nbsp;</a></span>Reset()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool crashpad::ScopedMmap::Reset </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Releases the memory-mapped region by calling <code>munmap()</code>. </p>
<dl class="section return"><dt>Returns</dt><dd><code>true</code> on success. <code>false</code> on failure, with a message logged. </dd></dl>
</div>
</div>
<a id="a9b44f238c848c89e5d7e44397aa8f623"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9b44f238c848c89e5d7e44397aa8f623">&#9670;&nbsp;</a></span>ResetAddrLen()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool crashpad::ScopedMmap::ResetAddrLen </td>
<td>(</td>
<td class="paramtype">void *&#160;</td>
<td class="paramname"><em>addr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t&#160;</td>
<td class="paramname"><em>len</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Releases any existing memory-mapped region and sets the object to maintain an already-established mapping. </p>
<p>If <em>addr</em> and <em>len</em> indicate a region that overlaps with the existing memory-mapped region, only the portion of the existing memory-mapped region that does not overlap the new region, if any, will be released.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">addr</td><td>The base address of the existing memory-mapped region to maintain. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">len</td><td>The size of the existing memory-mapped region to maintain.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><code>true</code> on success. <code>false</code> on failure, with a message logged. </dd></dl>
</div>
</div>
<a id="a7ffebf17ea68beb81637056c1371d2f9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7ffebf17ea68beb81637056c1371d2f9">&#9670;&nbsp;</a></span>ResetMmap()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool crashpad::ScopedMmap::ResetMmap </td>
<td>(</td>
<td class="paramtype">void *&#160;</td>
<td class="paramname"><em>addr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t&#160;</td>
<td class="paramname"><em>len</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>prot</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>flags</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>fd</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">off_t&#160;</td>
<td class="paramname"><em>offset</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Releases any existing memory-mapped region and establishes a new one by calling <code>mmap()</code>. </p>
<p>The parameters to this method are passed directly to <code>mmap()</code>.</p>
<dl class="section return"><dt>Returns</dt><dd><code>true</code> on success. <code>false</code> on failure, with a message logged. A message will also be logged on failure to release any existing memory-mapped region, but this will not preclude <code>mmap()</code> from being called or a new mapping from being established, and if such a call to <code>mmap()</code> is successful, this method will return <code>true</code>. </dd></dl>
</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>util/posix/scoped_mmap.h</li>
<li>util/posix/scoped_mmap.cc</li>
</ul>
</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.14
</small></address>
</body>
</html>