92 lines
1.0 KiB
C
92 lines
1.0 KiB
C
#include <errno.h>
|
|
#include <stddef.h>
|
|
#include <sys/types.h>
|
|
|
|
extern char _end;
|
|
|
|
static char *heap_end;
|
|
|
|
caddr_t _sbrk(int incr)
|
|
{
|
|
extern char _estack;
|
|
char *prev;
|
|
|
|
if (heap_end == NULL)
|
|
{
|
|
heap_end = &_end;
|
|
}
|
|
|
|
prev = heap_end;
|
|
if ((heap_end + incr) >= (&_estack - 0x800))
|
|
{
|
|
errno = ENOMEM;
|
|
return (caddr_t)-1;
|
|
}
|
|
|
|
heap_end += incr;
|
|
return (caddr_t)prev;
|
|
}
|
|
|
|
int _write(int file, char *ptr, int len)
|
|
{
|
|
(void)file;
|
|
(void)ptr;
|
|
return len;
|
|
}
|
|
|
|
int _read(int file, char *ptr, int len)
|
|
{
|
|
(void)file;
|
|
(void)ptr;
|
|
(void)len;
|
|
return 0;
|
|
}
|
|
|
|
int _close(int file)
|
|
{
|
|
(void)file;
|
|
return -1;
|
|
}
|
|
|
|
int _fstat(int file, void *st)
|
|
{
|
|
(void)file;
|
|
(void)st;
|
|
return 0;
|
|
}
|
|
|
|
int _isatty(int file)
|
|
{
|
|
(void)file;
|
|
return 1;
|
|
}
|
|
|
|
int _lseek(int file, int ptr, int dir)
|
|
{
|
|
(void)file;
|
|
(void)ptr;
|
|
(void)dir;
|
|
return 0;
|
|
}
|
|
|
|
void _exit(int status)
|
|
{
|
|
(void)status;
|
|
while (1)
|
|
{
|
|
}
|
|
}
|
|
|
|
int _kill(int pid, int sig)
|
|
{
|
|
(void)pid;
|
|
(void)sig;
|
|
errno = EINVAL;
|
|
return -1;
|
|
}
|
|
|
|
int _getpid(void)
|
|
{
|
|
return 1;
|
|
}
|