2 * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
26 #ifdef MACH_KERNEL_PRIVATE
28 #ifndef _KERN_LEDGER_H_
29 #define _KERN_LEDGER_H_
31 #include <mach/mach_types.h>
33 #include <kern/kern_types.h>
34 #include <kern/lock.h>
35 #include <ipc/ipc_types.h>
38 ipc_port_t ledger_self
;
39 ipc_port_t ledger_service_port
;
40 ledger_item_t ledger_balance
;
41 ledger_item_t ledger_limit
;
42 struct ledger
*ledger_ledger
;
43 struct ledger
*ledger_parent
;
44 decl_simple_lock_data(,lock
)
47 typedef struct ledger ledger_data_t
;
49 #define ledger_lock(ledger) simple_lock(&(ledger)->lock)
50 #define ledger_unlock(ledger) simple_unlock(&(ledger)->lock)
51 #define ledger_lock_init(ledger) \
52 simple_lock_init(&(ledger)->lock, 0)
54 extern ledger_t root_wired_ledger
;
55 extern ledger_t root_paged_ledger
;
57 #define root_wired_ledger_port root_wired_ledger->ledger_self
58 #define root_paged_ledger_port root_paged_ledger->ledger_self
60 extern void ledger_init(void);
62 extern ipc_port_t
ledger_copy(ledger_t
);
64 extern kern_return_t
ledger_enter(ledger_t
, ledger_item_t
);
66 extern ledger_t
convert_port_to_ledger(ipc_port_t
);
68 extern ipc_port_t
convert_ledger_to_port(ledger_t
);
70 #endif /* _KERN_LEDGER_H_ */
72 #endif /* MACH_KERNEL_PRIVATE */