summaryrefslogtreecommitdiff
path: root/serverboot/kalloc.c
diff options
context:
space:
mode:
authorThomas Schwinge <tschwinge@gnu.org>2006-03-14 23:34:24 +0000
committerThomas Schwinge <tschwinge@gnu.org>2006-03-14 23:34:24 +0000
commitcd41545494ae5aa662a40f2737daa1b7f96b3c2d (patch)
tree6fe46b372170679836ecaf71dc92517a7d60c345 /serverboot/kalloc.c
parent1f1bc868258f571e92492e5273fd60bf9a8da244 (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/kalloc.c')
-rw-r--r--serverboot/kalloc.c23
1 files changed, 20 insertions, 3 deletions
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"); */