ledger_t ledger,
ledger_item_t amount)
{
+ if (ledger == LEDGER_NULL)
+ return KERN_SUCCESS;
+
/* Need to lock the ledger */
ledger_lock(ledger);
(*new_ledger)->ledger_limit = transfer;
/* Charge the ledger against the ledger_ledger */
- ledger_ledger->ledger_balance += sizeof(ledger_data_t);
+ ledger_ledger->ledger_balance += (ledger_item_t)sizeof(ledger_data_t);
ledger_unlock(parent_ledger);
ledger_unlock(ledger_ledger);
(void) ledger_enter(ledger->ledger_parent, ledger->ledger_balance);
/* adjust the balance of the creation ledger */
- (void) ledger_enter(ledger->ledger_ledger, -sizeof(*ledger));
+ (void) ledger_enter(ledger->ledger_ledger, (ledger_item_t)-sizeof(*ledger));
/* delete the ledger */
ledger_deallocate(ledger);
{
ipc_port_t port;
- port = ipc_port_make_send(ledger->ledger_self);
+ if (ledger == LEDGER_NULL)
+ return IP_NULL;
+ port = ipc_port_make_send(ledger->ledger_self);
return port;
}
ledger_copy(
ledger_t ledger)
{
- /* XXX reference counting */
- assert(ledger);
+ if (ledger == LEDGER_NULL)
+ return IP_NULL;
+
return(ipc_port_copy_send(ledger->ledger_self));
}