2 * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
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.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
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.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
29 * @OSF_FREE_COPYRIGHT@
32 * Mach Operating System
33 * Copyright (c) 1991,1990,1989 Carnegie Mellon University
34 * All Rights Reserved.
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.
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.
46 * Carnegie Mellon requests users of this software to return to
48 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
49 * School of Computer Science
50 * Carnegie Mellon University
51 * Pittsburgh PA 15213-3890
53 * any improvements or extensions that they make and grant Carnegie Mellon
54 * the rights to redistribute these changes.
59 * File: mach/mach_port.defs
62 * Exported kernel calls.
68 #endif /* KERNEL_SERVER */
71 #include <mach/std_types.defs>
72 #include <mach/mach_types.defs>
74 #if !KERNEL && !LIBSYSCALL_INTERFACE
75 #define PREFIX(NAME) _kernelrpc_ ## NAME
77 #define PREFIX(NAME) NAME
81 * Destroy the target thread.
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).
89 routine thread_terminate(
90 target_act : thread_act_consume_ref_t);
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.]
99 routine act_get_state(
100 target_act : thread_act_t;
102 out old_state : thread_state_t, CountInOut);
105 * Set the selected state information for the target thread.
106 * If the thread is currently executing, the state change
107 * may be ill-defined.
111 act_set_state_from_user(
115 target_act : thread_act_t;
117 new_state : thread_state_t);
120 * Backward compatible old-style thread routines.
121 * These have different semantics than the new activation versions.
123 * Return the selected state information for the target
124 * thread. If the thread is currently executing, the results
125 * may be stale. [Flavor THREAD_STATE_FLAVOR_LIST provides a
126 * list of valid flavors for the target thr_act.]
128 routine thread_get_state(
129 target_act : thread_act_t;
130 flavor : thread_state_flavor_t;
131 out old_state : thread_state_t, CountInOut);
134 * Set the selected state information for the target thread.
135 * If the thread is currently executing, the state change
136 * may be ill-defined.
140 thread_set_state_from_user(
144 target_act : thread_act_t;
145 flavor : thread_state_flavor_t;
146 new_state : thread_state_t);
149 * Increment the suspend count for the target thread.
150 * Once this call has completed, the thread will not
151 * execute any further user or meta- instructions.
152 * Once suspended, a thread may not execute again until
153 * its suspend count is zero, and the suspend count
154 * for its task is also zero.
156 routine thread_suspend(
157 target_act : thread_act_t);
160 * Decrement the suspend count for the target thread,
161 * if that count is not already zero.
163 routine thread_resume(
164 target_act : thread_act_t);
167 * Cause any user or meta- instructions currently being
168 * executed by the target thread to be aborted. [Meta-
169 * instructions consist of the basic traps for IPC
170 * (e.g., msg_send, msg_receive) and self-identification
171 * (e.g., task_self, thread_self, thread_reply). Calls
172 * described by MiG interfaces are not meta-instructions
175 routine thread_abort(
176 target_act : thread_act_t);
179 * Cause any user or meta- instructions currently being
180 * executed by the target thread to be aborted so that
181 * they are transparently restartable. This call fails
182 * if the abort would result in a non-restartable condition.
183 * Retry is the caller's responsibility. [Meta-
184 * instructions consist of the basic traps for IPC
185 * (e.g., msg_send, msg_receive) and self-identification
186 * (e.g., task_self, thread_self, thread_reply). Calls
187 * described by MiG interfaces are not meta-instructions
190 routine thread_abort_safely(
191 target_act : thread_act_t);
194 routine thread_depress_abort(
195 thread : thread_act_t);
199 * Returns the current value of the selected special port
200 * associated with the target thread.
202 routine thread_get_special_port(
203 thr_act : thread_act_t;
205 out special_port : mach_port_t);
208 * Set one of the special ports associated with the
211 routine thread_set_special_port(
212 thr_act : thread_act_t;
214 special_port : mach_port_t);
217 * Returns information about the target thread.
220 target_act : thread_inspect_t;
221 flavor : thread_flavor_t;
222 out thread_info_out : thread_info_t, CountInOut);
225 * Set an exception handler for a thread on one or more exception types
227 routine thread_set_exception_ports(
228 thread : thread_act_t;
229 exception_mask : exception_mask_t;
230 new_port : mach_port_t;
231 behavior : exception_behavior_t;
232 new_flavor : thread_state_flavor_t);
235 * Lookup some of the old exception handlers for a thread
237 routine thread_get_exception_ports(
238 thread : thread_inspect_t;
239 exception_mask : exception_mask_t;
240 out masks : exception_mask_array_t;
241 out old_handlers : exception_handler_array_t, SameCount;
242 out old_behaviors : exception_behavior_array_t, SameCount;
243 out old_flavors : exception_flavor_array_t, SameCount);
246 * Set an exception handler for a thread on one or more exception types.
247 * At the same time, return the previously defined exception handlers for
250 routine thread_swap_exception_ports(
251 thread : thread_act_t;
252 exception_mask : exception_mask_t;
253 new_port : mach_port_t;
254 behavior : exception_behavior_t;
255 new_flavor : thread_state_flavor_t;
256 out masks : exception_mask_array_t;
257 out old_handlers : exception_handler_array_t, SameCount;
258 out old_behaviors : exception_behavior_array_t, SameCount;
259 out old_flavors : exception_flavor_array_t, SameCount);
262 * OBSOLETE interface.
264 routine PREFIX(thread_policy)(
265 thr_act : thread_act_t;
267 base : policy_base_t;
268 set_limit : boolean_t);
271 * Set/get policy information for a thread.
272 * (Approved Mac OS X microkernel interface)
275 routine PREFIX(thread_policy_set)(
276 thread : thread_act_t;
277 flavor : thread_policy_flavor_t;
278 policy_info : thread_policy_t);
280 routine thread_policy_get(
281 thread : thread_inspect_t;
282 flavor : thread_policy_flavor_t;
283 out policy_info : thread_policy_t, CountInOut;
284 inout get_default : boolean_t);
287 * Removed from the kernel.
292 routine thread_sample(
293 thread : thread_act_t;
294 reply : mach_port_make_send_t);
298 * ETAP has been removed from the kernel.
303 routine etap_trace_thread(
304 target_act : thread_act_t;
305 trace_status : boolean_t);
309 * Assign thread to processor set.
311 routine thread_assign(
312 thread : thread_act_t;
313 new_set : processor_set_t);
316 * Assign thread to default set.
318 routine thread_assign_default(
319 thread : thread_act_t);
322 * Get current assignment for thread.
324 routine thread_get_assignment(
325 thread : thread_act_t;
326 out assigned_set : processor_set_name_t);
329 * OBSOLETE interface.
331 routine PREFIX(thread_set_policy)(
332 thr_act : thread_act_t;
333 pset : processor_set_t;
335 base : policy_base_t;
336 limit : policy_limit_t);
338 routine thread_get_mach_voucher(
339 thr_act : thread_act_t;
340 which : mach_voucher_selector_t;
341 out voucher : ipc_voucher_t);
343 routine thread_set_mach_voucher(
344 thr_act : thread_act_t;
345 voucher : ipc_voucher_t);
347 routine thread_swap_mach_voucher(
348 thr_act : thread_act_t;
349 new_voucher : ipc_voucher_t;
350 inout old_voucher : ipc_voucher_t);
352 /* vim: set ft=c : */