Turns out I wasn't building the syscall libraries. Do so.

This commit is contained in:
David Given
2016-08-14 11:23:57 +02:00
parent b549980af2
commit 3df4906d52
27 changed files with 41 additions and 5 deletions

39
plat/linux/libsys/sbrk.c Normal file
View File

@@ -0,0 +1,39 @@
/* $Source$
* $State$
* $Revision$
*/
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include "libsys.h"
#define OUT_OF_MEMORY (void*)(-1) /* sbrk returns this on failure */
static char* current = NULL;
void* sbrk(intptr_t increment)
{
char* old;
char* new;
char* actual;
if (!current)
current = (char*) _syscall(__NR_brk, 0, 0, 0);
if (increment == 0)
return current;
old = current;
new = old + increment;
actual = (char*) _syscall(__NR_brk, (quad) new, 0, 0);
if (actual < new)
{
errno = ENOMEM;
return OUT_OF_MEMORY;
}
current = actual;
return old;
}