#include <u.h>
#include <libc.h>
#include <ureg.h>
#include "linuxsys.h"
#include "linux.h"
SYSCALL(sys_exit)
{
int n = ARG1;
char buf[12];
DPRINT("exit(%d)...\n", n);
if(n == 0)
exits(0);
sprint(buf, "%d", n);
exits(buf);
}
SYSCALL(sys_brk)
{
static void *top;
void *bk = (void*) ARG1;
if(top == nil)
top = bss;
DPRINT("brk(%p)...", bk);
if(bk < bss)
RETURN(top);
if(segbrk(bss, bk) == 0) {
top = bk;
RETURN(0);
}
RETURN(-ENOMEM);
}
SYSCALL(sys_fork)
{
int r;
DPRINT("fork()...");
if((r = fork()) < 0)
RETURN(-EAGAIN);
RETURN(r);
}
SYSCALL(sys_getpid)
{
DPRINT("getpid()...");
RETURN(getpid());
}
SYSCALL(sys_getppid)
{
DPRINT("getppid()...");
RETURN(getppid());
}
|