Combine brk() with sbrk(); modify brk() to update the sbrk(0) value.

This commit is contained in:
David Given 2016-11-23 22:04:21 +01:00
parent 0b21f18d4c
commit 0aac9aafd3
2 changed files with 10 additions and 17 deletions

View file

@ -1,17 +0,0 @@
/* $Source: /cvsroot/tack/Ack/plat/linux386/libsys/brk.c,v $
* $State: Exp $
* $Revision: 1.1 $
*/
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include "libsys.h"
int brk(void* end)
{
int e = _syscall(__NR_brk, (quad) end, 0, 0);
if (e == -1)
errno = ENOMEM;
return e;
}

View file

@ -12,6 +12,16 @@
static char* current = NULL; 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) void* sbrk(intptr_t increment)
{ {
char* old; char* old;