minix/lib/nbsd_libc/sys-minix/sbrk.c
Gianluca Guida 4f294c247f Add NBSDLibc Minix specific files.
This patch mainly copies and modifies files existing in
the current libc implementing minix specific functions.

To keep consisten with the NetBSD libc, we remove 
namespace stubs and we use "namespace.h" and weak
links.
2011-02-17 17:11:09 +00:00

27 lines
455 B
C

#include <sys/cdefs.h>
#include "namespace.h"
#include <lib.h>
#include <unistd.h>
#ifdef __weak_alias
__weak_alias(sbrk, _sbrk)
#endif
extern char *_brksize;
PUBLIC void *sbrk(incr)
intptr_t 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);
}