1<h2>vm_msync</h2> 2<hr> 3<p> 4<strong>Function</strong> - Synchronize the specified region of virtual memory. 5<h3>SYNOPSIS</h3> 6<pre> 7<strong>kern_return_t vm_msync</strong> 8 <strong>(vm_task_t</strong> <var>target_task</var>, 9 <strong>vm_address_t</strong> <var>address</var>, 10 <strong>vm_size_t</strong> <var>size</var>, 11 <strong>target_task</strong> <var>sync_flags</var><strong>);</strong> 12</pre> 13<h3>PARAMETERS</h3> 14<dl> 15<p> 16<dt> <var>target_task</var> 17<dd> 18[in task send right] 19The port for the task whose address space contains 20the region. 21<p> 22<dt> <var>address</var> 23<dd> 24[in scalar] 25The starting address for the region. 26<p> 27<dt> <var>size</var> 28<dd> 29[in scalar] 30The number of bytes in the region. 31<p> 32<dt> <var>sync_flags</var> 33<dd> 34[in scalar] 35The bit-wise <strong>OR</strong> of flags affecting the synchronization. 36Specifying both <strong>VM_SYNC_SYNCHRONOUS</strong> and 37<strong>VM_SYNC_ASYNCHRONOUS</strong> is invalid. 38<dl> 39<p> 40<dt> <strong>VM_SYNC_INVALIDATE</strong> 41<dd> 42Flushes pages in the range. Only precious pages are returned to 43the memory manager unless either <strong>VM_SYNC_SYNCHRONOUS</strong> or 44<strong>VM_SYNC_ASYNCHRONOUS</strong> is also set. 45<p> 46<dt> <strong>VM_SYNC_SYNCHRONOUS</strong> 47<dd> 48Writes dirty and precious pages back to the memory manager, 49waits for pages to reach backing storage. 50<p> 51<dt> <strong>VM_SYNC_ASYNCHRONOUS</strong> 52<dd> 53Writes dirty and precious pages back to the memory manager, 54returns without waiting for pages to reach backing storage. 55</dl> 56</dl> 57<h3>DESCRIPTION</h3> 58<p> 59The <strong>vm_msync</strong> function synchronizes the contents of 60a memory range with its 61backing store image by flushing or cleaning the contents of the 62specified range 63to the range's memory manager, engaging in a synchronization protocol with 64the manager (<strong>memory_object_synchronize</strong>). 65The client does not return from 66this call until the memory manager responds (to the kernel) with 67<strong>memory_object_synchronize_completed</strong>. 68<h3>NOTES</h3> 69<p> 70This interface is machine word length specific because of the virtual address 71parameter. 72<h3>RETURN VALUES</h3> 73<dl> 74<p> 75<dt> <strong>KERN_INVALID_ADDRESS</strong> 76<dd> 77The address is illegal or specifies a non-allocated region. 78</dl> 79<h3>RELATED INFORMATION</h3> 80<p> 81Functions: 82<a href="memory_object_synchronize.html"><strong>memory_object_synchronize</strong></a>, 83<a href="MO_SY_completed.html"><strong>memory_object_synchronize_completed</strong></a>. 84