commit-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[hurd] 06/19: Complete allocation hooks


From: Samuel Thibault
Subject: [hurd] 06/19: Complete allocation hooks
Date: Wed, 10 Aug 2016 00:05:49 +0000

This is an automated email from the git hooks/post-receive script.

sthibault pushed a commit to branch upstream
in repository hurd.

commit 1a36fdfe7cf17aa23f0bd43eb6cca4d28e510def
Author: Samuel Thibault <address@hidden>
Date:   Mon May 30 23:57:49 2016 +0200

    Complete allocation hooks
    
    * mach-defpager/kalloc.c (realloc_hook, memalign_hook): New functions.
    (init_hook): Set __realloc_hook to realloc_hook and __memalign_hook to
    memalign_hook.
---
 mach-defpager/kalloc.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/mach-defpager/kalloc.c b/mach-defpager/kalloc.c
index ef844ac..e4ed12f 100644
--- a/mach-defpager/kalloc.c
+++ b/mach-defpager/kalloc.c
@@ -40,6 +40,8 @@
 
 static void init_hook (void);
 static void *malloc_hook (size_t size, const void *caller);
+static void *realloc_hook (void *ptr, size_t size, const void *caller);
+static void *memalign_hook (size_t alignment, size_t size, const void *caller);
 static void free_hook (void *ptr, const void *caller);
 
 /* GNU libc 2.14 defines this macro to declare hook variables as volatile.
@@ -268,6 +270,8 @@ static void
 init_hook (void)
 {
   __malloc_hook = malloc_hook;
+  __realloc_hook = realloc_hook;
+  __memalign_hook = memalign_hook;
   __free_hook = free_hook;
 }
 
@@ -277,6 +281,20 @@ malloc_hook (size_t size, const void *caller)
   return (void *) kalloc ((vm_size_t) size);
 }
 
+static void *
+realloc_hook (void *ptr, size_t size, const void *caller)
+{
+  panic("realloc_hook not implemented");
+}
+
+static void *
+memalign_hook (size_t alignment, size_t size, const void *caller)
+{
+  if (alignment > vm_page_size)
+    panic("memalign_hook not implemented");
+  return malloc_hook(size, caller);
+}
+
 static void
 free_hook (void *ptr, const void *caller)
 {

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-hurd/hurd.git



reply via email to

[Prev in Thread] Current Thread [Next in Thread]