+/*
+ *
+ */
+uint64_t get_task_phys_footprint_limit(task_t task)
+{
+ kern_return_t ret;
+ ledger_amount_t max;
+
+ ret = ledger_get_limit(task->ledger, task_ledgers.phys_footprint, &max);
+ if (KERN_SUCCESS == ret) {
+ return max;
+ }
+
+ return 0;
+}
+
+uint64_t get_task_internal(task_t task)
+{
+ kern_return_t ret;
+ ledger_amount_t credit, debit;
+
+ ret = ledger_get_entries(task->ledger, task_ledgers.internal, &credit, &debit);
+ if (KERN_SUCCESS == ret) {
+ return (credit - debit);
+ }
+
+ return 0;
+}
+
+uint64_t get_task_internal_compressed(task_t task)
+{
+ kern_return_t ret;
+ ledger_amount_t credit, debit;
+
+ ret = ledger_get_entries(task->ledger, task_ledgers.internal_compressed, &credit, &debit);
+ if (KERN_SUCCESS == ret) {
+ return (credit - debit);
+ }
+
+ return 0;
+}
+
+uint64_t get_task_purgeable_nonvolatile(task_t task)
+{
+ kern_return_t ret;
+ ledger_amount_t credit, debit;
+
+ ret = ledger_get_entries(task->ledger, task_ledgers.purgeable_nonvolatile, &credit, &debit);
+ if (KERN_SUCCESS == ret) {
+ return (credit - debit);
+ }
+
+ return 0;
+}
+
+uint64_t get_task_purgeable_nonvolatile_compressed(task_t task)
+{
+ kern_return_t ret;
+ ledger_amount_t credit, debit;
+
+ ret = ledger_get_entries(task->ledger, task_ledgers.purgeable_nonvolatile_compressed, &credit, &debit);
+ if (KERN_SUCCESS == ret) {
+ return (credit - debit);
+ }
+
+ return 0;
+}
+
+uint64_t get_task_alternate_accounting(task_t task)
+{
+ kern_return_t ret;
+ ledger_amount_t credit, debit;
+
+ ret = ledger_get_entries(task->ledger, task_ledgers.alternate_accounting, &credit, &debit);
+ if (KERN_SUCCESS == ret) {
+ return (credit - debit);
+ }
+
+ return 0;
+}
+
+uint64_t get_task_alternate_accounting_compressed(task_t task)
+{
+ kern_return_t ret;
+ ledger_amount_t credit, debit;
+
+ ret = ledger_get_entries(task->ledger, task_ledgers.alternate_accounting_compressed, &credit, &debit);
+ if (KERN_SUCCESS == ret) {
+ return (credit - debit);
+ }
+
+ return 0;
+}
+
+uint64_t get_task_page_table(task_t task)
+{
+ kern_return_t ret;
+ ledger_amount_t credit, debit;
+
+ ret = ledger_get_entries(task->ledger, task_ledgers.page_table, &credit, &debit);
+ if (KERN_SUCCESS == ret) {
+ return (credit - debit);
+ }
+
+ return 0;
+}
+
+uint64_t get_task_iokit_mapped(task_t task)
+{
+ kern_return_t ret;
+ ledger_amount_t credit, debit;
+
+ ret = ledger_get_entries(task->ledger, task_ledgers.iokit_mapped, &credit, &debit);
+ if (KERN_SUCCESS == ret) {
+ return (credit - debit);
+ }
+
+ return 0;
+}
+