vx32

Local 9vx git repository for patches.
git clone git://r-36.net/vx32
Log | Files | Refs

sbrk.c (328B)


      1 #include <unistd.h>
      2 #include <errno.h>
      3 #include "syscall.h"
      4 
      5 extern void end;
      6 
      7 static void *brk = &end;
      8 
      9 void *sbrk(intptr_t increment)
     10 {
     11 	void *oldbrk = brk;
     12 	void *newbrk = (char*)brk + increment;
     13 	int ret = syscall(VXSYSBRK, (unsigned)newbrk, 0, 0, 0, 0);
     14 	if(ret == -1)
     15 		return (void*)-1;
     16 	brk = newbrk;
     17 	return oldbrk;
     18 }
     19