summaryrefslogtreecommitdiff
path: root/static/freebsd/man9/shm_map.9 4.html
diff options
context:
space:
mode:
Diffstat (limited to 'static/freebsd/man9/shm_map.9 4.html')
-rw-r--r--static/freebsd/man9/shm_map.9 4.html163
1 files changed, 0 insertions, 163 deletions
diff --git a/static/freebsd/man9/shm_map.9 4.html b/static/freebsd/man9/shm_map.9 4.html
deleted file mode 100644
index 0fd117c8..00000000
--- a/static/freebsd/man9/shm_map.9 4.html
+++ /dev/null
@@ -1,163 +0,0 @@
-<table class="head">
- <tr>
- <td class="head-ltitle">SHM_MAP(9)</td>
- <td class="head-vol">Kernel Developer's Manual</td>
- <td class="head-rtitle">SHM_MAP(9)</td>
- </tr>
-</table>
-<div class="manual-text">
-<section class="Sh">
-<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1>
-<p class="Pp"><code class="Nm">shm_map</code>, <code class="Nm">shm_unmap</code>
- &#x2014; <span class="Nd">map shared memory objects into the kernel's
- address space</span></p>
-</section>
-<section class="Sh">
-<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1>
-<p class="Pp"><code class="In">#include
- &lt;<a class="In">sys/types.h</a>&gt;</code>
- <br/>
- <code class="In">#include &lt;<a class="In">sys/mman.h</a>&gt;</code></p>
-<p class="Pp"><var class="Ft">int</var>
- <br/>
- <code class="Fn">shm_map</code>(<var class="Fa" style="white-space: nowrap;">struct
- file *fp</var>, <var class="Fa" style="white-space: nowrap;">size_t
- size</var>, <var class="Fa" style="white-space: nowrap;">off_t offset</var>,
- <var class="Fa" style="white-space: nowrap;">void **memp</var>);</p>
-<p class="Pp"><var class="Ft">int</var>
- <br/>
- <code class="Fn">shm_unmap</code>(<var class="Fa" style="white-space: nowrap;">struct
- file *fp</var>, <var class="Fa" style="white-space: nowrap;">void
- *mem</var>, <var class="Fa" style="white-space: nowrap;">size_t
- size</var>);</p>
-</section>
-<section class="Sh">
-<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1>
-<p class="Pp">The
- <a class="permalink" href="#shm_map"><code class="Fn" id="shm_map">shm_map</code></a>()
- and <code class="Fn">shm_unmap</code>() functions provide an API for mapping
- shared memory objects into the kernel. Shared memory objects are created by
- <a class="Xr">shm_open(2)</a>. These objects can then be passed into the
- kernel via file descriptors.</p>
-<p class="Pp">A shared memory object cannot be shrunk while it is mapped into
- the kernel. This is to avoid invalidating any pages that may be wired into
- the kernel's address space. Shared memory objects can still be grown while
- mapped into the kernel.</p>
-<p class="Pp" id="shm_map~2">To simplify the accounting needed to enforce the
- above requirement, callers of this API are required to unmap the entire
- region mapped by
- <a class="permalink" href="#shm_map~2"><code class="Fn">shm_map</code></a>()
- when calling <code class="Fn">shm_unmap</code>(). Unmapping only a portion
- of the region is not permitted.</p>
-<p class="Pp" id="shm_map~3">The
- <a class="permalink" href="#shm_map~3"><code class="Fn">shm_map</code></a>()
- function locates the shared memory object associated with the open file
- <var class="Fa">fp</var>. It maps the region of that object described by
- <var class="Fa">offset</var> and <var class="Fa">size</var> into the
- kernel's address space. If it succeeds, <var class="Fa">*memp</var> will be
- set to the start of the mapping. All pages for the range will be wired into
- memory upon successful return.</p>
-<p class="Pp" id="shm_unmap">The
- <a class="permalink" href="#shm_unmap"><code class="Fn">shm_unmap</code></a>()
- function unmaps a region previously mapped by
- <code class="Fn">shm_map</code>(). The <var class="Fa">mem</var> argument
- should match the value previously returned in <var class="Fa">*memp</var>,
- and the <var class="Fa">size</var> argument should match the value passed to
- <code class="Fn">shm_map</code>().</p>
-<p class="Pp" id="shm_map~4">Note that
- <a class="permalink" href="#shm_map~4"><code class="Fn">shm_map</code></a>()
- will not hold an extra reference on the open file <var class="Fa">fp</var>
- for the lifetime of the mapping. Instead, the calling code is required to do
- this if it wishes to use <code class="Fn">shm_unmap</code>() on the region
- in the future.</p>
-</section>
-<section class="Sh">
-<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN
- VALUES</a></h1>
-<p class="Pp">The <code class="Fn">shm_map</code>() and
- <code class="Fn">shm_unmap</code>() functions return zero on success or an
- error on failure.</p>
-</section>
-<section class="Sh">
-<h1 class="Sh" id="EXAMPLES"><a class="permalink" href="#EXAMPLES">EXAMPLES</a></h1>
-<p class="Pp">The following function accepts a file descriptor for a shared
- memory object. It maps the first sixteen kilobytes of the object into the
- kernel, performs some work on that address, and then unmaps the address
- before returning.</p>
-<div class="Bd Pp Bd-indent Li">
-<pre>int
-shm_example(int fd)
-{
- struct file *fp;
- void *mem;
- int error;
-
- error = fget(curthread, fd, CAP_MMAP, &amp;fp);
- if (error)
- return (error);
- error = shm_map(fp, 16384, 0, &amp;mem);
- if (error) {
- fdrop(fp, curthread);
- return (error);
- }
-
- /* Do something with 'mem'. */
-
- error = shm_unmap(fp, mem, 16384);
- fdrop(fp, curthread);
- return (error);
-}</pre>
-</div>
-</section>
-<section class="Sh">
-<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1>
-<p class="Pp">The <code class="Fn">shm_map</code>() function returns the
- following errors on failure:</p>
-<dl class="Bl-tag">
- <dt id="EINVAL">[<a class="permalink" href="#EINVAL"><code class="Er">EINVAL</code></a>]</dt>
- <dd>The open file <var class="Fa">fp</var> is not a shared memory object.</dd>
- <dt id="EINVAL~2">[<a class="permalink" href="#EINVAL~2"><code class="Er">EINVAL</code></a>]</dt>
- <dd>The requested region described by <var class="Fa">offset</var> and
- <var class="Fa">size</var> extends beyond the end of the shared memory
- object.</dd>
- <dt id="ENOMEM">[<a class="permalink" href="#ENOMEM"><code class="Er">ENOMEM</code></a>]</dt>
- <dd>Insufficient address space was available.</dd>
- <dt id="EACCES">[<a class="permalink" href="#EACCES"><code class="Er">EACCES</code></a>]</dt>
- <dd>The shared memory object could not be mapped due to a protection
- error.</dd>
- <dt id="EINVAL~3">[<a class="permalink" href="#EINVAL~3"><code class="Er">EINVAL</code></a>]</dt>
- <dd>The shared memory object could not be mapped due to some other VM
- error.</dd>
-</dl>
-<p class="Pp">The <code class="Fn">shm_unmap</code>() function returns the
- following errors on failure:</p>
-<dl class="Bl-tag">
- <dt id="EINVAL~4">[<a class="permalink" href="#EINVAL~4"><code class="Er">EINVAL</code></a>]</dt>
- <dd>The open file <var class="Fa">fp</var> is not a shared memory object.</dd>
- <dt id="EINVAL~5">[<a class="permalink" href="#EINVAL~5"><code class="Er">EINVAL</code></a>]</dt>
- <dd>The address range described by <var class="Fa">mem</var> and
- <var class="Fa">size</var> is not a valid address range.</dd>
- <dt id="EINVAL~6">[<a class="permalink" href="#EINVAL~6"><code class="Er">EINVAL</code></a>]</dt>
- <dd>The address range described by <var class="Fa">mem</var> and
- <var class="Fa">size</var> is not backed by the shared memory object
- associated with the open file <var class="Fa">fp</var>, or the address
- range does not cover the entire mapping of the object.</dd>
-</dl>
-</section>
-<section class="Sh">
-<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE
- ALSO</a></h1>
-<p class="Pp"><a class="Xr">shm_open(2)</a></p>
-</section>
-<section class="Sh">
-<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1>
-<p class="Pp">This API was first introduced in <span class="Ux">FreeBSD
- 10.0</span>.</p>
-</section>
-</div>
-<table class="foot">
- <tr>
- <td class="foot-date">December 14, 2011</td>
- <td class="foot-os">FreeBSD 15.0</td>
- </tr>
-</table>