+
+void
+fill_task_billed_usage(task_t task __unused, rusage_info_current *ri)
+{
+#if CONFIG_BANK
+ ri->ri_billed_system_time = bank_billed_time_safe(task);
+ ri->ri_serviced_system_time = bank_serviced_time_safe(task);
+#else
+ ri->ri_billed_system_time = 0;
+ ri->ri_serviced_system_time = 0;
+#endif
+}
+
+int
+fill_task_io_rusage(task_t task, rusage_info_current *ri)
+{
+ assert(task != TASK_NULL);
+ task_lock(task);
+
+ if (task->task_io_stats) {
+ ri->ri_diskio_bytesread = task->task_io_stats->disk_reads.size;
+ ri->ri_diskio_byteswritten = (task->task_io_stats->total_io.size - task->task_io_stats->disk_reads.size);
+ } else {
+ /* I/O Stats unavailable */
+ ri->ri_diskio_bytesread = 0;
+ ri->ri_diskio_byteswritten = 0;
+ }
+ task_unlock(task);
+ return (0);
+}
+
+int
+fill_task_qos_rusage(task_t task, rusage_info_current *ri)
+{
+ thread_t thread;
+
+ assert(task != TASK_NULL);
+ task_lock(task);
+
+ /* Rollup Qos time of all the threads to task */
+ queue_iterate(&task->threads, thread, thread_t, task_threads) {
+ if (thread->options & TH_OPT_IDLE_THREAD)
+ continue;
+
+ thread_update_qos_cpu_time(thread);
+ }
+ ri->ri_cpu_time_qos_default = task->cpu_time_qos_stats.cpu_time_qos_default;
+ ri->ri_cpu_time_qos_maintenance = task->cpu_time_qos_stats.cpu_time_qos_maintenance;
+ ri->ri_cpu_time_qos_background = task->cpu_time_qos_stats.cpu_time_qos_background;
+ ri->ri_cpu_time_qos_utility = task->cpu_time_qos_stats.cpu_time_qos_utility;
+ ri->ri_cpu_time_qos_legacy = task->cpu_time_qos_stats.cpu_time_qos_legacy;
+ ri->ri_cpu_time_qos_user_initiated = task->cpu_time_qos_stats.cpu_time_qos_user_initiated;
+ ri->ri_cpu_time_qos_user_interactive = task->cpu_time_qos_stats.cpu_time_qos_user_interactive;
+
+ task_unlock(task);
+ return (0);
+}
+
+uint64_t
+get_task_dispatchqueue_serialno_offset(task_t task)
+{
+ uint64_t dq_serialno_offset = 0;
+
+ if (task->bsd_info) {
+ dq_serialno_offset = get_dispatchqueue_serialno_offset_from_proc(task->bsd_info);
+ }
+
+ return dq_serialno_offset;
+}
+
+uint64_t
+get_task_uniqueid(task_t task)
+{
+ if (task->bsd_info) {
+ return proc_uniqueid(task->bsd_info);
+ } else {
+ return UINT64_MAX;
+ }
+}
+
+#if CONFIG_MACF
+struct label *
+get_task_crash_label(task_t task)
+{
+ return task->crash_label;
+}
+
+void
+set_task_crash_label(task_t task, struct label *label)
+{
+ task->crash_label = label;
+}
+#endif