From 3ad603ace4c8b95cd2d38367ae092d1148e5a8ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Mon, 22 May 2006 18:04:20 +0000 Subject: [PATCH] implement sbrk() by calling hoard's version, through sbrk_hook (fct pointer was named this way in R5). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17540 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/libroot/posix/malloc/arch-specific.cpp | 2 ++ src/system/libroot/posix/unistd/sbrk.c | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/system/libroot/posix/malloc/arch-specific.cpp b/src/system/libroot/posix/malloc/arch-specific.cpp index c1a7e7c6d5..3980beae67 100644 --- a/src/system/libroot/posix/malloc/arch-specific.cpp +++ b/src/system/libroot/posix/malloc/arch-specific.cpp @@ -34,6 +34,8 @@ # define CTRACE(x) ; #endif +extern "C" void *(*sbrk_hook)(long); +void *(*sbrk_hook)(long) = &BPrivate::hoardSbrk; using namespace BPrivate; diff --git a/src/system/libroot/posix/unistd/sbrk.c b/src/system/libroot/posix/unistd/sbrk.c index c535268c6f..455ceb31a8 100644 --- a/src/system/libroot/posix/unistd/sbrk.c +++ b/src/system/libroot/posix/unistd/sbrk.c @@ -7,10 +7,13 @@ #include #include +/* in hoard wrapper */ +extern void *(*sbrk_hook)(long); void * sbrk(long increment) { - // this function is no longer supported + if (sbrk_hook) + return (*sbrk_hook)(increment); return NULL; }