]> git.saurik.com Git - apple/xnu.git/blob - osfmk/kern/task.h
xnu-7195.101.1.tar.gz
[apple/xnu.git] / osfmk / kern / task.h
1 /*
2 * Copyright (c) 2000-2019 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
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.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
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.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28 /*
29 * @OSF_FREE_COPYRIGHT@
30 */
31 /*
32 * Mach Operating System
33 * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
34 * All Rights Reserved.
35 *
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.
41 *
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.
45 *
46 * Carnegie Mellon requests users of this software to return to
47 *
48 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
49 * School of Computer Science
50 * Carnegie Mellon University
51 * Pittsburgh PA 15213-3890
52 *
53 * any improvements or extensions that they make and grant Carnegie Mellon
54 * the rights to redistribute these changes.
55 */
56 /*
57 */
58 /*
59 * File: task.h
60 * Author: Avadis Tevanian, Jr.
61 *
62 * This file contains the structure definitions for tasks.
63 *
64 */
65 /*
66 * Copyright (c) 1993 The University of Utah and
67 * the Computer Systems Laboratory (CSL). All rights reserved.
68 *
69 * Permission to use, copy, modify and distribute this software and its
70 * documentation is hereby granted, provided that both the copyright
71 * notice and this permission notice appear in all copies of the
72 * software, derivative works or modified versions, and any portions
73 * thereof, and that both notices appear in supporting documentation.
74 *
75 * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
76 * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
77 * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
78 *
79 * CSL requests users of this software to return to csl-dist@cs.utah.edu any
80 * improvements that they make and grant CSL redistribution rights.
81 *
82 */
83 /*
84 * NOTICE: This file was modified by McAfee Research in 2004 to introduce
85 * support for mandatory and extensible security protections. This notice
86 * is included in support of clause 2.2 (b) of the Apple Public License,
87 * Version 2.0.
88 * Copyright (c) 2005 SPARTA, Inc.
89 */
90
91 #ifndef _KERN_TASK_H_
92 #define _KERN_TASK_H_
93
94 #include <kern/kern_types.h>
95 #include <mach/mach_types.h>
96 #include <sys/cdefs.h>
97
98 #ifdef XNU_KERNEL_PRIVATE
99 #include <kern/kern_cdata.h>
100 #include <mach/sfi_class.h>
101 #include <kern/counter.h>
102 #include <kern/queue.h>
103 #include <sys/kern_sysctl.h>
104 #endif /* XNU_KERNEL_PRIVATE */
105
106 #ifdef MACH_KERNEL_PRIVATE
107
108 #include <mach/boolean.h>
109 #include <mach/port.h>
110 #include <mach/time_value.h>
111 #include <mach/message.h>
112 #include <mach/mach_param.h>
113 #include <mach/task_info.h>
114 #include <mach/exception_types.h>
115 #include <mach/vm_statistics.h>
116 #include <machine/task.h>
117
118 #if MONOTONIC
119 #include <machine/monotonic.h>
120 #endif /* MONOTONIC */
121
122 #include <kern/cpu_data.h>
123 #include <kern/queue.h>
124 #include <kern/exception.h>
125 #include <kern/locks.h>
126 #include <security/_label.h>
127 #include <ipc/ipc_port.h>
128
129 #include <kern/thread.h>
130 #include <mach/coalition.h>
131 #include <stdatomic.h>
132 #include <os/refcnt.h>
133
134 struct _cpu_time_qos_stats {
135 uint64_t cpu_time_qos_default;
136 uint64_t cpu_time_qos_maintenance;
137 uint64_t cpu_time_qos_background;
138 uint64_t cpu_time_qos_utility;
139 uint64_t cpu_time_qos_legacy;
140 uint64_t cpu_time_qos_user_initiated;
141 uint64_t cpu_time_qos_user_interactive;
142 };
143
144 struct task_writes_counters {
145 uint64_t task_immediate_writes;
146 uint64_t task_deferred_writes;
147 uint64_t task_invalidated_writes;
148 uint64_t task_metadata_writes;
149 };
150
151 struct task_watchports;
152 #include <bank/bank_internal.h>
153
154 struct task {
155 /* Synchronization/destruction information */
156 decl_lck_mtx_data(, lock); /* Task's lock */
157 os_refcnt_t ref_count; /* Number of references to me */
158 bool active; /* Task has not been terminated */
159 bool ipc_active; /* IPC with the task ports is allowed */
160 bool halting; /* Task is being halted */
161 bool message_app_suspended; /* Let iokit know when pidsuspended */
162
163 /* Virtual timers */
164 uint32_t vtimers;
165
166 /* Miscellaneous */
167 vm_map_t XNU_PTRAUTH_SIGNED_PTR("task.map") map; /* Address space description */
168 queue_chain_t tasks; /* global list of tasks */
169 struct task_watchports *watchports; /* watchports passed in spawn */
170 turnstile_inheritor_t returnwait_inheritor; /* inheritor for task_wait */
171
172 #if defined(CONFIG_SCHED_MULTIQ)
173 sched_group_t sched_group;
174 #endif /* defined(CONFIG_SCHED_MULTIQ) */
175
176 /* Threads in this task */
177 queue_head_t threads;
178 struct restartable_ranges *restartable_ranges;
179
180 processor_set_t pset_hint;
181 struct affinity_space *affinity_space;
182
183 int thread_count;
184 uint32_t active_thread_count;
185 int suspend_count; /* Internal scheduling only */
186
187 /* User-visible scheduling information */
188 integer_t user_stop_count; /* outstanding stops */
189 integer_t legacy_stop_count; /* outstanding legacy stops */
190
191 int16_t priority; /* base priority for threads */
192 int16_t max_priority; /* maximum priority for threads */
193
194 integer_t importance; /* priority offset (BSD 'nice' value) */
195
196 /* Task security and audit tokens */
197 security_token_t sec_token;
198 audit_token_t audit_token;
199
200 /* Statistics */
201 uint64_t total_user_time; /* terminated threads only */
202 uint64_t total_system_time;
203 uint64_t total_ptime;
204 uint64_t total_runnable_time;
205
206 /* IPC structures */
207 decl_lck_mtx_data(, itk_lock_data);
208 /*
209 * Different flavors of task port.
210 * These flavors TASK_FLAVOR_* are defined in mach_types.h
211 */
212 struct ipc_port * XNU_PTRAUTH_SIGNED_PTR("task.itk_task_ports") itk_task_ports[TASK_SELF_PORT_COUNT];
213 struct ipc_port * XNU_PTRAUTH_SIGNED_PTR("task.itk_settable_self") itk_settable_self; /* a send right */
214 struct ipc_port * XNU_PTRAUTH_SIGNED_PTR("task.itk_self") itk_self; /* immovable/pinned task port, does not hold right */
215 struct exception_action exc_actions[EXC_TYPES_COUNT];
216 /* a send right each valid element */
217 struct ipc_port * XNU_PTRAUTH_SIGNED_PTR("task.itk_host") itk_host; /* a send right */
218 struct ipc_port * XNU_PTRAUTH_SIGNED_PTR("task.itk_bootstrap") itk_bootstrap; /* a send right */
219 struct ipc_port * XNU_PTRAUTH_SIGNED_PTR("task.itk_seatbelt") itk_seatbelt; /* a send right */
220 struct ipc_port * XNU_PTRAUTH_SIGNED_PTR("task.itk_gssd") itk_gssd; /* yet another send right */
221 struct ipc_port * XNU_PTRAUTH_SIGNED_PTR("task.itk_debug_control") itk_debug_control; /* send right for debugmode communications */
222 struct ipc_port * XNU_PTRAUTH_SIGNED_PTR("task.itk_task_access") itk_task_access; /* and another send right */
223 struct ipc_port * XNU_PTRAUTH_SIGNED_PTR("task.itk_resume") itk_resume; /* a receive right to resume this task */
224 struct ipc_port * XNU_PTRAUTH_SIGNED_PTR("task.itk_registered") itk_registered[TASK_PORT_REGISTER_MAX];
225 /* all send rights */
226 ipc_port_t * XNU_PTRAUTH_SIGNED_PTR("task.itk_dyld_notify") itk_dyld_notify; /* lazy send rights array of size DYLD_MAX_PROCESS_INFO_NOTIFY_COUNT */
227
228 struct ipc_space * XNU_PTRAUTH_SIGNED_PTR("task.itk_space") itk_space;
229
230 ledger_t ledger;
231 /* Synchronizer ownership information */
232 queue_head_t semaphore_list; /* list of owned semaphores */
233 int semaphores_owned; /* number of semaphores owned */
234
235 unsigned int priv_flags; /* privilege resource flags */
236 #define VM_BACKING_STORE_PRIV 0x1
237
238 MACHINE_TASK
239
240 counter_t faults; /* faults counter */
241 integer_t decompressions; /* decompression counter */
242 integer_t pageins; /* pageins counter */
243 integer_t cow_faults; /* copy on write fault counter */
244 integer_t messages_sent; /* messages sent counter */
245 integer_t messages_received; /* messages received counter */
246 integer_t syscalls_mach; /* mach system call counter */
247 integer_t syscalls_unix; /* unix system call counter */
248 uint32_t c_switch; /* total context switches */
249 uint32_t p_switch; /* total processor switches */
250 uint32_t ps_switch; /* total pset switches */
251
252 #ifdef MACH_BSD
253 void * XNU_PTRAUTH_SIGNED_PTR("task.bsd_info") bsd_info;
254 #endif
255 kcdata_descriptor_t corpse_info;
256 uint64_t crashed_thread_id;
257 queue_chain_t corpse_tasks;
258 #ifdef CONFIG_MACF
259 struct label * crash_label;
260 uint8_t * mach_trap_filter_mask; /* Mach trap filter bitmask (len: mach_trap_count bits) */
261 uint8_t * mach_kobj_filter_mask; /* Mach kobject filter bitmask (len: mach_kobj_count bits) */
262 #endif
263 struct vm_shared_region *shared_region;
264 #if __has_feature(ptrauth_calls)
265 char *shared_region_id; /* determines which ptr auth key to use */
266 bool shared_region_auth_remapped; /* authenticated sections ready for use */
267 #endif /* __has_feature(ptrauth_calls) */
268 volatile uint32_t t_flags; /* general-purpose task flags protected by task_lock (TL) */
269 #define TF_NONE 0
270 #define TF_64B_ADDR 0x00000001 /* task has 64-bit addressing */
271 #define TF_64B_DATA 0x00000002 /* task has 64-bit data registers */
272 #define TF_CPUMON_WARNING 0x00000004 /* task has at least one thread in CPU usage warning zone */
273 #define TF_WAKEMON_WARNING 0x00000008 /* task is in wakeups monitor warning zone */
274 #define TF_TELEMETRY (TF_CPUMON_WARNING | TF_WAKEMON_WARNING) /* task is a telemetry participant */
275 #define TF_GPU_DENIED 0x00000010 /* task is not allowed to access the GPU */
276 #define TF_CORPSE 0x00000020 /* task is a corpse */
277 #define TF_PENDING_CORPSE 0x00000040 /* task corpse has not been reported yet */
278 #define TF_CORPSE_FORK 0x00000080 /* task is a forked corpse */
279 #define TF_PLATFORM 0x00000400 /* task is a platform binary */
280 #define TF_CA_CLIENT_WI 0x00000800 /* task has CA_CLIENT work interval */
281 #define TF_DARKWAKE_MODE 0x00001000 /* task is in darkwake mode */
282 #define TF_NO_SMT 0x00002000 /* task threads must not be paired with SMT threads */
283 #define TF_FILTER_MSG 0x00004000 /* task calls into message filter callback before sending a message */
284 #define TF_SYS_VERSION_COMPAT 0x00008000 /* shim task accesses to OS version data (macOS - app compatibility) */
285 #define TF_PAC_EXC_FATAL 0x00010000 /* task is marked a corpse if a PAC exception occurs */
286 #define TF_TECS 0x00020000 /* task threads must enable CPU security */
287
288 /*
289 * Task is running within a 64-bit address space.
290 */
291 #define task_has_64Bit_addr(task) \
292 (((task)->t_flags & TF_64B_ADDR) != 0)
293 #define task_set_64Bit_addr(task) \
294 ((task)->t_flags |= TF_64B_ADDR)
295 #define task_clear_64Bit_addr(task) \
296 ((task)->t_flags &= ~TF_64B_ADDR)
297
298 /*
299 * Task is using 64-bit machine state.
300 */
301 #define task_has_64Bit_data(task) \
302 (((task)->t_flags & TF_64B_DATA) != 0)
303 #define task_set_64Bit_data(task) \
304 ((task)->t_flags |= TF_64B_DATA)
305 #define task_clear_64Bit_data(task) \
306 ((task)->t_flags &= ~TF_64B_DATA)
307
308 #define task_is_a_corpse(task) \
309 (((task)->t_flags & TF_CORPSE) != 0)
310
311 #define task_set_corpse(task) \
312 ((task)->t_flags |= TF_CORPSE)
313
314 #define task_corpse_pending_report(task) \
315 (((task)->t_flags & TF_PENDING_CORPSE) != 0)
316
317 #define task_set_corpse_pending_report(task) \
318 ((task)->t_flags |= TF_PENDING_CORPSE)
319
320 #define task_clear_corpse_pending_report(task) \
321 ((task)->t_flags &= ~TF_PENDING_CORPSE)
322
323 #define task_is_a_corpse_fork(task) \
324 (((task)->t_flags & TF_CORPSE_FORK) != 0)
325
326 uint32_t t_procflags; /* general-purpose task flags protected by proc_lock (PL) */
327 #define TPF_NONE 0
328 #define TPF_DID_EXEC 0x00000001 /* task has been execed to a new task */
329 #define TPF_EXEC_COPY 0x00000002 /* task is the new copy of an exec */
330 #ifdef CONFIG_32BIT_TELEMETRY
331 #define TPF_LOG_32BIT_TELEMETRY 0x00000004 /* task should log identifying information */
332 #endif
333
334 #define task_did_exec_internal(task) \
335 (((task)->t_procflags & TPF_DID_EXEC) != 0)
336
337 #define task_is_exec_copy_internal(task) \
338 (((task)->t_procflags & TPF_EXEC_COPY) != 0)
339
340 uint8_t t_returnwaitflags;
341 #define TWF_NONE 0
342 #define TRW_LRETURNWAIT 0x01 /* task is waiting for fork/posix_spawn/exec to complete */
343 #define TRW_LRETURNWAITER 0x02 /* task is waiting for TRW_LRETURNWAIT to get cleared */
344
345 mach_vm_address_t all_image_info_addr; /* dyld __all_image_info */
346 mach_vm_size_t all_image_info_size; /* section location and size */
347
348 #if KPC
349 #define TASK_KPC_FORCED_ALL_CTRS 0x2 /* Bit in "t_kpc" signifying this task forced all counters */
350 uint32_t t_kpc; /* kpc flags */
351 #endif /* KPC */
352
353 boolean_t pidsuspended; /* pid_suspend called; no threads can execute */
354 boolean_t frozen; /* frozen; private resident pages committed to swap */
355 boolean_t changing_freeze_state; /* in the process of freezing or thawing */
356 uint16_t policy_ru_cpu :4,
357 policy_ru_cpu_ext :4,
358 applied_ru_cpu :4,
359 applied_ru_cpu_ext :4;
360 uint8_t rusage_cpu_flags;
361 uint8_t rusage_cpu_percentage; /* Task-wide CPU limit percentage */
362 uint8_t rusage_cpu_perthr_percentage; /* Per-thread CPU limit percentage */
363 #if MACH_ASSERT
364 int8_t suspends_outstanding; /* suspends this task performed in excess of resumes */
365 #endif
366 uint64_t rusage_cpu_interval; /* Task-wide CPU limit interval */
367 uint64_t rusage_cpu_perthr_interval; /* Per-thread CPU limit interval */
368 uint64_t rusage_cpu_deadline;
369 thread_call_t rusage_cpu_callt;
370 #if CONFIG_TASKWATCH
371 queue_head_t task_watchers; /* app state watcher threads */
372 int num_taskwatchers;
373 int watchapplying;
374 #endif /* CONFIG_TASKWATCH */
375
376 struct bank_task *bank_context; /* pointer to per task bank structure */
377
378 #if IMPORTANCE_INHERITANCE
379 struct ipc_importance_task *task_imp_base; /* Base of IPC importance chain */
380 #endif /* IMPORTANCE_INHERITANCE */
381
382 vm_extmod_statistics_data_t extmod_statistics;
383
384 struct task_requested_policy requested_policy;
385 struct task_effective_policy effective_policy;
386
387 /*
388 * Can be merged with imp_donor bits, once the IMPORTANCE_INHERITANCE macro goes away.
389 */
390 uint32_t low_mem_notified_warn :1, /* warning low memory notification is sent to the task */
391 low_mem_notified_critical :1, /* critical low memory notification is sent to the task */
392 purged_memory_warn :1, /* purgeable memory of the task is purged for warning level pressure */
393 purged_memory_critical :1, /* purgeable memory of the task is purged for critical level pressure */
394 low_mem_privileged_listener :1, /* if set, task would like to know about pressure changes before other tasks on the system */
395 mem_notify_reserved :27; /* reserved for future use */
396
397 uint32_t memlimit_is_active :1, /* if set, use active attributes, otherwise use inactive attributes */
398 memlimit_is_fatal :1, /* if set, exceeding current memlimit will prove fatal to the task */
399 memlimit_active_exc_resource :1, /* if set, suppress exc_resource exception when task exceeds active memory limit */
400 memlimit_inactive_exc_resource :1, /* if set, suppress exc_resource exception when task exceeds inactive memory limit */
401 memlimit_attrs_reserved :28; /* reserved for future use */
402
403 io_stat_info_t task_io_stats;
404
405 struct task_writes_counters task_writes_counters_internal;
406 struct task_writes_counters task_writes_counters_external;
407
408 /*
409 * The cpu_time_qos_stats fields are protected by the task lock
410 */
411 struct _cpu_time_qos_stats cpu_time_eqos_stats;
412 struct _cpu_time_qos_stats cpu_time_rqos_stats;
413
414 /* Statistics accumulated for terminated threads from this task */
415 uint32_t task_timer_wakeups_bin_1;
416 uint32_t task_timer_wakeups_bin_2;
417 uint64_t task_gpu_ns;
418 uint64_t task_energy;
419
420 #if MONOTONIC
421 /* Read and written under task_lock */
422 struct mt_task task_monotonic;
423 #endif /* MONOTONIC */
424
425 uint8_t task_can_transfer_memory_ownership;
426 uint8_t task_objects_disowning;
427 uint8_t task_objects_disowned;
428 /* # of purgeable volatile VM objects owned by this task: */
429 int task_volatile_objects;
430 /* # of purgeable but not volatile VM objects owned by this task: */
431 int task_nonvolatile_objects;
432 int task_owned_objects;
433 queue_head_t task_objq;
434 decl_lck_mtx_data(, task_objq_lock); /* protects "task_objq" */
435
436 unsigned int task_thread_limit:16;
437 #if __arm64__
438 unsigned int task_legacy_footprint:1;
439 unsigned int task_extra_footprint_limit:1;
440 unsigned int task_ios13extended_footprint_limit:1;
441 #endif /* __arm64__ */
442 unsigned int task_region_footprint:1;
443 unsigned int task_has_crossed_thread_limit:1;
444 uint32_t exec_token;
445 /*
446 * A task's coalition set is "adopted" in task_create_internal
447 * and unset in task_deallocate_internal, so each array member
448 * can be referenced without the task lock.
449 * Note: these fields are protected by coalition->lock,
450 * not the task lock.
451 */
452 coalition_t coalition[COALITION_NUM_TYPES];
453 queue_chain_t task_coalition[COALITION_NUM_TYPES];
454 uint64_t dispatchqueue_offset;
455
456 #if DEVELOPMENT || DEBUG
457 boolean_t task_unnested;
458 int task_disconnected_count;
459 #endif
460
461 #if HYPERVISOR
462 void * XNU_PTRAUTH_SIGNED_PTR("task.hv_task_target") hv_task_target; /* hypervisor virtual machine object associated with this task */
463 #endif /* HYPERVISOR */
464
465 #if CONFIG_SECLUDED_MEMORY
466 uint8_t task_can_use_secluded_mem;
467 uint8_t task_could_use_secluded_mem;
468 uint8_t task_could_also_use_secluded_mem;
469 uint8_t task_suppressed_secluded;
470 #endif /* CONFIG_SECLUDED_MEMORY */
471
472 task_exc_guard_behavior_t task_exc_guard;
473
474 queue_head_t io_user_clients;
475
476 mach_vm_address_t mach_header_vm_address;
477
478 uint32_t loadTag; /* dext ID used for logging identity */
479 #if CONFIG_FREEZE
480 queue_head_t task_frozen_cseg_q; /* queue of csegs frozen to NAND */
481 #endif /* CONFIG_FREEZE */
482 #if CONFIG_PHYS_WRITE_ACCT
483 uint64_t task_fs_metadata_writes;
484 #endif /* CONFIG_PHYS_WRITE_ACCT */
485 uint32_t task_shared_region_slide; /* cached here to avoid locking during telemetry */
486 uuid_t task_shared_region_uuid;
487 };
488
489 /*
490 * EXC_GUARD default delivery behavior for optional Mach port and VM guards.
491 * Applied to new tasks at creation time.
492 */
493 extern task_exc_guard_behavior_t task_exc_guard_default;
494
495 extern kern_return_t
496 task_violated_guard(mach_exception_code_t, mach_exception_subcode_t, void *);
497
498 static inline void
499 task_require(struct task *task)
500 {
501 zone_id_require(ZONE_ID_TASK, sizeof(struct task), task);
502 }
503
504 #define task_lock(task) lck_mtx_lock(&(task)->lock)
505 #define task_lock_assert_owned(task) LCK_MTX_ASSERT(&(task)->lock, LCK_MTX_ASSERT_OWNED)
506 #define task_lock_try(task) lck_mtx_try_lock(&(task)->lock)
507 #define task_unlock(task) lck_mtx_unlock(&(task)->lock)
508
509 #define task_objq_lock_init(task) lck_mtx_init(&(task)->task_objq_lock, &vm_object_lck_grp, &vm_object_lck_attr)
510 #define task_objq_lock_destroy(task) lck_mtx_destroy(&(task)->task_objq_lock, &vm_object_lck_grp)
511 #define task_objq_lock(task) lck_mtx_lock(&(task)->task_objq_lock)
512 #define task_objq_lock_assert_owned(task) LCK_MTX_ASSERT(&(task)->task_objq_lock, LCK_MTX_ASSERT_OWNED)
513 #define task_objq_lock_try(task) lck_mtx_try_lock(&(task)->task_objq_lock)
514 #define task_objq_unlock(task) lck_mtx_unlock(&(task)->task_objq_lock)
515
516 #define itk_lock_init(task) lck_mtx_init(&(task)->itk_lock_data, &ipc_lck_grp, &ipc_lck_attr)
517 #define itk_lock_destroy(task) lck_mtx_destroy(&(task)->itk_lock_data, &ipc_lck_grp)
518 #define itk_lock(task) lck_mtx_lock(&(task)->itk_lock_data)
519 #define itk_unlock(task) lck_mtx_unlock(&(task)->itk_lock_data)
520
521 /* task clear return wait flags */
522 #define TCRW_CLEAR_INITIAL_WAIT 0x1
523 #define TCRW_CLEAR_FINAL_WAIT 0x2
524 #define TCRW_CLEAR_ALL_WAIT (TCRW_CLEAR_INITIAL_WAIT | TCRW_CLEAR_FINAL_WAIT)
525
526 #define TASK_REFERENCE_LEAK_DEBUG 0
527
528 #if TASK_REFERENCE_LEAK_DEBUG
529 extern void task_reference_internal(task_t task);
530 extern os_ref_count_t task_deallocate_internal(task_t task);
531 #else
532 #define task_reference_internal(task) \
533 MACRO_BEGIN \
534 task_require(task); \
535 os_ref_retain(&(task)->ref_count); \
536 MACRO_END
537 #define task_deallocate_internal(task) os_ref_release(&(task)->ref_count)
538 #endif
539
540 #define task_reference(task) \
541 MACRO_BEGIN \
542 if ((task) != TASK_NULL) \
543 task_reference_internal(task); \
544 MACRO_END
545
546 extern kern_return_t kernel_task_create(
547 task_t task,
548 vm_offset_t map_base,
549 vm_size_t map_size,
550 task_t *child);
551
552 /* Initialize task module */
553 extern void task_init(void);
554
555 /* coalition_init() calls this to initialize ledgers before task_init() */
556 extern void init_task_ledgers(void);
557
558 #define current_task_fast() (current_thread()->task)
559 #define current_task() current_task_fast()
560
561 extern bool task_is_driver(task_t task);
562
563 extern lck_attr_t task_lck_attr;
564 extern lck_grp_t task_lck_grp;
565
566 struct task_watchport_elem {
567 task_t twe_task;
568 ipc_port_t twe_port; /* (Space lock) */
569 };
570
571 struct task_watchports {
572 os_refcnt_t tw_refcount; /* (Space lock) */
573 task_t tw_task; /* (Space lock) & tw_refcount == 0 */
574 thread_t tw_thread; /* (Space lock) & tw_refcount == 0 */
575 uint32_t tw_elem_array_count; /* (Space lock) */
576 struct task_watchport_elem tw_elem[]; /* (Space lock) & (Portlock) & (mq lock) */
577 };
578
579 #define task_watchports_retain(x) (os_ref_retain(&(x)->tw_refcount))
580 #define task_watchports_release(x) (os_ref_release(&(x)->tw_refcount))
581
582 #define task_watchport_elem_init(elem, task, port) \
583 do { \
584 (elem)->twe_task = (task); \
585 (elem)->twe_port = (port); \
586 } while(0)
587
588 #define task_watchport_elem_clear(elem) task_watchport_elem_init((elem), NULL, NULL)
589
590 extern void
591 task_add_turnstile_watchports(
592 task_t task,
593 thread_t thread,
594 ipc_port_t *portwatch_ports,
595 uint32_t portwatch_count);
596
597 extern void
598 task_watchport_elem_deallocate(
599 struct task_watchport_elem *watchport_elem);
600
601 extern boolean_t
602 task_has_watchports(task_t task);
603
604 void
605 task_dyld_process_info_update_helper(
606 task_t task,
607 size_t active_count,
608 vm_map_address_t magic_addr,
609 ipc_port_t *release_ports,
610 size_t release_count);
611
612 #else /* MACH_KERNEL_PRIVATE */
613
614 __BEGIN_DECLS
615
616 extern task_t current_task(void);
617
618 extern void task_reference(task_t task);
619 extern bool task_is_driver(task_t task);
620
621 #define TF_NONE 0
622
623 #define TWF_NONE 0
624 #define TRW_LRETURNWAIT 0x01 /* task is waiting for fork/posix_spawn/exec to complete */
625 #define TRW_LRETURNWAITER 0x02 /* task is waiting for TRW_LRETURNWAIT to get cleared */
626
627 /* task clear return wait flags */
628 #define TCRW_CLEAR_INITIAL_WAIT 0x1
629 #define TCRW_CLEAR_FINAL_WAIT 0x2
630 #define TCRW_CLEAR_ALL_WAIT (TCRW_CLEAR_INITIAL_WAIT | TCRW_CLEAR_FINAL_WAIT)
631
632
633 #define TPF_NONE 0
634 #define TPF_EXEC_COPY 0x00000002 /* task is the new copy of an exec */
635
636
637 __END_DECLS
638
639 #endif /* MACH_KERNEL_PRIVATE */
640
641 __BEGIN_DECLS
642
643 #ifdef KERNEL_PRIVATE
644 extern boolean_t task_is_app_suspended(task_t task);
645 extern bool task_is_exotic(task_t task);
646 extern bool task_is_alien(task_t task);
647 #endif
648
649 #ifdef XNU_KERNEL_PRIVATE
650
651 /* Hold all threads in a task */
652 extern kern_return_t task_hold(
653 task_t task);
654
655 /* Wait for task to stop running, either just to get off CPU or to cease being runnable */
656 extern kern_return_t task_wait(
657 task_t task,
658 boolean_t until_not_runnable);
659
660 /* Release hold on all threads in a task */
661 extern kern_return_t task_release(
662 task_t task);
663
664 /* Suspend/resume a task where the kernel owns the suspend count */
665 extern kern_return_t task_suspend_internal( task_t task);
666 extern kern_return_t task_resume_internal( task_t task);
667
668 /* Suspends a task by placing a hold on its threads */
669 extern kern_return_t task_pidsuspend(
670 task_t task);
671
672 /* Resumes a previously paused task */
673 extern kern_return_t task_pidresume(
674 task_t task);
675
676 extern kern_return_t task_send_trace_memory(
677 task_t task,
678 uint32_t pid,
679 uint64_t uniqueid);
680
681 extern void task_remove_turnstile_watchports(
682 task_t task);
683
684 extern void task_transfer_turnstile_watchports(
685 task_t old_task,
686 task_t new_task,
687 thread_t new_thread);
688
689 #if DEVELOPMENT || DEBUG
690
691 extern kern_return_t task_disconnect_page_mappings(
692 task_t task);
693 #endif
694
695 extern void tasks_system_suspend(boolean_t suspend);
696
697 #if CONFIG_FREEZE
698
699 /* Freeze a task's resident pages */
700 extern kern_return_t task_freeze(
701 task_t task,
702 uint32_t *purgeable_count,
703 uint32_t *wired_count,
704 uint32_t *clean_count,
705 uint32_t *dirty_count,
706 uint32_t dirty_budget,
707 uint32_t *shared_count,
708 int *freezer_error_code,
709 boolean_t eval_only);
710
711 /* Thaw a currently frozen task */
712 extern kern_return_t task_thaw(
713 task_t task);
714
715 typedef enum {
716 CREDIT_TO_SWAP = 1,
717 DEBIT_FROM_SWAP = 2
718 } freezer_acct_op_t;
719
720 extern void task_update_frozen_to_swap_acct(
721 task_t task,
722 int64_t amount,
723 freezer_acct_op_t op);
724
725 #endif /* CONFIG_FREEZE */
726
727 /* Halt all other threads in the current task */
728 extern kern_return_t task_start_halt(
729 task_t task);
730
731 /* Wait for other threads to halt and free halting task resources */
732 extern void task_complete_halt(
733 task_t task);
734
735 extern kern_return_t task_terminate_internal(
736 task_t task);
737
738 extern kern_return_t task_create_internal(
739 task_t parent_task,
740 coalition_t *parent_coalitions,
741 boolean_t inherit_memory,
742 boolean_t is_64bit,
743 boolean_t is_64bit_data,
744 uint32_t flags,
745 uint32_t procflags,
746 uint8_t t_returnwaitflags,
747 task_t *child_task); /* OUT */
748
749 extern kern_return_t task_set_special_port_internal(
750 task_t task,
751 int which,
752 ipc_port_t port);
753
754 extern kern_return_t task_info(
755 task_t task,
756 task_flavor_t flavor,
757 task_info_t task_info_out,
758 mach_msg_type_number_t *task_info_count);
759
760 extern void task_power_info_locked(
761 task_t task,
762 task_power_info_t info,
763 gpu_energy_data_t gpu_energy,
764 task_power_info_v2_t infov2,
765 uint64_t *runnable_time);
766
767 extern uint64_t task_gpu_utilisation(
768 task_t task);
769
770 extern uint64_t task_energy(
771 task_t task);
772
773 extern uint64_t task_cpu_ptime(
774 task_t task);
775 extern void task_update_cpu_time_qos_stats(
776 task_t task,
777 uint64_t *eqos_stats,
778 uint64_t *rqos_stats);
779
780 extern void task_vtimer_set(
781 task_t task,
782 integer_t which);
783
784 extern void task_vtimer_clear(
785 task_t task,
786 integer_t which);
787
788 extern void task_vtimer_update(
789 task_t task,
790 integer_t which,
791 uint32_t *microsecs);
792
793 #define TASK_VTIMER_USER 0x01
794 #define TASK_VTIMER_PROF 0x02
795 #define TASK_VTIMER_RLIM 0x04
796
797 extern void task_set_64bit(
798 task_t task,
799 boolean_t is_64bit,
800 boolean_t is_64bit_data);
801
802 extern boolean_t task_get_64bit_data(
803 task_t task);
804
805 extern void task_set_platform_binary(
806 task_t task,
807 boolean_t is_platform);
808 extern bool task_set_ca_client_wi(
809 task_t task,
810 boolean_t ca_client_wi);
811
812 extern void task_set_dyld_info(
813 task_t task,
814 mach_vm_address_t addr,
815 mach_vm_size_t size);
816
817 extern void task_set_mach_header_address(
818 task_t task,
819 mach_vm_address_t addr);
820
821 /* Get number of activations in a task */
822 extern int get_task_numacts(
823 task_t task);
824
825 struct label;
826 extern kern_return_t task_collect_crash_info(
827 task_t task,
828 #if CONFIG_MACF
829 struct label *crash_label,
830 #endif
831 int is_corpse_fork);
832 void task_port_notify(mach_msg_header_t *msg);
833 void task_port_with_flavor_notify(mach_msg_header_t *msg);
834 void task_wait_till_threads_terminate_locked(task_t task);
835
836 /* JMM - should just be temporary (implementation in bsd_kern still) */
837 extern void set_bsdtask_info(task_t, void *);
838 extern uint32_t set_task_loadTag(task_t task, uint32_t loadTag);
839 extern vm_map_t get_task_map_reference(task_t);
840 extern vm_map_t swap_task_map(task_t, thread_t, vm_map_t);
841 extern pmap_t get_task_pmap(task_t);
842 extern uint64_t get_task_resident_size(task_t);
843 extern uint64_t get_task_compressed(task_t);
844 extern uint64_t get_task_resident_max(task_t);
845 extern uint64_t get_task_phys_footprint(task_t);
846 #if CONFIG_LEDGER_INTERVAL_MAX
847 extern uint64_t get_task_phys_footprint_interval_max(task_t, int reset);
848 #endif /* CONFIG_FOOTPRINT_INTERVAL_MAX */
849 extern uint64_t get_task_phys_footprint_lifetime_max(task_t);
850 extern uint64_t get_task_phys_footprint_limit(task_t);
851 extern uint64_t get_task_purgeable_size(task_t);
852 extern uint64_t get_task_cpu_time(task_t);
853 extern uint64_t get_task_dispatchqueue_offset(task_t);
854 extern uint64_t get_task_dispatchqueue_serialno_offset(task_t);
855 extern uint64_t get_task_dispatchqueue_label_offset(task_t);
856 extern uint64_t get_task_uniqueid(task_t task);
857 extern int get_task_version(task_t task);
858
859 extern uint64_t get_task_internal(task_t);
860 extern uint64_t get_task_internal_compressed(task_t);
861 extern uint64_t get_task_purgeable_nonvolatile(task_t);
862 extern uint64_t get_task_purgeable_nonvolatile_compressed(task_t);
863 extern uint64_t get_task_iokit_mapped(task_t);
864 extern uint64_t get_task_alternate_accounting(task_t);
865 extern uint64_t get_task_alternate_accounting_compressed(task_t);
866 extern uint64_t get_task_memory_region_count(task_t);
867 extern uint64_t get_task_page_table(task_t);
868 #if CONFIG_FREEZE
869 extern uint64_t get_task_frozen_to_swap(task_t);
870 #endif
871 extern uint64_t get_task_network_nonvolatile(task_t);
872 extern uint64_t get_task_network_nonvolatile_compressed(task_t);
873 extern uint64_t get_task_wired_mem(task_t);
874 extern uint32_t get_task_loadTag(task_t task);
875
876 extern uint64_t get_task_tagged_footprint(task_t task);
877 extern uint64_t get_task_tagged_footprint_compressed(task_t task);
878 extern uint64_t get_task_media_footprint(task_t task);
879 extern uint64_t get_task_media_footprint_compressed(task_t task);
880 extern uint64_t get_task_graphics_footprint(task_t task);
881 extern uint64_t get_task_graphics_footprint_compressed(task_t task);
882 extern uint64_t get_task_neural_footprint(task_t task);
883 extern uint64_t get_task_neural_footprint_compressed(task_t task);
884
885 extern kern_return_t task_convert_phys_footprint_limit(int, int *);
886 extern kern_return_t task_set_phys_footprint_limit_internal(task_t, int, int *, boolean_t, boolean_t);
887 extern kern_return_t task_get_phys_footprint_limit(task_t task, int *limit_mb);
888
889 /* Jetsam memlimit attributes */
890 extern boolean_t task_get_memlimit_is_active(task_t task);
891 extern boolean_t task_get_memlimit_is_fatal(task_t task);
892 extern void task_set_memlimit_is_active(task_t task, boolean_t memlimit_is_active);
893 extern void task_set_memlimit_is_fatal(task_t task, boolean_t memlimit_is_fatal);
894 extern boolean_t task_has_triggered_exc_resource(task_t task, boolean_t memlimit_is_active);
895 extern void task_mark_has_triggered_exc_resource(task_t task, boolean_t memlimit_is_active);
896
897 extern void task_set_thread_limit(task_t task, uint16_t thread_limit);
898
899 #if XNU_TARGET_OS_OSX
900 extern boolean_t task_has_system_version_compat_enabled(task_t task);
901 extern void task_set_system_version_compat_enabled(task_t task, boolean_t enable_system_version_compat);
902 #endif
903
904 extern boolean_t is_kerneltask(task_t task);
905 extern boolean_t is_corpsetask(task_t task);
906
907 extern kern_return_t check_actforsig(task_t task, thread_t thread, int setast);
908
909 extern kern_return_t machine_task_get_state(
910 task_t task,
911 int flavor,
912 thread_state_t state,
913 mach_msg_type_number_t *state_count);
914
915 extern kern_return_t machine_task_set_state(
916 task_t task,
917 int flavor,
918 thread_state_t state,
919 mach_msg_type_number_t state_count);
920
921 extern void machine_task_terminate(task_t task);
922
923 struct _task_ledger_indices {
924 int cpu_time;
925 int tkm_private;
926 int tkm_shared;
927 int phys_mem;
928 int wired_mem;
929 int internal;
930 int iokit_mapped;
931 int alternate_accounting;
932 int alternate_accounting_compressed;
933 int page_table;
934 int phys_footprint;
935 int internal_compressed;
936 int purgeable_volatile;
937 int purgeable_nonvolatile;
938 int purgeable_volatile_compressed;
939 int purgeable_nonvolatile_compressed;
940 int tagged_nofootprint;
941 int tagged_footprint;
942 int tagged_nofootprint_compressed;
943 int tagged_footprint_compressed;
944 int network_volatile;
945 int network_nonvolatile;
946 int network_volatile_compressed;
947 int network_nonvolatile_compressed;
948 int media_nofootprint;
949 int media_footprint;
950 int media_nofootprint_compressed;
951 int media_footprint_compressed;
952 int graphics_nofootprint;
953 int graphics_footprint;
954 int graphics_nofootprint_compressed;
955 int graphics_footprint_compressed;
956 int neural_nofootprint;
957 int neural_footprint;
958 int neural_nofootprint_compressed;
959 int neural_footprint_compressed;
960 int platform_idle_wakeups;
961 int interrupt_wakeups;
962 #if CONFIG_SCHED_SFI
963 int sfi_wait_times[MAX_SFI_CLASS_ID];
964 #endif /* CONFIG_SCHED_SFI */
965 int cpu_time_billed_to_me;
966 int cpu_time_billed_to_others;
967 int physical_writes;
968 int logical_writes;
969 int logical_writes_to_external;
970 int energy_billed_to_me;
971 int energy_billed_to_others;
972 #if DEBUG || DEVELOPMENT
973 int pages_grabbed;
974 int pages_grabbed_kern;
975 int pages_grabbed_iopl;
976 int pages_grabbed_upl;
977 #endif
978 #if CONFIG_FREEZE
979 int frozen_to_swap;
980 #endif /* CONFIG_FREEZE */
981 #if CONFIG_PHYS_WRITE_ACCT
982 int fs_metadata_writes;
983 #endif /* CONFIG_PHYS_WRITE_ACCT */
984 };
985 extern struct _task_ledger_indices task_ledgers;
986
987 /* requires task to be unlocked, returns a referenced thread */
988 thread_t task_findtid(task_t task, uint64_t tid);
989 int pid_from_task(task_t task);
990
991 extern kern_return_t task_wakeups_monitor_ctl(task_t task, uint32_t *rate_hz, int32_t *flags);
992 extern kern_return_t task_cpu_usage_monitor_ctl(task_t task, uint32_t *flags);
993 extern void task_rollup_accounting_info(task_t new_task, task_t parent_task);
994 extern kern_return_t task_io_monitor_ctl(task_t task, uint32_t *flags);
995 extern void task_set_did_exec_flag(task_t task);
996 extern void task_clear_exec_copy_flag(task_t task);
997 extern boolean_t task_is_exec_copy(task_t);
998 extern boolean_t task_did_exec(task_t task);
999 #ifdef CONFIG_32BIT_TELEMETRY
1000 extern boolean_t task_consume_32bit_log_flag(task_t task);
1001 extern void task_set_32bit_log_flag(task_t task);
1002 #endif /* CONFIG_32BIT_TELEMETRY */
1003 extern boolean_t task_is_active(task_t task);
1004 extern boolean_t task_is_halting(task_t task);
1005 extern void task_clear_return_wait(task_t task, uint32_t flags);
1006 extern void task_wait_to_return(void) __attribute__((noreturn));
1007 extern event_t task_get_return_wait_event(task_t task);
1008
1009 extern void task_bank_reset(task_t task);
1010 extern void task_bank_init(task_t task);
1011
1012 #if CONFIG_ARCADE
1013 extern void task_prep_arcade(task_t task, thread_t thread);
1014 #endif /* CONFIG_ARCADE */
1015
1016 extern int task_pid(task_t task);
1017
1018 #if __has_feature(ptrauth_calls)
1019 char *task_get_vm_shared_region_id_and_jop_pid(task_t task, uint64_t *);
1020 void task_set_shared_region_id(task_t task, char *id);
1021 #endif /* __has_feature(ptrauth_calls) */
1022
1023 extern boolean_t task_has_assertions(task_t task);
1024 /* End task_policy */
1025
1026 extern void task_set_gpu_denied(task_t task, boolean_t denied);
1027 extern boolean_t task_is_gpu_denied(task_t task);
1028
1029 extern queue_head_t * task_io_user_clients(task_t task);
1030 extern void task_set_message_app_suspended(task_t task, boolean_t enable);
1031
1032 extern void task_copy_fields_for_exec(task_t dst_task, task_t src_task);
1033
1034 extern void task_copy_vmobjects(task_t task, vm_object_query_t query, size_t len, size_t *num);
1035
1036 extern void task_set_filter_msg_flag(task_t task, boolean_t flag);
1037 extern boolean_t task_get_filter_msg_flag(task_t task);
1038
1039 extern void task_transfer_mach_filter_bits(task_t new_task, task_t old_mask);
1040
1041 #if __has_feature(ptrauth_calls)
1042 extern bool task_is_pac_exception_fatal(task_t task);
1043 extern void task_set_pac_exception_fatal_flag(task_t task);
1044 #endif /*__has_feature(ptrauth_calls)*/
1045
1046 extern void task_set_tecs(task_t task);
1047
1048 #endif /* XNU_KERNEL_PRIVATE */
1049
1050 #ifdef KERNEL_PRIVATE
1051
1052 extern void *get_bsdtask_info(task_t);
1053 extern void *get_bsdthreadtask_info(thread_t);
1054 extern void task_bsdtask_kill(task_t);
1055 extern vm_map_t get_task_map(task_t);
1056 extern ledger_t get_task_ledger(task_t);
1057
1058 extern boolean_t get_task_pidsuspended(task_t);
1059 extern boolean_t get_task_suspended(task_t);
1060 extern boolean_t get_task_frozen(task_t);
1061
1062 /* Convert from a task to a port */
1063 extern ipc_port_t convert_task_to_port(task_t);
1064 extern ipc_port_t convert_task_to_port_pinned(task_t);
1065 extern ipc_port_t convert_task_name_to_port(task_name_t);
1066 extern ipc_port_t convert_task_inspect_to_port(task_inspect_t);
1067 extern ipc_port_t convert_task_read_to_port(task_read_t);
1068 extern ipc_port_t convert_task_suspension_token_to_port(task_suspension_token_t task);
1069
1070 /* Convert from a port (in this case, an SO right to a task's resume port) to a task. */
1071 extern task_suspension_token_t convert_port_to_task_suspension_token(ipc_port_t port);
1072
1073 extern boolean_t task_suspension_notify(mach_msg_header_t *);
1074
1075 #define TASK_WRITE_IMMEDIATE 0x1
1076 #define TASK_WRITE_DEFERRED 0x2
1077 #define TASK_WRITE_INVALIDATED 0x4
1078 #define TASK_WRITE_METADATA 0x8
1079 extern void task_update_logical_writes(task_t task, uint32_t io_size, int flags, void *vp);
1080
1081 __enum_decl(task_balance_flags_t, uint8_t, {
1082 TASK_BALANCE_CREDIT = 0x1,
1083 TASK_BALANCE_DEBIT = 0x2,
1084 });
1085
1086 __enum_decl(task_physical_write_flavor_t, uint8_t, {
1087 TASK_PHYSICAL_WRITE_METADATA = 0x1,
1088 });
1089 extern void task_update_physical_writes(task_t task, task_physical_write_flavor_t flavor,
1090 uint64_t io_size, task_balance_flags_t flags);
1091
1092 #if CONFIG_SECLUDED_MEMORY
1093 extern void task_set_can_use_secluded_mem(
1094 task_t task,
1095 boolean_t can_use_secluded_mem);
1096 extern void task_set_could_use_secluded_mem(
1097 task_t task,
1098 boolean_t could_use_secluded_mem);
1099 extern void task_set_could_also_use_secluded_mem(
1100 task_t task,
1101 boolean_t could_also_use_secluded_mem);
1102 extern boolean_t task_can_use_secluded_mem(
1103 task_t task,
1104 boolean_t is_allocate);
1105 extern boolean_t task_could_use_secluded_mem(task_t task);
1106 extern boolean_t task_could_also_use_secluded_mem(task_t task);
1107 #endif /* CONFIG_SECLUDED_MEMORY */
1108
1109 extern void task_set_darkwake_mode(task_t, boolean_t);
1110 extern boolean_t task_get_darkwake_mode(task_t);
1111
1112 #if __arm64__
1113 extern void task_set_legacy_footprint(task_t task);
1114 extern void task_set_extra_footprint_limit(task_t task);
1115 extern void task_set_ios13extended_footprint_limit(task_t task);
1116 #endif /* __arm64__ */
1117
1118 #if CONFIG_MACF
1119 extern struct label *get_task_crash_label(task_t task);
1120 #endif /* CONFIG_MACF */
1121
1122 extern int get_task_cdhash(task_t task, char cdhash[]);
1123
1124 #endif /* KERNEL_PRIVATE */
1125
1126 extern task_t kernel_task;
1127
1128 extern void task_deallocate(
1129 task_t task);
1130
1131 extern void task_name_deallocate(
1132 task_name_t task_name);
1133
1134 extern void task_policy_set_deallocate(
1135 task_policy_set_t task_policy_set);
1136
1137 extern void task_policy_get_deallocate(
1138 task_policy_get_t task_policy_get);
1139
1140 extern void task_inspect_deallocate(
1141 task_inspect_t task_inspect);
1142
1143 extern void task_read_deallocate(
1144 task_read_t task_read);
1145
1146 extern void task_suspension_token_deallocate(
1147 task_suspension_token_t token);
1148
1149 extern boolean_t task_self_region_footprint(void);
1150 extern void task_self_region_footprint_set(boolean_t newval);
1151 extern void task_ledgers_footprint(ledger_t ledger,
1152 ledger_amount_t *ledger_resident,
1153 ledger_amount_t *ledger_compressed);
1154 extern void task_set_memory_ownership_transfer(
1155 task_t task,
1156 boolean_t value);
1157
1158
1159 __END_DECLS
1160
1161 #endif /* _KERN_TASK_H_ */