From: David Given Date: Wed, 23 Nov 2016 21:04:21 +0000 (+0100) Subject: Combine brk() with sbrk(); modify brk() to update the sbrk(0) value. X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=0aac9aafd3a4e81171d1a4a4ed50f39366df1450;p=ack.git Combine brk() with sbrk(); modify brk() to update the sbrk(0) value. --- diff --git a/plat/linux/libsys/brk.c b/plat/linux/libsys/brk.c deleted file mode 100644 index 7ce5c5fc8..000000000 --- a/plat/linux/libsys/brk.c +++ /dev/null @@ -1,17 +0,0 @@ -/* $Source: /cvsroot/tack/Ack/plat/linux386/libsys/brk.c,v $ - * $State: Exp $ - * $Revision: 1.1 $ - */ - -#include -#include -#include -#include "libsys.h" - -int brk(void* end) -{ - int e = _syscall(__NR_brk, (quad) end, 0, 0); - if (e == -1) - errno = ENOMEM; - return e; -} diff --git a/plat/linux/libsys/sbrk.c b/plat/linux/libsys/sbrk.c index 35810ef89..0948a41b8 100644 --- a/plat/linux/libsys/sbrk.c +++ b/plat/linux/libsys/sbrk.c @@ -12,6 +12,16 @@ static char* current = NULL; +int brk(void* end) +{ + int e = _syscall(__NR_brk, (quad) end, 0, 0); + if (e == -1) + errno = ENOMEM; + else + current = end; + return e; +} + void* sbrk(intptr_t increment) { char* old;