1 <h2>vm_msync
</h2>
<hr>
<p>
<strong>Function
</strong> - Synchronize the specified region of virtual memory.
<h3>SYNOPSIS
</h3>
<pre>
<strong>kern_return_t vm_msync
</strong>
<strong>(vm_task_t
</strong> <var>target_task
</var>,
<strong>vm_address_t
</strong> <var>address
</var>,
<strong>vm_size_t
</strong> <var>size
</var>,
<strong>target_task
</strong> <var>sync_flags
</var><strong>);
</strong>
</pre>
<h3>PARAMETERS
</h3>
<dl>
<p>
<dt> <var>target_task
</var>
<dd>
[in task send right]
The port for the task whose address space contains
the region.
<p>
<dt> <var>address
</var>
<dd>
[in scalar]
The starting address for the region.
<p>
<dt> <var>size
</var>
<dd>
[in scalar]
The number of bytes in the region.
<p>
<dt> <var>sync_flags
</var>
<dd>
[in scalar]
The bit-wise
<strong>OR
</strong> of flags affecting the synchronization.
Specifying both
<strong>VM_SYNC_SYNCHRONOUS
</strong> and
<strong>VM_SYNC_ASYNCHRONOUS
</strong> is invalid.
<dl>
<p>
<dt> <strong>VM_SYNC_INVALIDATE
</strong>
<dd>
Flushes pages in the range. Only precious pages are returned to
the memory manager unless either
<strong>VM_SYNC_SYNCHRONOUS
</strong> or
<strong>VM_SYNC_ASYNCHRONOUS
</strong> is also set.
<p>
<dt> <strong>VM_SYNC_SYNCHRONOUS
</strong>
<dd>
Writes dirty and precious pages back to the memory manager,
waits for pages to reach backing storage.
<p>
<dt> <strong>VM_SYNC_ASYNCHRONOUS
</strong>
<dd>
Writes dirty and precious pages back to the memory manager,
returns without waiting for pages to reach backing storage.
</dl>
</dl>
<h3>DESCRIPTION
</h3>
<p>
The
<strong>vm_msync
</strong> function synchronizes the contents of
a memory range with its
backing store image by flushing or cleaning the contents of the
specified range
to the range's memory manager, engaging in a synchronization protocol with
the manager (
<strong>memory_object_synchronize
</strong>).
The client does not return from
this call until the memory manager responds (to the kernel) with
<strong>memory_object_synchronize_completed
</strong>.
<h3>NOTES
</h3>
<p>
This interface is machine word length specific because of the virtual address
parameter.
<h3>RETURN VALUES
</h3>
<dl>
<p>
<dt> <strong>KERN_INVALID_ADDRESS
</strong>
<dd>
The address is illegal or specifies a non-allocated region.
</dl>
<h3>RELATED INFORMATION
</h3>
<p>
Functions:
<a href=
"memory_object_synchronize.html"><strong>memory_object_synchronize
</strong></a>,
<a href=
"MO_SY_completed.html"><strong>memory_object_synchronize_completed
</strong></a>.