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.
98 target_task : task_inspect_t;
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 routine task_info_from_user(
123 target_task : mach_port_t;
124 flavor : task_flavor_t;
125 out task_info_out : task_info_t, CountInOut);
128 target_task : task_name_t;
129 flavor : task_flavor_t;
130 out task_info_out : task_info_t, CountInOut);
134 * Set task information.
136 routine task_set_info(
137 target_task : task_t;
138 flavor : task_flavor_t;
139 task_info_in : task_info_t);
142 * Increment the suspend count for the target task.
143 * No threads within a task may run when the suspend
144 * count for that task is non-zero.
146 routine task_suspend(
147 target_task : task_t);
151 * Decrement the suspend count for the target task,
152 * if the count is currently non-zero. If the resulting
153 * suspend count is zero, then threads within the task
154 * that also have non-zero suspend counts may execute.
157 target_task : task_t);
160 * Returns the current value of the selected special port
161 * associated with the target task.
163 routine task_get_special_port(
164 task : task_inspect_t;
166 out special_port : mach_port_t);
169 * Set one of the special ports associated with the
172 routine task_set_special_port(
175 special_port : mach_port_t);
178 * Create a new thread within the target task, returning
179 * the port representing the first thr_act in that new thread. The
180 * initial execution state of the thread is undefined.
184 thread_create_from_user(
188 parent_task : task_t;
189 out child_act : thread_act_t);
192 * Create a new thread within the target task, returning
193 * the port representing that new thread. The new thread
194 * is not suspended; its initial execution state is given
195 * by flavor and new_state. Returns the port representing
200 thread_create_running_from_user(
202 thread_create_running(
204 parent_task : task_t;
205 flavor : thread_state_flavor_t;
206 new_state : thread_state_t;
207 out child_act : thread_act_t);
210 * Set an exception handler for a task on one or more exception types.
211 * These handlers are invoked for all threads in the task if there are
212 * no thread-specific exception handlers or those handlers returned an
215 routine task_set_exception_ports(
217 exception_mask : exception_mask_t;
218 new_port : mach_port_t;
219 behavior : exception_behavior_t;
220 new_flavor : thread_state_flavor_t);
224 * Lookup some of the old exception handlers for a task
226 routine task_get_exception_ports(
227 task : task_inspect_t;
228 exception_mask : exception_mask_t;
229 out masks : exception_mask_array_t;
230 out old_handlers : exception_handler_array_t, SameCount;
231 out old_behaviors : exception_behavior_array_t, SameCount;
232 out old_flavors : exception_flavor_array_t, SameCount);
236 * Set an exception handler for a thread on one or more exception types.
237 * At the same time, return the previously defined exception handlers for
240 routine task_swap_exception_ports(
242 exception_mask : exception_mask_t;
243 new_port : mach_port_t;
244 behavior : exception_behavior_t;
245 new_flavor : thread_state_flavor_t;
246 out masks : exception_mask_array_t;
247 out old_handlerss : exception_handler_array_t, SameCount;
248 out old_behaviors : exception_behavior_array_t, SameCount;
249 out old_flavors : exception_flavor_array_t, SameCount);
252 * OBSOLETE interface.
254 routine lock_set_create(
256 out new_lock_set : lock_set_t;
261 * OBSOLETE interface.
263 routine lock_set_destroy(
265 lock_set : lock_set_t);
268 * Create and destroy semaphore synchronizers on a
269 * per-task basis (i.e. the task owns them).
272 routine semaphore_create(
274 out semaphore : semaphore_t;
278 routine semaphore_destroy(
280 semaphore : semaphore_consume_ref_t);
283 * Set/get policy information for a task.
284 * (Approved Mac OS X microkernel interface)
287 routine task_policy_set(
289 flavor : task_policy_flavor_t;
290 policy_info : task_policy_t);
292 routine task_policy_get(
294 flavor : task_policy_flavor_t;
295 out policy_info : task_policy_t, CountInOut;
296 inout get_default : boolean_t);
299 * Removed from the kernel.
306 reply : mach_port_make_send_t);
310 * JMM - Everything from here down is likely to go away soon
313 * OBSOLETE interface.
318 base : policy_base_t;
319 set_limit : boolean_t;
324 * Establish a user-level handler for the specified
327 routine task_set_emulation(
328 target_port : task_t;
329 routine_entry_pt: vm_address_t;
330 routine_number : int);
333 * Get user-level handler entry points for all
334 * emulated system calls.
336 routine task_get_emulation_vector(
338 out vector_start : int;
339 out emulation_vector: emulation_vector_t);
342 * Establish user-level handlers for the specified
343 * system calls. Non-emulated system calls are specified
344 * with emulation_vector[i] == EML_ROUTINE_NULL.
346 routine task_set_emulation_vector(
349 emulation_vector: emulation_vector_t);
353 * Establish restart pc for interrupted atomic sequences.
355 routine task_set_ras_pc(
356 target_task : task_t;
357 basepc : vm_address_t;
358 boundspc : vm_address_t);
362 * Return zone info as seen/used by this task.
364 routine task_zone_info(
365 target_task : task_t;
366 out names : mach_zone_name_array_t,
368 out info : task_zone_info_array_t,
373 * JMM - Want to eliminate processor_set so keep them at the end.
377 * Assign task to processor set.
381 new_set : processor_set_t;
382 assign_threads : boolean_t);
385 * Assign task to default set.
387 routine task_assign_default(
389 assign_threads : boolean_t);
392 * Get current assignment for task.
394 routine task_get_assignment(
396 out assigned_set : processor_set_name_t);
399 * OBSOLETE interface.
401 routine task_set_policy(
403 pset : processor_set_t;
405 base : policy_base_t;
406 limit : policy_limit_t;
410 * Read the selected state which is to be installed on new
411 * threads in the task as they are created.
413 routine task_get_state(
415 flavor : thread_state_flavor_t;
416 out old_state : thread_state_t, CountInOut);
419 * Set the selected state information to be installed on
420 * all subsequently created threads in the task.
422 routine task_set_state(
424 flavor : thread_state_flavor_t;
425 new_state : thread_state_t);
428 * Change the task's physical footprint limit (in MB).
430 routine task_set_phys_footprint_limit(
433 out old_limit : int);
435 routine task_suspend2(
436 target_task : task_t;
437 out suspend_token : task_suspension_token_t);
439 routine task_resume2(
440 suspend_token : task_suspension_token_t);
442 routine task_purgable_info(
444 out stats : task_purgable_info_t);
446 routine task_get_mach_voucher(
448 which : mach_voucher_selector_t;
449 out voucher : ipc_voucher_t);
451 routine task_set_mach_voucher(
453 voucher : ipc_voucher_t);
455 routine task_swap_mach_voucher(
457 new_voucher : ipc_voucher_t;
458 inout old_voucher : ipc_voucher_t);
460 routine task_generate_corpse(
462 out corpse_task_port:mach_port_t);
464 routine task_map_corpse_info(
467 out kcd_addr_begin :vm_address_t;
468 out kcd_size :uint32_t);
470 routine task_register_dyld_image_infos(
472 dyld_images :dyld_kernel_image_info_array_t);
474 routine task_unregister_dyld_image_infos(
476 dyld_images :dyld_kernel_image_info_array_t);
478 routine task_get_dyld_image_infos(
479 task :task_inspect_t;
480 out dyld_images :dyld_kernel_image_info_array_t);
482 routine task_register_dyld_shared_cache_image_info(
484 dyld_cache_image :dyld_kernel_image_info_t;
486 private_cache :boolean_t);
488 routine task_register_dyld_set_dyld_state(
490 dyld_state :uint8_t);
492 routine task_register_dyld_get_process_state(
494 out dyld_process_state :dyld_kernel_process_info_t);
496 routine task_map_corpse_info_64(
499 out kcd_addr_begin :mach_vm_address_t;
500 out kcd_size :mach_vm_size_t);
502 routine task_inspect(
503 task : task_inspect_t;
504 flavor : task_inspect_flavor_t;
505 out info_out : task_inspect_info_t, CountInOut);
507 routine task_get_exc_guard_behavior(
508 task : task_inspect_t;
509 out behavior : task_exc_guard_behavior_t);
511 routine task_set_exc_guard_behavior(
513 behavior : task_exc_guard_behavior_t);
515 routine task_create_suid_cred(
517 path : suid_cred_path_t;
518 uid : suid_cred_uid_t;
519 out delegation : suid_cred_t);
521 /* vim: set ft=c : */