]> git.saurik.com Git - apple/xnu.git/blame - osfmk/man/vm_inherit.html
xnu-792.6.76.tar.gz
[apple/xnu.git] / osfmk / man / vm_inherit.html
CommitLineData
13fec989
A
1<h2>vm_inherit</h2>
2<hr>
3<p>
4<strong>Function</strong> - Set a VM region's inheritance attribute.
5<p>
6<h3>SYNOPSIS</h3>
7<pre>
8<strong>kern_return_t vm_inherit</strong>
9 <strong>(vm_task_t</strong> <var>target_task</var>,
10 <strong>vm_address_t</strong> <var>address</var>,
11 <strong>vm_size_t</strong> <var>size</var>,
12 <strong>vm_inherit_t</strong> <var>new_inheritance</var><strong>);</strong>
13</pre>
14<h3>PARAMETERS</h3>
15<dl>
16<p>
17<dt> <var>target_task</var>
18<dd>
19[in task send right]
20The port for the task whose address space contains
21the region.
22<p>
23<dt> <var>address</var>
24<dd>
25[in scalar]
26The starting address for the region.
27<p>
28<dt> <var>size</var>
29<dd>
30[in scalar]
31The number of bytes in the region.
32<p>
33<dt> <var>new_inheritance</var>
34<dd>
35[in scalar]
36The new inheritance attribute for the region. Valid values are:
37<dl>
38<p>
39<dt> <strong>VM_INHERIT_SHARE</strong>
40<dd>
41Allows child tasks to share the region.
42<p>
43<dt> <strong>VM_INHERIT_COPY</strong>
44<dd>
45Gives child tasks a copy of the region.
46<p>
47<dt> <strong>VM_INHERIT_NONE</strong>
48<dd>
49Provides no access to the region for child tasks.
50</dl>
51</dl>
52<h3>DESCRIPTION</h3>
53<p>
54The <strong>vm_inherit</strong> function sets the inheritance attribute
55for a region within the
56specified task's address space. The inheritance attribute determines
57the type of
58access established for child tasks at task creation.
59<p>
60Because inheritance applies to virtual pages, the specified <var>address</var>
61and <var>size</var> are
62rounded to page boundaries, as follows: the region starts at
63the beginning of the
64virtual page containing <var>address</var>; it ends at the end of the virtual
65page containing
66<var>address</var> + <var>size</var> - 1.
67Because of this rounding to virtual page boundaries, the
68amount of memory affected may be greater than <var>size</var>. Use
69<strong>host_page_size</strong> to find the current virtual page size.
70<p>
71A parent and a child task can share the same physical memory only if the
72inheritance for the memory is set to <strong>VM_INHERIT_SHARE</strong> before
73the child task is
74created. Other than through the use of an external memory manager (see
75<strong>vm_map</strong>), this is the only way that two tasks can share memory.
76<p>
77Note that all the threads within a task share the task's memory.
78<h3>NOTES</h3>
79<p>
80This interface is machine word length specific because of the virtual address
81parameter.
82<h3>RETURN VALUES</h3>
83<dl>
84<p>
85<dt> <strong>KERN_INVALID_ADDRESS</strong>
86<dd>
87The address is illegal or specifies a non-allocated region.
88</dl>
89<h3>RELATED INFORMATION</h3>
90<p>
91Functions:
92<a href="task_create.html"><strong>task_create</strong></a>,
93<a href="vm_map.html"><strong>vm_map</strong></a>,
94<a href="vm_region.html"><strong>vm_region</strong></a>,
95<a href="norma_task_clone.html"><strong>norma_task_create</strong></a>.