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>
73 #include <mach_debug/mach_debug_types.defs>
76 * Create a new task with an empty set of IPC rights,
77 * and having an address space constructed from the
78 * target task (or empty, if inherit_memory is FALSE).
82 ledgers : ledger_array_t;
83 inherit_memory : boolean_t;
84 out child_task : task_t);
87 * Destroy the target task, causing all of its threads
88 * to be destroyed, all of its IPC rights to be deallocated,
89 * and all of its address space to be deallocated.
91 routine task_terminate(
92 target_task : task_t);
95 * Returns the set of threads belonging to the target task.
99 out act_list : thread_act_array_t);
102 * Stash a handful of ports for the target task; child
103 * tasks inherit this stash at task_create time.
105 routine mach_ports_register(
106 target_task : task_t;
107 init_port_set : mach_port_array_t =
108 ^array[] of mach_port_t);
111 * Retrieve the stashed ports for the target task.
113 routine mach_ports_lookup(
114 target_task : task_t;
115 out init_port_set : mach_port_array_t =
116 ^array[] of mach_port_t);
119 * Returns information about the target task.
122 target_task : task_name_t;
123 flavor : task_flavor_t;
124 out task_info_out : task_info_t, CountInOut);
127 * Set task information.
129 routine task_set_info(
130 target_task : task_t;
131 flavor : task_flavor_t;
132 task_info_in : task_info_t);
135 * Increment the suspend count for the target task.
136 * No threads within a task may run when the suspend
137 * count for that task is non-zero.
139 routine task_suspend(
140 target_task : task_t);
144 * Decrement the suspend count for the target task,
145 * if the count is currently non-zero. If the resulting
146 * suspend count is zero, then threads within the task
147 * that also have non-zero suspend counts may execute.
150 target_task : task_t);
153 * Returns the current value of the selected special port
154 * associated with the target task.
156 routine task_get_special_port(
159 out special_port : mach_port_t);
162 * Set one of the special ports associated with the
165 routine task_set_special_port(
168 special_port : mach_port_t);
171 * Create a new thread within the target task, returning
172 * the port representing the first thr_act in that new thread. The
173 * initial execution state of the thread is undefined.
177 thread_create_from_user(
181 parent_task : task_t;
182 out child_act : thread_act_t);
185 * Create a new thread within the target task, returning
186 * the port representing that new thread. The new thread
187 * is not suspended; its initial execution state is given
188 * by flavor and new_state. Returns the port representing
193 thread_create_running_from_user(
195 thread_create_running(
197 parent_task : task_t;
198 flavor : thread_state_flavor_t;
199 new_state : thread_state_t;
200 out child_act : thread_act_t);
203 * Set an exception handler for a task on one or more exception types.
204 * These handlers are invoked for all threads in the task if there are
205 * no thread-specific exception handlers or those handlers returned an
208 routine task_set_exception_ports(
210 exception_mask : exception_mask_t;
211 new_port : mach_port_t;
212 behavior : exception_behavior_t;
213 new_flavor : thread_state_flavor_t);
217 * Lookup some of the old exception handlers for a task
219 routine task_get_exception_ports(
221 exception_mask : exception_mask_t;
222 out masks : exception_mask_array_t;
223 out old_handlers : exception_handler_array_t, SameCount;
224 out old_behaviors : exception_behavior_array_t, SameCount;
225 out old_flavors : exception_flavor_array_t, SameCount);
229 * Set an exception handler for a thread on one or more exception types.
230 * At the same time, return the previously defined exception handlers for
233 routine task_swap_exception_ports(
235 exception_mask : exception_mask_t;
236 new_port : mach_port_t;
237 behavior : exception_behavior_t;
238 new_flavor : thread_state_flavor_t;
239 out masks : exception_mask_array_t;
240 out old_handlerss : exception_handler_array_t, SameCount;
241 out old_behaviors : exception_behavior_array_t, SameCount;
242 out old_flavors : exception_flavor_array_t, SameCount);
245 * Create and destroy lock_set and semaphore synchronizers on a
246 * per-task basis (i.e. the task owns them).
248 routine lock_set_create(
250 out new_lock_set : lock_set_t;
254 routine lock_set_destroy(
256 lock_set : lock_set_t);
258 routine semaphore_create(
260 out semaphore : semaphore_t;
264 routine semaphore_destroy(
266 semaphore : semaphore_consume_ref_t);
269 * Set/get policy information for a task.
270 * (Approved Mac OS X microkernel interface)
273 routine task_policy_set(
275 flavor : task_policy_flavor_t;
276 policy_info : task_policy_t);
278 routine task_policy_get(
280 flavor : task_policy_flavor_t;
281 out policy_info : task_policy_t, CountInOut;
282 inout get_default : boolean_t);
285 * Removed from the kernel.
292 reply : mach_port_make_send_t);
296 * JMM - Everything from here down is likely to go away soon
299 * OBSOLETE interface.
304 base : policy_base_t;
305 set_limit : boolean_t;
310 * Establish a user-level handler for the specified
313 routine task_set_emulation(
314 target_port : task_t;
315 routine_entry_pt: vm_address_t;
316 routine_number : int);
319 * Get user-level handler entry points for all
320 * emulated system calls.
322 routine task_get_emulation_vector(
324 out vector_start : int;
325 out emulation_vector: emulation_vector_t);
328 * Establish user-level handlers for the specified
329 * system calls. Non-emulated system calls are specified
330 * with emulation_vector[i] == EML_ROUTINE_NULL.
332 routine task_set_emulation_vector(
335 emulation_vector: emulation_vector_t);
339 * Establish restart pc for interrupted atomic sequences.
341 routine task_set_ras_pc(
342 target_task : task_t;
343 basepc : vm_address_t;
344 boundspc : vm_address_t);
348 * Return zone info as seen/used by this task.
350 routine task_zone_info(
351 target_task : task_t;
352 out names : mach_zone_name_array_t,
354 out info : task_zone_info_array_t,
359 * JMM - Want to eliminate processor_set so keep them at the end.
363 * Assign task to processor set.
367 new_set : processor_set_t;
368 assign_threads : boolean_t);
371 * Assign task to default set.
373 routine task_assign_default(
375 assign_threads : boolean_t);
378 * Get current assignment for task.
380 routine task_get_assignment(
382 out assigned_set : processor_set_name_t);
385 * OBSOLETE interface.
387 routine task_set_policy(
389 pset : processor_set_t;
391 base : policy_base_t;
392 limit : policy_limit_t;
396 * Read the selected state which is to be installed on new
397 * threads in the task as they are created.
399 routine task_get_state(
401 flavor : thread_state_flavor_t;
402 out old_state : thread_state_t, CountInOut);
405 * Set the selected state information to be installed on
406 * all subsequently created threads in the task.
408 routine task_set_state(
410 flavor : thread_state_flavor_t;
411 new_state : thread_state_t);
413 /* vim: set ft=c : */