Luna/libs/libc/src/luna.cpp
apio 9b39d618de Kernel, libc: Implement spawn()
This function is a Luna alternative to fork() and exec().

Why? Simply because I can't figure out for the life of me how to implement a working fork().

So meanwhile, we have spawn() as a replacement. exec() still exists, though.
2022-10-16 18:48:35 +02:00

30 lines
526 B
C++

#include <luna.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/syscall.h>
#include <unistd.h>
extern "C"
{
pid_t gettid()
{
return syscall(SYS_gettid);
}
unsigned int msleep(unsigned int ms)
{
return (unsigned int)syscall(SYS_sleep, ms);
}
__lc_noreturn void __luna_abort(const char* message)
{
fputs(message, stderr);
abort();
}
pid_t spawn(const char* pathname)
{
return syscall(SYS_spawn, pathname);
}
}