]> git.saurik.com Git - apple/xnu.git/blame - libkern/libkern/OSMalloc.h
xnu-792.6.61.tar.gz
[apple/xnu.git] / libkern / libkern / OSMalloc.h
CommitLineData
91447636
A
1/*
2 * Copyright (c) 2003-2004 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
37839358
A
5 *
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.
11 *
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
91447636
A
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
37839358
A
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
91447636
A
20 * @APPLE_LICENSE_HEADER_END@
21 */
22
23#ifndef LIBKERN_OSMALLOC_h
24#define LIBKERN_OSMALLOC_h
25
26#include <sys/cdefs.h>
27
28__BEGIN_DECLS
29
30#include <stdint.h>
31#ifdef MACH_KERNEL_PRIVATE
32#include <kern/queue.h>
33#endif
34
35#ifdef MACH_KERNEL_PRIVATE
36
37#define OSMT_MAX_NAME 64
38
39typedef struct _OSMallocTag_ {
40 queue_chain_t OSMT_link;
41 uint32_t OSMT_refcnt;
42 uint32_t OSMT_state;
43 uint32_t OSMT_attr;
44 char OSMT_name[OSMT_MAX_NAME];
45} *OSMallocTag;
46
47#define OSMT_VALID_MASK 0xFFFF0000
48#define OSMT_VALID 0xDEAB0000
49#define OSMT_RELEASED 0x00000001
50
51#define OSMT_ATTR_PAGEABLE 0x01
52#else
53typedef struct __OSMallocTag__ *OSMallocTag, *OSMallocTag_t;
54#endif
55
56#define OSMT_DEFAULT 0x00
57#define OSMT_PAGEABLE 0x01
58
59extern OSMallocTag OSMalloc_Tagalloc(const char * str, uint32_t flags);
60
61extern void OSMalloc_Tagfree(OSMallocTag tag);
62
63extern void * OSMalloc(uint32_t size, OSMallocTag tag);
64
65extern void * OSMalloc_nowait(uint32_t size, OSMallocTag tag);
66
67extern void * OSMalloc_noblock(uint32_t size, OSMallocTag tag);
68
69extern void OSFree(void * addr, uint32_t size, OSMallocTag tag);
70
71__END_DECLS
72
73#endif /* LIBKERN_OSMALLOC_h */