Kernel: Add bareboness fork() function

This commit is contained in:
Bananymous
2023-05-28 18:08:26 +03:00
parent 3e93dae53c
commit f2d767b799
14 changed files with 125 additions and 44 deletions

View File

@@ -17,6 +17,7 @@ __BEGIN_DECLS
#define SYS_TELL 10
#define SYS_GET_TERMIOS 11
#define SYS_SET_TERMIOS 12
#define SYS_FORK 13
__END_DECLS

View File

@@ -103,6 +103,11 @@ long syscall(long syscall, ...)
ret = Kernel::syscall(SYS_SET_TERMIOS, (uintptr_t)termios);
break;
}
case SYS_FORK:
{
ret = Kernel::syscall(SYS_FORK);
break;
}
default:
puts("LibC: Unhandeled syscall");
ret = -ENOSYS;
@@ -122,25 +127,5 @@ long syscall(long syscall, ...)
pid_t fork(void)
{
return -1;
}
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 getpid(void)
{
return -1;
return syscall(SYS_FORK);
}