diff options
author | Thomas Schwinge <tschwinge@gnu.org> | 2006-03-14 23:34:24 +0000 |
---|---|---|
committer | Thomas Schwinge <tschwinge@gnu.org> | 2006-03-14 23:34:24 +0000 |
commit | eb13c95345799f42ab8916faa682864f6b7463b1 (patch) | |
tree | 3f42c400d220669e68762a231ffb9c9a73d8ce54 /serverboot | |
parent | 83dae4510ddb4afd8acf584a229604f703aac871 (diff) |
2006-03-15 Alfred M. Szmidt <ams@gnu.org>
* kalloc.c: #include <malloc.h>.
(init_hook, malloc_hook, free_hook): New functions.
(__malloc_initialize_hook): New variable.
(malloc, free): Functions removed.
Diffstat (limited to 'serverboot')
-rw-r--r-- | serverboot/ChangeLog | 7 | ||||
-rw-r--r-- | serverboot/kalloc.c | 23 |
2 files changed, 27 insertions, 3 deletions
diff --git a/serverboot/ChangeLog b/serverboot/ChangeLog index e532d2a7..f0997fc5 100644 --- a/serverboot/ChangeLog +++ b/serverboot/ChangeLog @@ -1,3 +1,10 @@ +2006-03-15 Alfred M. Szmidt <ams@gnu.org> + + * kalloc.c: #include <malloc.h>. + (init_hook, malloc_hook, free_hook): New functions. + (__malloc_initialize_hook): New variable. + (malloc, free): Functions removed. + 2003-05-07 Ognyan Kulev <ogi@fmi.uni-sofia.bg> * strfcns.c: #include <stdarg.h> instead of <varargs.h>. diff --git a/serverboot/kalloc.c b/serverboot/kalloc.c index 80438738..28c0b55e 100644 --- a/serverboot/kalloc.c +++ b/serverboot/kalloc.c @@ -34,6 +34,14 @@ #include <mach.h> #include <cthreads.h> /* for spin locks */ +#include <malloc.h> /* for malloc_hook/free_hook */ + +static void init_hook (void); +static void *malloc_hook (size_t size, const void *caller); +static void free_hook (void *ptr, const void *caller); + +void (*__malloc_initialize_hook) (void) = init_hook; + #define DEBUG @@ -250,12 +258,21 @@ kfree( void *data, } } -void *malloc(vm_size_t size) +static void +init_hook (void) +{ + __malloc_hook = malloc_hook; + __free_hook = free_hook; +} + +static void * +malloc_hook (size_t size, const void *caller) { - return (void *)kalloc(size); + return (void *) kalloc ((vm_size_t) size); } -void free(void *addr) +static void +free_hook (void *ptr, const void *caller) { /* Just ignore harmless attempts at cleanliness. */ /* panic("free not implemented"); */ |