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