1 <h2>memory_object_lock_request
</h2>
4 <strong>Function
</strong> - Restrict access to memory object data.
7 <strong>kern_return_t memory_object_lock_request
</strong>
8 <strong>(memory_object_control_t
</strong> <var>memory_control
</var>,
9 <strong>vm_offset_t
</strong> <var>offset
</var>,
10 <strong>vm_size_t
</strong> <var>size
</var>,
11 <strong>memory_object_return_t
</strong> <var>should_return
</var>,
12 <strong>boolean_t
</strong> <var>should_flush
</var>,
13 <strong>vm_prot_t
</strong> <var>lock_value
</var>,
14 <strong>mach_port_t
</strong> <var>reply_port
</var><strong>);
</strong>
19 <dt> <var>memory_control
</var>
21 [in memory-cache-control send right]
22 The memory cache control port
23 to be used by the memory manager for cache management requests.
24 This port is provided by the kernel in a
<strong>memory_object_init
</strong> call.
26 <dt> <var>offset
</var>
29 The offset within the memory object, in bytes.
34 The number of bytes of data (starting at
<var>offset
</var>) to be
35 affected. The number must convert to an integral number of memory object
38 <dt> <var>should_return
</var>
41 Clean indicator. Values are:
44 <dt> <strong>MEMORY_OBJECT_RETURN_NONE
</strong>
46 Don't return any pages. If
<var>should_flush
</var> is
<strong>TRUE
</strong>, pages will
49 <dt> <strong>MEMORY_OBJECT_RETURN_DIRTY
</strong>
51 Return only dirty (modified) pages. If
<var>should_flush
</var> is
<strong>TRUE
</strong>,
52 precious pages will be discarded; otherwise, the kernel
53 maintains responsibility for precious pages.
55 <dt> <strong>MEMORY_OBJECT_RETURN_ALL
</strong>
57 Both dirty and precious pages are returned. If
<var>should_flush
</var> is
58 <strong>FALSE
</strong>, the kernel maintains responsibility for the precious
61 <dt> <strong>MEMORY_OBJECT_RETURN_ANYTHING
</strong>
63 Any resident pages are returned. If
<var>should_flush
</var> is
<strong>TRUE
</strong>,
64 precious pages will be discarded; otherwise, the kernel
65 maintains responsibility for precious pages.
68 <dt> <var>should_flush
</var>
71 Flush indicator. If true, the kernel discards all pages within
74 <dt> <var>lock_value
</var>
77 One or more forms of access
<var>not
</var> permitted for the specified
78 data. Valid values are:
81 <dt> <strong>VM_PROT_NO_CHANGE
</strong>
83 Do not change the protection of any pages.
85 <dt> <strong>VM_PROT_NONE
</strong>
87 Prohibits no access (that is, all forms of access are permitted).
89 <dt> <strong>VM_PROT_READ
</strong>
91 Prohibits read access.
93 <dt> <strong>VM_PROT_WRITE
</strong>
95 Prohibits write access.
97 <dt> <strong>VM_PROT_EXECUTE
</strong>
99 Prohibits execute access.
101 <dt> <strong>VM_PROT_ALL
</strong>
103 Prohibits all forms of access.
106 <dt> <var>reply_port
</var>
108 [in reply receive (to be converted to send) right]
110 be used by the kernel on a call to
<strong>memory_object_lock_completed
</strong>,
111 or
<strong>MACH_PORT_NULL
</strong> if no response is required.
115 The
<strong>memory_object_lock_request
</strong> function allows the memory manager to
116 make the following requests of the kernel:
119 Clean the pages within the specified range by writing back all changed (that
120 is, dirty) and precious pages. The kernel uses the
121 <strong>memory_object_data_return
</strong> call to write back the data.
122 The
<var>should_return
</var> parameter must be set to
126 Flush all cached data within the specified range. The kernel invalidates the
127 range of data and revokes all uses of that data. The
<var>should_flush
</var>
128 parameter must be set to true.
131 Alter access restrictions specified in the
<strong>memory_object_data_supply
</strong>
133 or a previous
<strong>memory_object_lock_request
</strong> call. The
134 <var>lock_value
</var> parameter
135 must specify the new access restrictions. Note that this parameter can be
136 used to unlock previously locked data.
139 Once the kernel performs all of the actions requested by this
141 <strong>memory_object_lock_completed
</strong> call using the
<var>reply_to
</var> port.
144 The
<strong>memory_object_lock_request
</strong> call affects only data
145 that is cached at the
146 time of the call. Access restrictions cannot be applied to pages
148 has not been provided.
150 When a running thread requires an access that is currently prohibited,
152 issues a
<strong>memory_object_data_unlock
</strong> call specifying
153 the access required. The
154 memory manager can then use
<strong>memory_object_lock_request
</strong> to relax its
155 access restrictions on the data.
157 To indicate that an unlock request is invalid (that is, requires
159 never be granted), the memory manager must first flush the page. When the
160 kernel requests the data again with the higher permission, the
162 indicate the error by responding with a call to
163 <strong>memory_object_data_error
</strong>.
164 <h3>RETURN VALUES
</h3>
166 Only generic errors apply.
167 <h3>RELATED INFORMATION
</h3>
170 <a href=
"memory_object_data_supply.html"><strong>memory_object_data_supply
</strong></a>,
171 <a href=
"memory_object_data_unlock.html"><strong>memory_object_data_unlock
</strong></a>,
172 <a href=
"MO_lock_completed.html"><strong>memory_object_lock_completed
</strong></a>.