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; }