diff options
Diffstat (limited to 'newlib/libc/sys/sysvi386/sbrk.c')
-rw-r--r-- | newlib/libc/sys/sysvi386/sbrk.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/newlib/libc/sys/sysvi386/sbrk.c b/newlib/libc/sys/sysvi386/sbrk.c new file mode 100644 index 0000000..8ae3ed1 --- /dev/null +++ b/newlib/libc/sys/sysvi386/sbrk.c @@ -0,0 +1,21 @@ +extern end; + +static void *curbrk = (char*)&end; + +void * +sbrk(incr) +int incr; { + extern int errno; + extern int _brk(void *); + void *ptr = curbrk; + int t; + + if (incr == 0) + return curbrk; + t = _brk (curbrk + incr); + if (t == -1 && errno) + return (void *)-1; + curbrk = ((char *)curbrk) + incr; + return ptr; +} + |