EasySandbox.c
void *sbrk(intptr_t incr)
{
	intptr_t used, remaining;
	void *newbrk;

	if (s_brk == 0) {
		s_brk = s_heap;
	}

	used = s_brk - s_heap;
	remaining = s_heapsize - used;
	
	if (remaining < incr) {
		errno = ENOMEM;
		return (void*) -1;
	}
	newbrk = s_brk;
	s_brk += incr;
	return newbrk;
}
/*
 * Custom implementation of sbrk() that allocates from a fixed-size
 * array of bytes.  This avoids the need for malloc/free and
 * friends to make any system calls.
 */
Custom implementation of sbrk() that allocates from a fixed-size
array of bytes.  This avoids the need for malloc/free and
friends to make any system calls.
Custom implementation of sbrk () that allocates from a fixed - size array of bytes . This avoids the need for malloc / free and friends to make any system calls .
void *sbrk(intptr_t incr)
{
	intptr_t used, remaining;
	void *newbrk;
	if (s_brk == 0) {
		s_brk = s_heap;
	}
	used = s_brk - s_heap;
	remaining = s_heapsize - used;
	if (remaining < incr) {
		errno = ENOMEM;
		return (void*) -1;
	}
	newbrk = s_brk;
	s_brk += incr;
	return newbrk;
}
void * sbrk ( intptr_t incr ) { intptr_t used , remaining ; void * newbrk ; if ( s_brk == 0 ) { s_brk = s_heap ; } used = s_brk - s_heap ; remaining = s_heapsize - used ; if ( remaining < incr ) { errno = ENOMEM ; return ( void * ) -1 ; } newbrk = s_brk ; s_brk += incr ; return newbrk ; }
Custom implementation of sbrk() that allocates from a fixed-size
 array of bytes.
Custom implementation of sbrk () that allocates from a fixed - size array of bytes .