]> git.saurik.com Git - apple/xnu.git/blob - osfmk/mach/thread_act.defs
xnu-6153.101.6.tar.gz
[apple/xnu.git] / osfmk / mach / thread_act.defs
1 /*
2 * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28 /*
29 * @OSF_FREE_COPYRIGHT@
30 */
31 /*
32 * Mach Operating System
33 * Copyright (c) 1991,1990,1989 Carnegie Mellon University
34 * All Rights Reserved.
35 *
36 * Permission to use, copy, modify and distribute this software and its
37 * documentation is hereby granted, provided that both the copyright
38 * notice and this permission notice appear in all copies of the
39 * software, derivative works or modified versions, and any portions
40 * thereof, and that both notices appear in supporting documentation.
41 *
42 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
43 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
44 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
45 *
46 * Carnegie Mellon requests users of this software to return to
47 *
48 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
49 * School of Computer Science
50 * Carnegie Mellon University
51 * Pittsburgh PA 15213-3890
52 *
53 * any improvements or extensions that they make and grant Carnegie Mellon
54 * the rights to redistribute these changes.
55 */
56 /*
57 */
58 /*
59 * File: mach/mach_port.defs
60 * Author: Rich Draves
61 *
62 * Exported kernel calls.
63 */
64
65 subsystem
66 #if KERNEL_SERVER
67 KernelServer
68 #endif /* KERNEL_SERVER */
69 thread_act 3600;
70
71 #include <mach/std_types.defs>
72 #include <mach/mach_types.defs>
73
74 #if !KERNEL && !LIBSYSCALL_INTERFACE
75 #define PREFIX(NAME) _kernelrpc_ ## NAME
76 #else
77 #define PREFIX(NAME) NAME
78 #endif
79
80 /*
81 * Destroy the target thread.
82 *
83 * JMM - For legacy reasons this consumes a reference to the
84 * target thread. This will have to change in the future because
85 * we want the interfaces to be able to be defined in more standard
86 * IDLs and transports, and most of them do not support the notion
87 * of reference ownership transfers (just sharing).
88 */
89 routine thread_terminate(
90 target_act : thread_act_consume_ref_t);
91
92
93 /*
94 * Return the selected state information for the target
95 * thr_act. If the thr_act is currently executing, the results
96 * may be stale. [Flavor THREAD_STATE_FLAVOR_LIST provides a
97 * list of valid flavors for the target thread.]
98 */
99 routine
100 #ifdef KERNEL_SERVER
101 act_get_state_to_user(
102 #else
103 act_get_state(
104 #endif
105 target_act : thread_act_t;
106 flavor : int;
107 out old_state : thread_state_t, CountInOut);
108
109 /*
110 * Set the selected state information for the target thread.
111 * If the thread is currently executing, the state change
112 * may be ill-defined.
113 */
114 routine
115 #ifdef KERNEL_SERVER
116 act_set_state_from_user(
117 #else
118 act_set_state(
119 #endif
120 target_act : thread_act_t;
121 flavor : int;
122 new_state : thread_state_t);
123
124 /*
125 * Backward compatible old-style thread routines.
126 * These have different semantics than the new activation versions.
127 *
128 * Return the selected state information for the target
129 * thread. If the thread is currently executing, the results
130 * may be stale. [Flavor THREAD_STATE_FLAVOR_LIST provides a
131 * list of valid flavors for the target thr_act.]
132 */
133 routine
134 #ifdef KERNEL_SERVER
135 thread_get_state_to_user(
136 #else
137 thread_get_state(
138 #endif
139 target_act : thread_act_t;
140 flavor : thread_state_flavor_t;
141 out old_state : thread_state_t, CountInOut);
142
143 /*
144 * Set the selected state information for the target thread.
145 * If the thread is currently executing, the state change
146 * may be ill-defined.
147 */
148 routine
149 #ifdef KERNEL_SERVER
150 thread_set_state_from_user(
151 #else
152 thread_set_state(
153 #endif
154 target_act : thread_act_t;
155 flavor : thread_state_flavor_t;
156 new_state : thread_state_t);
157
158 /*
159 * Increment the suspend count for the target thread.
160 * Once this call has completed, the thread will not
161 * execute any further user or meta- instructions.
162 * Once suspended, a thread may not execute again until
163 * its suspend count is zero, and the suspend count
164 * for its task is also zero.
165 */
166 routine thread_suspend(
167 target_act : thread_act_t);
168
169 /*
170 * Decrement the suspend count for the target thread,
171 * if that count is not already zero.
172 */
173 routine thread_resume(
174 target_act : thread_act_t);
175
176 /*
177 * Cause any user or meta- instructions currently being
178 * executed by the target thread to be aborted. [Meta-
179 * instructions consist of the basic traps for IPC
180 * (e.g., msg_send, msg_receive) and self-identification
181 * (e.g., task_self, thread_self, thread_reply). Calls
182 * described by MiG interfaces are not meta-instructions
183 * themselves.]
184 */
185 routine thread_abort(
186 target_act : thread_act_t);
187
188 /*
189 * Cause any user or meta- instructions currently being
190 * executed by the target thread to be aborted so that
191 * they are transparently restartable. This call fails
192 * if the abort would result in a non-restartable condition.
193 * Retry is the caller's responsibility. [Meta-
194 * instructions consist of the basic traps for IPC
195 * (e.g., msg_send, msg_receive) and self-identification
196 * (e.g., task_self, thread_self, thread_reply). Calls
197 * described by MiG interfaces are not meta-instructions
198 * themselves.]
199 */
200 routine thread_abort_safely(
201 target_act : thread_act_t);
202
203
204 routine
205 #ifdef KERNEL_SERVER
206 thread_depress_abort_from_user(
207 #else
208 thread_depress_abort(
209 #endif
210 thread : thread_act_t);
211
212
213 /*
214 * Returns the current value of the selected special port
215 * associated with the target thread.
216 */
217 routine thread_get_special_port(
218 thr_act : thread_act_t;
219 which_port : int;
220 out special_port : mach_port_t);
221
222 /*
223 * Set one of the special ports associated with the
224 * target thread.
225 */
226 routine thread_set_special_port(
227 thr_act : thread_act_t;
228 which_port : int;
229 special_port : mach_port_t);
230
231 /*
232 * Returns information about the target thread.
233 */
234 routine thread_info(
235 target_act : thread_inspect_t;
236 flavor : thread_flavor_t;
237 out thread_info_out : thread_info_t, CountInOut);
238
239 /*
240 * Set an exception handler for a thread on one or more exception types
241 */
242 routine thread_set_exception_ports(
243 thread : thread_act_t;
244 exception_mask : exception_mask_t;
245 new_port : mach_port_t;
246 behavior : exception_behavior_t;
247 new_flavor : thread_state_flavor_t);
248
249 /*
250 * Lookup some of the old exception handlers for a thread
251 */
252 routine thread_get_exception_ports(
253 thread : thread_inspect_t;
254 exception_mask : exception_mask_t;
255 out masks : exception_mask_array_t;
256 out old_handlers : exception_handler_array_t, SameCount;
257 out old_behaviors : exception_behavior_array_t, SameCount;
258 out old_flavors : exception_flavor_array_t, SameCount);
259
260 /*
261 * Set an exception handler for a thread on one or more exception types.
262 * At the same time, return the previously defined exception handlers for
263 * those types.
264 */
265 routine thread_swap_exception_ports(
266 thread : thread_act_t;
267 exception_mask : exception_mask_t;
268 new_port : mach_port_t;
269 behavior : exception_behavior_t;
270 new_flavor : thread_state_flavor_t;
271 out masks : exception_mask_array_t;
272 out old_handlers : exception_handler_array_t, SameCount;
273 out old_behaviors : exception_behavior_array_t, SameCount;
274 out old_flavors : exception_flavor_array_t, SameCount);
275
276 /*
277 * OBSOLETE interface.
278 */
279 routine PREFIX(thread_policy)(
280 thr_act : thread_act_t;
281 policy : policy_t;
282 base : policy_base_t;
283 set_limit : boolean_t);
284
285 /*
286 * Set/get policy information for a thread.
287 * (Approved Mac OS X microkernel interface)
288 */
289
290 routine PREFIX(thread_policy_set)(
291 thread : thread_act_t;
292 flavor : thread_policy_flavor_t;
293 policy_info : thread_policy_t);
294
295 routine thread_policy_get(
296 thread : thread_inspect_t;
297 flavor : thread_policy_flavor_t;
298 out policy_info : thread_policy_t, CountInOut;
299 inout get_default : boolean_t);
300
301 /*
302 * Removed from the kernel.
303 */
304 #if KERNEL_SERVER
305 skip;
306 #else
307 routine thread_sample(
308 thread : thread_act_t;
309 reply : mach_port_make_send_t);
310 #endif
311
312 /*
313 * ETAP has been removed from the kernel.
314 */
315 #if KERNEL_SERVER
316 skip;
317 #else
318 routine etap_trace_thread(
319 target_act : thread_act_t;
320 trace_status : boolean_t);
321 #endif
322
323 /*
324 * Assign thread to processor set.
325 */
326 routine thread_assign(
327 thread : thread_act_t;
328 new_set : processor_set_t);
329
330 /*
331 * Assign thread to default set.
332 */
333 routine thread_assign_default(
334 thread : thread_act_t);
335
336 /*
337 * Get current assignment for thread.
338 */
339 routine thread_get_assignment(
340 thread : thread_act_t;
341 out assigned_set : processor_set_name_t);
342
343 /*
344 * OBSOLETE interface.
345 */
346 routine PREFIX(thread_set_policy)(
347 thr_act : thread_act_t;
348 pset : processor_set_t;
349 policy : policy_t;
350 base : policy_base_t;
351 limit : policy_limit_t);
352
353 routine thread_get_mach_voucher(
354 thr_act : thread_act_t;
355 which : mach_voucher_selector_t;
356 out voucher : ipc_voucher_t);
357
358 routine thread_set_mach_voucher(
359 thr_act : thread_act_t;
360 voucher : ipc_voucher_t);
361
362 routine thread_swap_mach_voucher(
363 thr_act : thread_act_t;
364 new_voucher : ipc_voucher_t;
365 inout old_voucher : ipc_voucher_t);
366
367 /* vim: set ft=c : */