]>
git.saurik.com Git - apple/xnu.git/blob - security/mac_alloc.h
2 * Copyright (c) 2007 Apple Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
29 * Memory allocation wrappers.
32 #ifndef _SECURITY_MAC_ALLOC_H_
33 #define _SECURITY_MAC_ALLOC_H_
35 #include <mach/machine/vm_types.h>
36 #include <kern/kern_types.h>
37 #include <sys/appleapiopts.h>
39 /* JMM - should use OSMlloc.h interfaces */
41 #ifdef __APPLE_API_EVOLVING
43 * Kernel Memory allocator
45 void * mac_kalloc (vm_size_t size
, int how
);
46 void mac_kfree (void *data
, vm_size_t size
);
49 * Mbuf allocator for mbuf labels.
51 void * mac_mbuf_alloc (int len
, int wait
);
52 void mac_mbuf_free (void *data
);
57 int mac_wire (void *start
, void *end
);
58 int mac_unwire (void *start
, void *end
);
63 zone_t
mac_zinit (vm_size_t size
, vm_size_t maxmem
,
64 vm_size_t alloc
, const char *name
);
65 void mac_zone_change (zone_t zone
, unsigned int item
, boolean_t value
);
66 void * mac_zalloc (zone_t zone
, int how
);
67 void mac_zfree (zone_t zone
, void *elem
);
69 /* Item definitions */
70 #define Z_EXHAUST 1 /* Make zone exhaustible */
71 #define Z_COLLECT 2 /* Make zone collectable */
72 #define Z_EXPAND 3 /* Make zone expandable */
73 #define Z_FOREIGN 4 /* Allow collectable zone to contain foreign elements */
74 #define Z_CALLERACCT 5 /* Account alloc/free against the caller */
76 #endif /* __APPLE_API_EVOLVING */
77 #endif /* _SECURITY_MAC_ALLOC_H_ */