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>
75 * Destroy the target thread.
77 * JMM - For legacy reasons this consumes a reference to the
78 * target thread. This will have to change in the future because
79 * we want the interfaces to be able to be defined in more standard
80 * IDLs and transports, and most of them do not support the notion
81 * of reference ownership transfers (just sharing).
83 routine thread_terminate(
84 target_act : thread_act_consume_ref_t);
88 * Return the selected state information for the target
89 * thr_act. If the thr_act is currently executing, the results
90 * may be stale. [Flavor THREAD_STATE_FLAVOR_LIST provides a
91 * list of valid flavors for the target thread.]
93 routine act_get_state(
94 target_act : thread_act_t;
96 out old_state : thread_state_t, CountInOut);
99 * Set the selected state information for the target thread.
100 * If the thread is currently executing, the state change
101 * may be ill-defined.
103 routine act_set_state(
104 target_act : thread_act_t;
106 new_state : thread_state_t);
109 * Backward compatible old-style thread routines.
110 * These have different semantics than the new activation versions.
112 * Return the selected state information for the target
113 * thread. If the thread is currently executing, the results
114 * may be stale. [Flavor THREAD_STATE_FLAVOR_LIST provides a
115 * list of valid flavors for the target thr_act.]
117 routine thread_get_state(
118 target_act : thread_act_t;
119 flavor : thread_state_flavor_t;
120 out old_state : thread_state_t, CountInOut);
123 * Set the selected state information for the target thread.
124 * If the thread is currently executing, the state change
125 * may be ill-defined.
127 routine thread_set_state(
128 target_act : thread_act_t;
129 flavor : thread_state_flavor_t;
130 new_state : thread_state_t);
133 * Increment the suspend count for the target thread.
134 * Once this call has completed, the thread will not
135 * execute any further user or meta- instructions.
136 * Once suspended, a thread may not execute again until
137 * its suspend count is zero, and the suspend count
138 * for its task is also zero.
140 routine thread_suspend(
141 target_act : thread_act_t);
144 * Decrement the suspend count for the target thread,
145 * if that count is not already zero.
147 routine thread_resume(
148 target_act : thread_act_t);
151 * Cause any user or meta- instructions currently being
152 * executed by the target thread to be aborted. [Meta-
153 * instructions consist of the basic traps for IPC
154 * (e.g., msg_send, msg_receive) and self-identification
155 * (e.g., task_self, thread_self, thread_reply). Calls
156 * described by MiG interfaces are not meta-instructions
159 routine thread_abort(
160 target_act : thread_act_t);
163 * Cause any user or meta- instructions currently being
164 * executed by the target thread to be aborted so that
165 * they are transparently restartable. This call fails
166 * if the abort would result in a non-restartable condition.
167 * Retry is the caller's responsibility. [Meta-
168 * instructions consist of the basic traps for IPC
169 * (e.g., msg_send, msg_receive) and self-identification
170 * (e.g., task_self, thread_self, thread_reply). Calls
171 * described by MiG interfaces are not meta-instructions
174 routine thread_abort_safely(
175 target_act : thread_act_t);
178 routine thread_depress_abort(
179 thread : thread_act_t);
183 * Returns the current value of the selected special port
184 * associated with the target thread.
186 routine thread_get_special_port(
187 thr_act : thread_act_t;
189 out special_port : mach_port_t);
192 * Set one of the special ports associated with the
195 routine thread_set_special_port(
196 thr_act : thread_act_t;
198 special_port : mach_port_t);
201 * Returns information about the target thread.
204 target_act : thread_act_t;
205 flavor : thread_flavor_t;
206 out thread_info_out : thread_info_t, CountInOut);
209 * Set an exception handler for a thread on one or more exception types
211 routine thread_set_exception_ports(
212 thread : thread_act_t;
213 exception_mask : exception_mask_t;
214 new_port : mach_port_t;
215 behavior : exception_behavior_t;
216 new_flavor : thread_state_flavor_t);
219 * Lookup some of the old exception handlers for a thread
221 routine thread_get_exception_ports(
222 thread : thread_act_t;
223 exception_mask : exception_mask_t;
224 out masks : exception_mask_array_t;
225 out old_handlers : exception_handler_array_t, SameCount;
226 out old_behaviors : exception_behavior_array_t, SameCount;
227 out old_flavors : exception_flavor_array_t, SameCount);
230 * Set an exception handler for a thread on one or more exception types.
231 * At the same time, return the previously defined exception handlers for
234 routine thread_swap_exception_ports(
235 thread : thread_act_t;
236 exception_mask : exception_mask_t;
237 new_port : mach_port_t;
238 behavior : exception_behavior_t;
239 new_flavor : thread_state_flavor_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 * OBSOLETE interface.
248 routine thread_policy(
249 thr_act : thread_act_t;
251 base : policy_base_t;
252 set_limit : boolean_t);
255 * Set/get policy information for a thread.
256 * (Approved Mac OS X microkernel interface)
259 routine thread_policy_set(
260 thread : thread_act_t;
261 flavor : thread_policy_flavor_t;
262 policy_info : thread_policy_t);
264 routine thread_policy_get(
265 thread : thread_act_t;
266 flavor : thread_policy_flavor_t;
267 out policy_info : thread_policy_t, CountInOut;
268 inout get_default : boolean_t);
271 * Removed from the kernel.
276 routine thread_sample(
277 thread : thread_act_t;
278 reply : mach_port_make_send_t);
282 * ETAP has been removed from the kernel.
287 routine etap_trace_thread(
288 target_act : thread_act_t;
289 trace_status : boolean_t);
293 * Assign thread to processor set.
295 routine thread_assign(
296 thread : thread_act_t;
297 new_set : processor_set_t);
300 * Assign thread to default set.
302 routine thread_assign_default(
303 thread : thread_act_t);
306 * Get current assignment for thread.
308 routine thread_get_assignment(
309 thread : thread_act_t;
310 out assigned_set : processor_set_name_t);
314 * OBSOLETE interface.
316 routine thread_set_policy(
317 thr_act : thread_act_t;
318 pset : processor_set_t;
320 base : policy_base_t;
321 limit : policy_limit_t);
323 /* vim: set ft=c : */