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>
75 #if !KERNEL && !LIBSYSCALL_INTERFACE
76 #define PREFIX(NAME) _kernelrpc_ ## NAME
78 #define PREFIX(NAME) NAME
82 * Create a new task with an empty set of IPC rights,
83 * and having an address space constructed from the
84 * target task (or empty, if inherit_memory is FALSE).
88 ledgers : ledger_array_t;
89 inherit_memory : boolean_t;
90 out child_task : task_t);
93 * Destroy the target task, causing all of its threads
94 * to be destroyed, all of its IPC rights to be deallocated,
95 * and all of its address space to be deallocated.
97 routine task_terminate(
98 target_task : task_t);
101 * Returns the set of threads belonging to the target task.
102 * [Polymorphic] This routine returns thread port with the same
103 * flavor as that of the task port passed in.
107 task_threads_from_user(
111 target_task : task_inspect_t;
113 out act_list : thread_act_array_t);
117 * Stash a handful of ports for the target task; child
118 * tasks inherit this stash at task_create time.
120 routine mach_ports_register(
121 target_task : task_t;
122 init_port_set : mach_port_array_t =
123 ^array[] of mach_port_t);
126 * Retrieve the stashed ports for the target task.
128 routine mach_ports_lookup(
129 target_task : task_t;
130 out init_port_set : mach_port_array_t =
131 ^array[] of mach_port_t);
134 * Returns information about the target task.
137 routine task_info_from_user(
138 target_task : mach_port_t;
139 flavor : task_flavor_t;
140 out task_info_out : task_info_t, CountInOut);
143 target_task : task_name_t;
144 flavor : task_flavor_t;
145 out task_info_out : task_info_t, CountInOut);
149 * Set task information.
151 routine task_set_info(
152 target_task : task_t;
153 flavor : task_flavor_t;
154 task_info_in : task_info_t);
157 * Increment the suspend count for the target task.
158 * No threads within a task may run when the suspend
159 * count for that task is non-zero.
161 routine task_suspend(
162 target_task : task_read_t);
166 * Decrement the suspend count for the target task,
167 * if the count is currently non-zero. If the resulting
168 * suspend count is zero, then threads within the task
169 * that also have non-zero suspend counts may execute.
172 target_task : task_read_t);
175 * Returns the current value of the selected special port
176 * associated with the target task.
180 task_get_special_port_from_user(
183 task_get_special_port(
184 task : task_inspect_t;
187 out special_port : mach_port_t);
191 * Set one of the special ports associated with the
194 routine task_set_special_port(
197 special_port : mach_port_t);
200 * Create a new thread within the target task, returning
201 * the port representing the first thr_act in that new thread. The
202 * initial execution state of the thread is undefined.
206 thread_create_from_user(
210 parent_task : task_t;
211 out child_act : thread_act_t);
214 * Create a new thread within the target task, returning
215 * the port representing that new thread. The new thread
216 * is not suspended; its initial execution state is given
217 * by flavor and new_state. Returns the port representing
222 thread_create_running_from_user(
224 thread_create_running(
226 parent_task : task_t;
227 flavor : thread_state_flavor_t;
228 new_state : thread_state_t;
229 out child_act : thread_act_t);
232 * Set an exception handler for a task on one or more exception types.
233 * These handlers are invoked for all threads in the task if there are
234 * no thread-specific exception handlers or those handlers returned an
237 routine task_set_exception_ports(
239 exception_mask : exception_mask_t;
240 new_port : mach_port_t;
241 behavior : exception_behavior_t;
242 new_flavor : thread_state_flavor_t);
246 * Lookup some of the old exception handlers for a task
250 task_get_exception_ports_from_user(
253 task_get_exception_ports(
256 exception_mask : exception_mask_t;
257 out masks : exception_mask_array_t;
258 out old_handlers : exception_handler_array_t, SameCount;
259 out old_behaviors : exception_behavior_array_t, SameCount;
260 out old_flavors : exception_flavor_array_t, SameCount);
264 * Set an exception handler for a thread on one or more exception types.
265 * At the same time, return the previously defined exception handlers for
268 routine task_swap_exception_ports(
270 exception_mask : exception_mask_t;
271 new_port : mach_port_t;
272 behavior : exception_behavior_t;
273 new_flavor : thread_state_flavor_t;
274 out masks : exception_mask_array_t;
275 out old_handlers : exception_handler_array_t, SameCount;
276 out old_behaviors : exception_behavior_array_t, SameCount;
277 out old_flavors : exception_flavor_array_t, SameCount);
280 * OBSOLETE interface.
282 routine lock_set_create(
284 out new_lock_set : lock_set_t;
289 * OBSOLETE interface.
291 routine lock_set_destroy(
293 lock_set : lock_set_t);
296 * Create and destroy semaphore synchronizers on a
297 * per-task basis (i.e. the task owns them).
300 routine semaphore_create(
302 out semaphore : semaphore_t;
306 routine semaphore_destroy(
308 semaphore : semaphore_consume_ref_t);
311 * Set/get policy information for a task.
312 * (Approved Mac OS X microkernel interface)
315 routine task_policy_set(
316 task : task_policy_set_t;
317 flavor : task_policy_flavor_t;
318 policy_info : task_policy_t);
320 routine task_policy_get(
321 task : task_policy_get_t;
322 flavor : task_policy_flavor_t;
323 out policy_info : task_policy_t, CountInOut;
324 inout get_default : boolean_t);
327 * Removed from the kernel.
334 reply : mach_port_make_send_t);
338 * JMM - Everything from here down is likely to go away soon
341 * OBSOLETE interface.
346 base : policy_base_t;
347 set_limit : boolean_t;
352 * Establish a user-level handler for the specified
355 routine task_set_emulation(
356 target_port : task_t;
357 routine_entry_pt: vm_address_t;
358 routine_number : int);
361 * Get user-level handler entry points for all
362 * emulated system calls.
364 routine task_get_emulation_vector(
366 out vector_start : int;
367 out emulation_vector: emulation_vector_t);
370 * Establish user-level handlers for the specified
371 * system calls. Non-emulated system calls are specified
372 * with emulation_vector[i] == EML_ROUTINE_NULL.
374 routine task_set_emulation_vector(
377 emulation_vector: emulation_vector_t);
381 * Establish restart pc for interrupted atomic sequences.
383 routine task_set_ras_pc(
384 target_task : task_t;
385 basepc : vm_address_t;
386 boundspc : vm_address_t);
390 * Return zone info as seen/used by this task.
392 routine task_zone_info(
393 target_task : task_inspect_t;
394 out names : mach_zone_name_array_t,
396 out info : task_zone_info_array_t,
401 * JMM - Want to eliminate processor_set so keep them at the end.
405 * Assign task to processor set.
409 new_set : processor_set_t;
410 assign_threads : boolean_t);
413 * Assign task to default set.
415 routine task_assign_default(
417 assign_threads : boolean_t);
420 * Get current assignment for task.
422 routine task_get_assignment(
423 task : task_inspect_t;
424 out assigned_set : processor_set_name_t);
427 * OBSOLETE interface.
429 routine task_set_policy(
431 pset : processor_set_t;
433 base : policy_base_t;
434 limit : policy_limit_t;
438 * Read the selected state which is to be installed on new
439 * threads in the task as they are created.
441 routine task_get_state(
443 flavor : thread_state_flavor_t;
444 out old_state : thread_state_t, CountInOut);
447 * Set the selected state information to be installed on
448 * all subsequently created threads in the task.
450 routine task_set_state(
452 flavor : thread_state_flavor_t;
453 new_state : thread_state_t);
456 * Change the task's physical footprint limit (in MB).
458 routine task_set_phys_footprint_limit(
461 out old_limit : int);
463 routine task_suspend2(
464 target_task : task_read_t;
465 out suspend_token : task_suspension_token_t);
467 routine task_resume2(
468 suspend_token : task_suspension_token_t);
470 routine task_purgable_info(
471 task : task_inspect_t;
472 out stats : task_purgable_info_t);
474 routine task_get_mach_voucher(
476 which : mach_voucher_selector_t;
477 out voucher : ipc_voucher_t);
479 routine task_set_mach_voucher(
481 voucher : ipc_voucher_t);
483 routine task_swap_mach_voucher(
485 new_voucher : ipc_voucher_t;
486 inout old_voucher : ipc_voucher_t);
488 routine task_generate_corpse(
490 out corpse_task_port:mach_port_t);
492 routine task_map_corpse_info(
494 corspe_task :task_read_t;
495 out kcd_addr_begin :vm_address_t;
496 out kcd_size :uint32_t);
498 routine task_register_dyld_image_infos(
500 dyld_images :dyld_kernel_image_info_array_t);
502 routine task_unregister_dyld_image_infos(
504 dyld_images :dyld_kernel_image_info_array_t);
506 routine task_get_dyld_image_infos(
508 out dyld_images :dyld_kernel_image_info_array_t);
510 routine task_register_dyld_shared_cache_image_info(
512 dyld_cache_image :dyld_kernel_image_info_t;
514 private_cache :boolean_t);
516 routine task_register_dyld_set_dyld_state(
518 dyld_state :uint8_t);
520 routine task_register_dyld_get_process_state(
522 out dyld_process_state :dyld_kernel_process_info_t);
524 routine task_map_corpse_info_64(
526 corspe_task :task_read_t;
527 out kcd_addr_begin :mach_vm_address_t;
528 out kcd_size :mach_vm_size_t);
530 routine task_inspect(
531 task : task_inspect_t;
532 flavor : task_inspect_flavor_t;
533 out info_out : task_inspect_info_t, CountInOut);
535 routine task_get_exc_guard_behavior(
536 task : task_inspect_t;
537 out behavior : task_exc_guard_behavior_t);
539 routine task_set_exc_guard_behavior(
541 behavior : task_exc_guard_behavior_t);
543 routine task_create_suid_cred(
545 path : suid_cred_path_t;
546 uid : suid_cred_uid_t;
547 out delegation : suid_cred_t);
549 #if KERNEL || (!KERNEL && !LIBSYSCALL_INTERFACE)
550 routine PREFIX(mach_task_is_self)(
552 out is_self : boolean_t);
554 /* Do not generate header, use the one in mach_init.h */
558 routine task_dyld_process_info_notify_register(
559 target_task : task_read_t;
560 notify : mach_port_make_send_t);
562 routine task_create_identity_token(
564 out token : task_id_token_t);
566 routine task_identity_token_get_task_port(
567 token : task_id_token_t;
568 flavor : task_flavor_t;
569 out task_port: mach_port_t);
571 routine task_dyld_process_info_notify_deregister(
572 target_task : task_read_t;
573 notify : mach_port_name_t);
575 routine task_get_exception_ports_info(
577 exception_mask : exception_mask_t;
578 out masks : exception_mask_array_t;
579 out old_handlers_info : exception_handler_info_array_t, SameCount;
580 out old_behaviors : exception_behavior_array_t, SameCount;
581 out old_flavors : exception_flavor_array_t, SameCount);
583 /* vim: set ft=c : */