Kernel, libc: Remove spawn()

Now, fork() and exec() are both implemented. More POSIX-y, thus spawn can be removed.
This commit is contained in:
apio 2022-10-17 19:55:01 +02:00
parent 55808d5cc4
commit 87ef210759
7 changed files with 4 additions and 39 deletions

View File

@ -18,9 +18,8 @@
#define SYS_fcntl 13
#define SYS_mprotect 14
#define SYS_clock 15
#define SYS_spawn 16
#define SYS_mkdir 17
#define SYS_fork 18
#define SYS_mkdir 16
#define SYS_fork 17
namespace Syscall
{
@ -45,6 +44,5 @@ void sys_exec(Context* context, const char* pathname);
void sys_fcntl(Context* context, int fd, int command, uintptr_t arg);
void sys_mprotect(Context* context, void* address, size_t size, int prot);
void sys_clock(Context* context);
void sys_spawn(Context* context, const char* pathname);
void sys_mkdir(Context* context, const char* filename);
void sys_fork(Context* context);

View File

@ -28,7 +28,6 @@ void Syscall::entry(Context* context)
case SYS_mprotect: sys_mprotect(context, (void*)context->rdi, context->rsi, (int)context->rdx); break;
case SYS_clock: sys_clock(context); break;
case SYS_mkdir: sys_mkdir(context, (const char*)context->rdi); break;
case SYS_spawn: sys_spawn(context, (const char*)context->rdi); break;
case SYS_fork: sys_fork(context); break;
default: context->rax = -ENOSYS; break;
}

View File

@ -126,25 +126,3 @@ void sys_exec(Context* context, const char* pathname)
return;
}
void sys_spawn(Context* context, const char* pathname)
{
char* kpathname = Syscall::strdup_from_user(pathname);
if (!kpathname)
{
context->rax = -EFAULT;
return;
}
kinfoln("spawn(): spawning %s", kpathname);
Task* current_task = Scheduler::current_task();
context->rax = Scheduler::load_user_task(kpathname);
kfree(kpathname);
VMM::switch_to_user_address_space(current_task->address_space);
return;
}

View File

@ -18,9 +18,6 @@ extern "C"
/* Prints a message to standard error and aborts the program. */
__lc_noreturn void __luna_abort(const char* message);
/* Creates a new process from the executable at pathname and returns its PID. */
pid_t spawn(const char* pathname);
#ifdef __cplusplus
}
#endif

View File

@ -17,9 +17,8 @@
#define SYS_fcntl 13
#define SYS_mprotect 14
#define SYS_clock 15
#define SYS_spawn 16
#define SYS_mkdir 17
#define SYS_fork 18
#define SYS_mkdir 16
#define SYS_fork 17
#ifndef __want_syscalls
#ifdef __cplusplus

View File

@ -22,9 +22,4 @@ extern "C"
fputs(message, stderr);
abort();
}
pid_t spawn(const char* pathname)
{
return syscall(SYS_spawn, pathname);
}
}

View File

@ -41,7 +41,6 @@ extern "C"
case SYS_close:
case SYS_exec:
case SYS_mkdir:
case SYS_spawn:
case SYS_sleep: result = __luna_syscall1(number, va_arg(ap, arg)); break;
case SYS_munmap:
case SYS_open: {