Magellan Linux

Contents of /trunk/mkinitrd-magellan/klibc/usr/klibc/malloc.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 532 - (show annotations) (download)
Sat Sep 1 22:45:15 2007 UTC (16 years, 8 months ago) by niro
File MIME type: text/plain
File size: 1028 byte(s)
-import if magellan mkinitrd; it is a fork of redhats mkinitrd-5.0.8 with all magellan patches and features; deprecates magellan-src/mkinitrd

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; /* Also gives the location of the next entry */
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;