summaryrefslogtreecommitdiff
path: root/serverboot
diff options
context:
space:
mode:
Diffstat (limited to 'serverboot')
-rw-r--r--serverboot/ChangeLog7
-rw-r--r--serverboot/kalloc.c23
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"); */