Server Interface - Initializes a memory object.


kern_return_t   memory_object_init
		(memory_object_t                memory_object,
		 memory_object_control_t       memory_control,
		 vm_size_t            memory_object_page_size);

kern_return_t   seqnos_memory_object_init
		(memory_object_t                memory_object,
		 mach_port_seqno_t                      seqno,
		 memory_object_control_t       memory_control,
		 vm_size_t            memory_object_page_size);


[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.

[in scalar] The sequence number of this message relative to the abstract memory object port.

[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.

[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 memory_object_init 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 memory_object_init 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 memory_object_init 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 KERN_SUCCESS or MIG_NO_REPLYwill cause mach_msg_server to remove the memory cache control reference.


Functions: memory_object_terminate.