Luna/libs/libc/src/unistd.cpp

58 lines
1.4 KiB
C++
Raw Normal View History

#include <luna/syscall.h>
#include <stdarg.h>
#include <unistd.h>
extern "C"
{
int execv(const char*, char* const[])
{
return -1;
}
int execve(const char*, char* const[], char* const[])
{
return -1;
}
int execvp(const char*, char* const[])
{
return -1;
}
pid_t fork(void)
{
return -1;
}
long syscall(long number, ...)
{
typedef unsigned long int arg;
long result;
va_list ap;
va_start(ap, number);
switch (number)
{
case SYS_exit:
case SYS_yield:
case SYS_gettid:
case SYS_rand: result = __luna_syscall0(number); break;
case SYS_sleep: result = __luna_syscall1(number, va_arg(ap, arg)); break;
case SYS_write:
case SYS_version: {
arg arg0 = va_arg(ap, arg);
arg arg1 = va_arg(ap, arg);
result = __luna_syscall2(number, arg0, arg1);
break;
}
case SYS_paint: {
arg arg0 = va_arg(ap, arg);
arg arg1 = va_arg(ap, arg);
arg arg2 = va_arg(ap, arg);
arg arg3 = va_arg(ap, arg);
arg arg4 = va_arg(ap, arg);
result = __luna_syscall5(number, arg0, arg1, arg2, arg3, arg4);
break;
}
default: result = -1; break;
}
va_end(ap);
return result;
}
}