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