4 <strong>Function
</strong> - Set a VM region's inheritance attribute.
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>
17 <dt> <var>target_task
</var>
20 The port for the task whose address space contains
23 <dt> <var>address
</var>
26 The starting address for the region.
31 The number of bytes in the region.
33 <dt> <var>new_inheritance
</var>
36 The new inheritance attribute for the region. Valid values are:
39 <dt> <strong>VM_INHERIT_SHARE
</strong>
41 Allows child tasks to share the region.
43 <dt> <strong>VM_INHERIT_COPY
</strong>
45 Gives child tasks a copy of the region.
47 <dt> <strong>VM_INHERIT_NONE
</strong>
49 Provides no access to the region for child tasks.
54 The
<strong>vm_inherit
</strong> function sets the inheritance attribute
55 for a region within the
56 specified task's address space. The inheritance attribute determines
58 access established for child tasks at task creation.
60 Because inheritance applies to virtual pages, the specified
<var>address
</var>
61 and
<var>size
</var> are
62 rounded to page boundaries, as follows: the region starts at
64 virtual page containing
<var>address
</var>; it ends at the end of the virtual
66 <var>address
</var> +
<var>size
</var> -
1.
67 Because of this rounding to virtual page boundaries, the
68 amount of memory affected may be greater than
<var>size
</var>. Use
69 <strong>host_page_size
</strong> to find the current virtual page size.
71 A parent and a child task can share the same physical memory only if the
72 inheritance for the memory is set to
<strong>VM_INHERIT_SHARE
</strong> before
74 created. 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.
77 Note that all the threads within a task share the task's memory.
80 This interface is machine word length specific because of the virtual address
82 <h3>RETURN VALUES
</h3>
85 <dt> <strong>KERN_INVALID_ADDRESS
</strong>
87 The address is illegal or specifies a non-allocated region.
89 <h3>RELATED INFORMATION
</h3>
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>,