]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/kern/ledger.c
xnu-792.12.6.tar.gz
[apple/xnu.git] / osfmk / kern / ledger.c
index e7e897c49497dec0076663713b577b28c671d278..376cc9ecf7e8fd6dba4cef56e9a416ee9d69cd0a 100644 (file)
@@ -1,62 +1,35 @@
 /*
- * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
  *
- * @APPLE_LICENSE_HEADER_START@
+ * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
  * 
- * The contents of this file constitute Original Code as defined in and
- * are subject to the Apple Public Source License Version 1.1 (the
- * "License").  You may not use this file except in compliance with the
- * License.  Please obtain a copy of the License at
- * http://www.apple.com/publicsource and read it before using this file.
- * 
- * This Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
- * License for the specific language governing rights and limitations
- * under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-/*
- * @OSF_COPYRIGHT@
- */
-/*
- * HISTORY
- * 
- * Revision 1.1.1.1  1998/09/22 21:05:34  wsanchez
- * Import of Mac OS X kernel (~semeria)
+ * This file contains Original Code and/or Modifications of Original Code 
+ * as defined in and that are subject to the Apple Public Source License 
+ * Version 2.0 (the 'License'). You may not use this file except in 
+ * compliance with the License.  The rights granted to you under the 
+ * License may not be used to create, or enable the creation or 
+ * redistribution of, unlawful or unlicensed copies of an Apple operating 
+ * system, or to circumvent, violate, or enable the circumvention or 
+ * violation of, any terms of an Apple operating system software license 
+ * agreement.
  *
- * Revision 1.1.1.1  1998/03/07 02:25:55  wsanchez
- * Import of OSF Mach kernel (~mburg)
+ * Please obtain a copy of the License at 
+ * http://www.opensource.apple.com/apsl/ and read it before using this 
+ * file.
  *
- * Revision 1.1.6.1  1995/01/06  19:47:19  devrcs
- *     mk6 CR668 - 1.3b26 merge
- *     new file for mk6
- *     [1994/10/12  22:19:28  dwm]
+ * The Original Code and all software distributed under the License are 
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 
+ * Please see the License for the specific language governing rights and 
+ * limitations under the License.
  *
- * Revision 1.1.3.4  1994/05/13  20:10:01  tmt
- *     Changed three unsigned casts to natural_t.
- *     [1994/05/12  22:12:28  tmt]
- * 
- * Revision 1.1.3.2  1993/11/30  18:26:24  jph
- *     CR10228 -- Typo in unlock(), ledger_ledger should be child_ledger.
- *     [1993/11/30  16:10:43  jph]
- * 
- * Revision 1.1.3.1  1993/11/24  21:22:14  jph
- *     CR9801 brezak merge, ledgers, security and NMK15_COMPAT
- *     [1993/11/23  22:41:07  jph]
- * 
- * Revision 1.1.1.4  1993/09/08  14:17:36  brezak
- *     Include <mach/ledger_server.h> for protos.
- * 
- * Revision 1.1.1.3  1993/08/20  14:16:55  brezak
- *     Created.
- * 
- * $EndLog$
+ * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
  */
-
 /*
  * 8/13/93
  * 
 
 #include <mach/mach_types.h>
 #include <mach/message.h>
+#include <mach/port.h>
+#include <mach/ledger_server.h>
+
 #include <kern/mach_param.h>
 #include <kern/misc_protos.h>
-#include <mach/port.h>
 #include <kern/lock.h>
 #include <kern/ipc_kobject.h>
-#include <ipc/ipc_space.h>
-#include <ipc/ipc_port.h>
 #include <kern/host.h>
 #include <kern/ledger.h>
-#include <mach/ledger_server.h>
+#include <kern/kalloc.h>
+
+#include <ipc/ipc_space.h>
+#include <ipc/ipc_port.h>
 
 ledger_t       root_wired_ledger;
 ledger_t       root_paged_ledger;
@@ -104,7 +80,7 @@ ledger_enter(
                        ledger_unlock(ledger);
                        return(KERN_RESOURCE_SHORTAGE);
                }
-               if ((natural_t)(ledger->ledger_balance + amount) 
+               if ((ledger->ledger_balance + amount) 
                        < LEDGER_ITEM_INFINITY)
                        ledger->ledger_balance += amount;
                else
@@ -158,7 +134,7 @@ ledger_deallocate(
        ipc_port_dealloc_kernel(ledger->ledger_self);
 
        /* XXX release send right on service port */
-       kfree((vm_offset_t)ledger, sizeof(*ledger));
+       kfree(ledger, sizeof(*ledger));
 }