memory_object_init.html   [plain text]

<strong>Server Interface</strong> - Initializes a memory object.
<strong>kern_return_t   memory_object_init</strong>
		<strong>(memory_object_t</strong>                <var>memory_object</var>,
		 <strong>memory_object_control_t       </strong><var>memory_control</var>,
		 <strong>vm_size_t</strong>            <var>memory_object_page_size</var><strong>);</strong>

<strong>kern_return_t   seqnos_memory_object_init</strong>
		<strong>(memory_object_t</strong>                <var>memory_object</var>,
		 <strong>mach_port_seqno_t</strong>                      <var>seqno</var>,
		 <strong>memory_object_control_t</strong>       <var>memory_control</var>,
		 <strong>vm_size_t</strong>            <var>memory_object_page_size</var><strong>);</strong>
<dt> <var>memory_object</var>
[in abstract-memory-object port] The abstract memory object port that represents the memory object data, as supplied to the kernel in a vm_map call.
<dt> <var>seqno</var>
[in scalar] The sequence number of this message relative to the abstract memory object port.
<dt> <var>memory_control</var>
[in memory-cache-control port] The memory cache control port to be used by the memory manager. If the memory object has been supplied to more than one kernel, this parameter identifies the kernel that is making the call.
<dt> <var>memory_object_page_size</var>
[in scalar] The page size used by the kernel. All calls involving this kernel must use data sizes that are integral multiples of this page size.
A <strong>memory_object_init</strong> function is called as the result
of a kernel message notifying a memory manager that the kernel has
been asked to map the specified memory object into a task's virtual
address space.  When asked to map a memory object for the first time,
the kernel responds by making a <strong>memory_object_init</strong>
call on the abstract memory object. This call is provided as a
convenience to the memory manager, to allow it to initialize data
structures and prepare to receive other requests.
In addition to the
abstract memory object port itself, the call provides
a memory cache control port that the memory manager can use to
control use of its data by the kernel. The memory manager gets send
rights for this port.
The kernel holds send rights for the abstract memory object port, and
both send and receive rights for the memory cache control port.
The call also supplies the virtual page size to be used for
the memory mapping. The memory manager can use this size to detect
mappings that use different data structures at initialization time, or
to allocate buffers for use in reading data.
If a memory object is
mapped into the address space of more than one task on different hosts
(with independent kernels), the memory manager will receive a
<strong>memory_object_init</strong> call from each kernel, containing
a unique set of control and name ports. Note that each kernel may also
use a different page size.

Any return value other than <strong>KERN_SUCCESS</strong>
or <strong>MIG_NO_REPLY</strong>will cause
<strong>mach_msg_server</strong> to remove the memory cache control reference.
<a href="memory_object_terminate.html"><strong>memory_object_terminate</strong></a>.