+extern void task_power_info_locked(
+ task_t task,
+ task_power_info_t info,
+ gpu_energy_data_t gpu_energy,
+ task_power_info_v2_t infov2);
+
+extern uint64_t task_gpu_utilisation(
+ task_t task);
+
+extern uint64_t task_energy(
+ task_t task);
+
+extern uint64_t task_cpu_ptime(
+ task_t task);
+
+extern void task_vtimer_set(
+ task_t task,
+ integer_t which);
+
+extern void task_vtimer_clear(
+ task_t task,
+ integer_t which);
+
+extern void task_vtimer_update(
+ task_t task,
+ integer_t which,
+ uint32_t *microsecs);
+
+#define TASK_VTIMER_USER 0x01
+#define TASK_VTIMER_PROF 0x02
+#define TASK_VTIMER_RLIM 0x04
+
+extern void task_set_64bit(
+ task_t task,
+ boolean_t is64bit);
+
+extern void task_set_platform_binary(
+ task_t task,
+ boolean_t is_platform);
+
+extern void task_backing_store_privileged(
+ task_t task);
+
+extern void task_set_dyld_info(
+ task_t task,
+ mach_vm_address_t addr,
+ mach_vm_size_t size);
+
+/* Get number of activations in a task */
+extern int get_task_numacts(
+ task_t task);
+
+extern int get_task_numactivethreads(task_t task);
+
+struct label;
+extern kern_return_t task_collect_crash_info(
+ task_t task,
+#if CONFIG_MACF
+ struct label *crash_label,
+#endif
+ int is_corpse_fork);
+void task_port_notify(mach_msg_header_t *msg);
+void task_wait_till_threads_terminate_locked(task_t task);
+
+/* JMM - should just be temporary (implementation in bsd_kern still) */
+extern void set_bsdtask_info(task_t,void *);
+extern vm_map_t get_task_map_reference(task_t);
+extern vm_map_t swap_task_map(task_t, thread_t, vm_map_t);
+extern pmap_t get_task_pmap(task_t);
+extern uint64_t get_task_resident_size(task_t);
+extern uint64_t get_task_compressed(task_t);
+extern uint64_t get_task_resident_max(task_t);
+extern uint64_t get_task_phys_footprint(task_t);
+extern uint64_t get_task_phys_footprint_recent_max(task_t);
+extern uint64_t get_task_phys_footprint_lifetime_max(task_t);
+extern uint64_t get_task_phys_footprint_limit(task_t);
+extern uint64_t get_task_purgeable_size(task_t);
+extern uint64_t get_task_cpu_time(task_t);
+extern uint64_t get_task_dispatchqueue_offset(task_t);
+extern uint64_t get_task_dispatchqueue_serialno_offset(task_t);
+extern uint64_t get_task_uniqueid(task_t task);
+extern int get_task_version(task_t task);
+
+extern uint64_t get_task_internal(task_t);
+extern uint64_t get_task_internal_compressed(task_t);
+extern uint64_t get_task_purgeable_nonvolatile(task_t);
+extern uint64_t get_task_purgeable_nonvolatile_compressed(task_t);
+extern uint64_t get_task_iokit_mapped(task_t);
+extern uint64_t get_task_alternate_accounting(task_t);
+extern uint64_t get_task_alternate_accounting_compressed(task_t);
+extern uint64_t get_task_memory_region_count(task_t);
+extern uint64_t get_task_page_table(task_t);
+
+extern kern_return_t task_convert_phys_footprint_limit(int, int *);
+extern kern_return_t task_set_phys_footprint_limit_internal(task_t, int, int *, boolean_t, boolean_t);
+extern kern_return_t task_get_phys_footprint_limit(task_t task, int *limit_mb);
+
+/* Jetsam memlimit attributes */
+extern boolean_t task_get_memlimit_is_active(task_t task);
+extern boolean_t task_get_memlimit_is_fatal(task_t task);
+extern void task_set_memlimit_is_active(task_t task, boolean_t memlimit_is_active);
+extern void task_set_memlimit_is_fatal(task_t task, boolean_t memlimit_is_fatal);
+extern boolean_t task_has_triggered_exc_resource(task_t task, boolean_t memlimit_is_active);
+extern void task_mark_has_triggered_exc_resource(task_t task, boolean_t memlimit_is_active);
+
+extern boolean_t is_kerneltask(task_t task);
+extern boolean_t is_corpsetask(task_t task);
+
+extern kern_return_t check_actforsig(task_t task, thread_t thread, int setast);
+
+extern kern_return_t machine_task_get_state(
+ task_t task,
+ int flavor,
+ thread_state_t state,
+ mach_msg_type_number_t *state_count);
+
+extern kern_return_t machine_task_set_state(
+ task_t task,
+ int flavor,
+ thread_state_t state,
+ mach_msg_type_number_t state_count);
+
+extern void machine_task_terminate(task_t task);
+
+struct _task_ledger_indices {
+ int cpu_time;
+ int tkm_private;
+ int tkm_shared;
+ int phys_mem;
+ int wired_mem;
+ int internal;
+ int iokit_mapped;
+ int alternate_accounting;
+ int alternate_accounting_compressed;
+ int page_table;
+ int phys_footprint;
+ int internal_compressed;
+ int purgeable_volatile;
+ int purgeable_nonvolatile;
+ int purgeable_volatile_compressed;
+ int purgeable_nonvolatile_compressed;
+ int platform_idle_wakeups;
+ int interrupt_wakeups;
+#if CONFIG_SCHED_SFI
+ int sfi_wait_times[MAX_SFI_CLASS_ID];
+#endif /* CONFIG_SCHED_SFI */
+ int cpu_time_billed_to_me;
+ int cpu_time_billed_to_others;
+ int physical_writes;
+ int logical_writes;
+ int energy_billed_to_me;
+ int energy_billed_to_others;
+};
+extern struct _task_ledger_indices task_ledgers;
+
+/* requires task to be unlocked, returns a referenced thread */
+thread_t task_findtid(task_t task, uint64_t tid);
+int pid_from_task(task_t task);
+
+extern kern_return_t task_wakeups_monitor_ctl(task_t task, uint32_t *rate_hz, int32_t *flags);
+extern kern_return_t task_cpu_usage_monitor_ctl(task_t task, uint32_t *flags);
+extern void task_rollup_accounting_info(task_t new_task, task_t parent_task);
+extern kern_return_t task_io_monitor_ctl(task_t task, uint32_t *flags);
+extern void task_set_did_exec_flag(task_t task);
+extern void task_clear_exec_copy_flag(task_t task);
+extern boolean_t task_is_exec_copy(task_t);
+extern boolean_t task_did_exec(task_t task);
+extern boolean_t task_is_active(task_t task);
+extern boolean_t task_is_halting(task_t task);
+extern void task_clear_return_wait(task_t task);
+extern void task_wait_to_return(void);
+extern event_t task_get_return_wait_event(task_t task);
+
+extern void task_atm_reset(task_t task);
+extern void task_bank_reset(task_t task);
+extern void task_bank_init(task_t task);
+
+extern int task_pid(task_t task);
+extern boolean_t task_has_assertions(task_t task);
+/* End task_policy */
+
+extern void task_set_gpu_denied(task_t task, boolean_t denied);
+extern boolean_t task_is_gpu_denied(task_t task);
+
+extern queue_head_t * task_io_user_clients(task_t task);
+
+extern void task_copy_fields_for_exec(task_t dst_task, task_t src_task);
+
+#endif /* XNU_KERNEL_PRIVATE */
+
+#ifdef KERNEL_PRIVATE
+
+extern void *get_bsdtask_info(task_t);
+extern void *get_bsdthreadtask_info(thread_t);
+extern void task_bsdtask_kill(task_t);
+extern vm_map_t get_task_map(task_t);
+extern ledger_t get_task_ledger(task_t);
+
+extern boolean_t get_task_pidsuspended(task_t);
+extern boolean_t get_task_frozen(task_t);
+
+/* Convert from a task to a port */
+extern ipc_port_t convert_task_to_port(task_t);
+extern ipc_port_t convert_task_name_to_port(task_name_t);
+extern ipc_port_t convert_task_inspect_to_port(task_inspect_t);
+extern ipc_port_t convert_task_suspension_token_to_port(task_suspension_token_t task);
+
+/* Convert from a port (in this case, an SO right to a task's resume port) to a task. */
+extern task_suspension_token_t convert_port_to_task_suspension_token(ipc_port_t port);
+
+extern boolean_t task_suspension_notify(mach_msg_header_t *);
+
+#define TASK_WRITE_IMMEDIATE 0x1
+#define TASK_WRITE_DEFERRED 0x2
+#define TASK_WRITE_INVALIDATED 0x4
+#define TASK_WRITE_METADATA 0x8
+extern void task_update_logical_writes(task_t task, uint32_t io_size, int flags, void *vp);
+
+#if CONFIG_SECLUDED_MEMORY
+extern void task_set_can_use_secluded_mem(
+ task_t task,
+ boolean_t can_use_secluded_mem);
+extern void task_set_could_use_secluded_mem(
+ task_t task,
+ boolean_t could_use_secluded_mem);
+extern void task_set_could_also_use_secluded_mem(
+ task_t task,
+ boolean_t could_also_use_secluded_mem);
+extern boolean_t task_can_use_secluded_mem(task_t task);
+extern boolean_t task_could_use_secluded_mem(task_t task);
+#endif /* CONFIG_SECLUDED_MEMORY */
+
+#if CONFIG_MACF
+extern struct label *get_task_crash_label(task_t task);
+#endif /* CONFIG_MACF */
+
+#endif /* KERNEL_PRIVATE */
+
+extern task_t kernel_task;
+
+extern void task_deallocate(
+ task_t task);
+
+extern void task_name_deallocate(
+ task_name_t task_name);
+
+extern void task_inspect_deallocate(
+ task_inspect_t task_inspect);
+
+extern void task_suspension_token_deallocate(
+ task_suspension_token_t token);
+__END_DECLS