Contents of /trunk/mkinitrd-magellan/klibc/usr/klibc/malloc.h
Parent Directory | Revision Log
Revision 815 -
(show annotations)
(download)
Fri Apr 24 18:32:46 2009 UTC (15 years ago) by niro
File MIME type: text/plain
File size: 979 byte(s)
Fri Apr 24 18:32:46 2009 UTC (15 years ago) by niro
File MIME type: text/plain
File size: 979 byte(s)
-updated to klibc-1.5.15
1 | /* |
2 | * malloc.h |
3 | * |
4 | * Internals for the memory allocator |
5 | */ |
6 | |
7 | #include <stdint.h> |
8 | #include <stddef.h> |
9 | #include <klibc/sysconfig.h> |
10 | |
11 | /* |
12 | * This structure should be a power of two. This becomes the |
13 | * alignment unit. |
14 | */ |
15 | struct free_arena_header; |
16 | |
17 | struct arena_header { |
18 | size_t type; |
19 | size_t size; |
20 | struct free_arena_header *next, *prev; |
21 | }; |
22 | |
23 | #ifdef DEBUG_MALLOC |
24 | #define ARENA_TYPE_USED 0x64e69c70 |
25 | #define ARENA_TYPE_FREE 0x012d610a |
26 | #define ARENA_TYPE_HEAD 0x971676b5 |
27 | #define ARENA_TYPE_DEAD 0xeeeeeeee |
28 | #else |
29 | #define ARENA_TYPE_USED 0 |
30 | #define ARENA_TYPE_FREE 1 |
31 | #define ARENA_TYPE_HEAD 2 |
32 | #endif |
33 | |
34 | #define MALLOC_CHUNK_MASK (_KLIBC_MALLOC_CHUNK_SIZE-1) |
35 | |
36 | #define ARENA_SIZE_MASK (~(sizeof(struct arena_header)-1)) |
37 | |
38 | /* |
39 | * This structure should be no more than twice the size of the |
40 | * previous structure. |
41 | */ |
42 | struct free_arena_header { |
43 | struct arena_header a; |
44 | struct free_arena_header *next_free, *prev_free; |
45 | }; |
46 | |
47 | /* |
48 | * Internal variable used by brk/sbrk |
49 | */ |
50 | extern char *__current_brk; |