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