+extern ledger_template_t ledger_template_create(const char *name);
+extern ledger_template_t ledger_template_copy(ledger_template_t template, const char *name);
+extern void ledger_template_dereference(ledger_template_t template);
+extern int ledger_entry_add(ledger_template_t template, const char *key,
+ const char *group, const char *units);
+extern kern_return_t ledger_set_callback(ledger_template_t template, int entry,
+ ledger_callback_t callback, const void *param0, const void *param1);
+extern kern_return_t ledger_track_maximum(ledger_template_t template, int entry,
+ int period_in_secs);
+extern kern_return_t ledger_panic_on_negative(ledger_template_t template,
+ int entry);
+extern kern_return_t ledger_track_credit_only(ledger_template_t template,
+ int entry);
+extern int ledger_key_lookup(ledger_template_t template, const char *key);
+
+/* value of entry type */
+#define LEDGER_CREATE_ACTIVE_ENTRIES 0
+#define LEDGER_CREATE_INACTIVE_ENTRIES 1
+extern ledger_t ledger_instantiate(ledger_template_t template, int entry_type);
+extern void ledger_template_complete(ledger_template_t template);
+extern void ledger_template_complete_secure_alloc(ledger_template_t template);
+extern kern_return_t ledger_disable_callback(ledger_t ledger, int entry);
+extern kern_return_t ledger_enable_callback(ledger_t ledger, int entry);
+extern kern_return_t ledger_get_limit(ledger_t ledger, int entry,
+ ledger_amount_t *limit);
+extern kern_return_t ledger_set_limit(ledger_t ledger, int entry,
+ ledger_amount_t limit, uint8_t warn_level_percentage);
+#if CONFIG_LEDGER_INTERVAL_MAX
+extern kern_return_t ledger_get_interval_max(ledger_t ledger, int entry,
+ ledger_amount_t *max_interval_balance, int reset);
+#endif /* CONFIG_LEDGER_INTERVAL_MAX */
+extern kern_return_t ledger_get_lifetime_max(ledger_t ledger, int entry,
+ ledger_amount_t *max_lifetime_balance);
+extern kern_return_t ledger_get_actions(ledger_t ledger, int entry, int *actions);
+extern kern_return_t ledger_set_action(ledger_t ledger, int entry, int action);
+extern kern_return_t ledger_get_period(ledger_t ledger, int entry,
+ uint64_t *period);
+extern kern_return_t ledger_set_period(ledger_t ledger, int entry,
+ uint64_t period);
+extern kern_return_t ledger_disable_refill(ledger_t l, int entry);
+extern kern_return_t ledger_entry_setactive(ledger_t ledger, int entry);
+extern void ledger_check_new_balance(thread_t thread, ledger_t ledger, int entry);
+extern kern_return_t ledger_credit(ledger_t ledger, int entry,
+ ledger_amount_t amount);
+extern kern_return_t ledger_credit_nocheck(ledger_t ledger, int entry,
+ ledger_amount_t amount);
+extern kern_return_t ledger_debit(ledger_t ledger, int entry,
+ ledger_amount_t amount);
+extern kern_return_t ledger_debit_nocheck(ledger_t ledger, int entry,
+ ledger_amount_t amount);
+extern kern_return_t ledger_credit_thread(thread_t thread, ledger_t ledger,
+ int entry, ledger_amount_t amount);
+extern kern_return_t ledger_debit_thread(thread_t thread, ledger_t ledger,
+ int entry, ledger_amount_t amount);
+extern kern_return_t ledger_zero_balance(ledger_t ledger, int entry);
+extern kern_return_t ledger_get_entries(ledger_t ledger, int entry,
+ ledger_amount_t *credit, ledger_amount_t *debit);
+extern kern_return_t ledger_get_balance(ledger_t ledger, int entry,
+ ledger_amount_t *balance);
+extern kern_return_t ledger_reset_callback_state(ledger_t ledger, int entry);
+extern kern_return_t ledger_disable_panic_on_negative(ledger_t ledger, int entry);
+extern kern_return_t ledger_get_panic_on_negative(ledger_t ledger, int entry, int *panic_on_negative);
+
+extern kern_return_t ledger_rollup(ledger_t to_ledger, ledger_t from_ledger);
+extern kern_return_t ledger_rollup_entry(ledger_t to_ledger, ledger_t from_ledger, int entry);
+
+extern void ledger_ast(thread_t thread);
+
+extern void ledger_reference(ledger_t ledger);
+extern void ledger_dereference(ledger_t ledger);
+
+/* Support for ledger() syscall */
+#ifdef LEDGER_DEBUG
+extern int ledger_limit(task_t task, struct ledger_limit_args *args);
+#endif
+extern int ledger_info(task_t task, struct ledger_info *info);
+
+extern int
+ledger_get_task_entry_info_multiple(task_t task, void **buf, int *len);
+
+extern void
+ledger_get_entry_info(ledger_t ledger, int entry,
+ struct ledger_entry_info *lei);
+
+extern int ledger_template_info(void **buf, int *len);
+
+#endif /* KERNEL_PRIVATE */
+
+#endif /* _KERN_LEDGER_H_ */