minix/lib/other/_sbrk.c

21 lines
368 B
C
Raw Normal View History

2006-06-30 16:40:29 +02:00
#include <lib.h>
#define sbrk _sbrk
#include <unistd.h>
extern char *_brksize;
PUBLIC char *sbrk(incr)
int incr;
{
char *newsize, *oldsize;
oldsize = _brksize;
newsize = _brksize + incr;
if ((incr > 0 && newsize < oldsize) || (incr < 0 && newsize > oldsize))
return( (char *) -1);
if (brk(newsize) == 0)
return(oldsize);
else
return( (char *) -1);
}