From 02ca8f9faf6b6ddd0b7a514503b223e9ecbe8fe9 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Thu, 15 May 2025 17:41:29 -0400 Subject: kernel: proc: Do not introduce fork() Simplicity is divine, fork() may be powerful but is no longer simple. It became a thing in the late 70s during the early days of UNIX when computing was simple, when CPUs were only 16-bits, MMUs were not prevalent and RAM was only 512 KB. However it isn't 1971 anymore, process management, CPUs and memory architecture has advanced significantly since. This commit ceases work on the fork() syscall as implementing it would only introduce unnecessary complexity, security issues, hefty processing overhead and would perpetuate what should now be considered legacy. The current best alternative would be providing a form of process spawning as well as a mechanism to wait for the child process to complete. Signed-off-by: Ian Moffett --- sys/include/sys/proc.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sys/include') diff --git a/sys/include/sys/proc.h b/sys/include/sys/proc.h index c561e91..d252ab7 100644 --- a/sys/include/sys/proc.h +++ b/sys/include/sys/proc.h @@ -76,7 +76,8 @@ struct proc { #define PROC_EXEC BIT(1) /* Exec called (cleared by sched) */ struct proc *this_td(void); -int md_fork(struct proc *p, struct proc *parent, uintptr_t ip); +int md_spawn(struct proc *p, struct proc *parent, uintptr_t ip); +int spawn(struct proc *cur, int flags, void(*ip)(void), struct proc **newprocp); void md_td_stackinit(struct proc *td, void *stack_top, struct exec_prog *prog); __dead void md_td_kick(struct proc *td); -- cgit v1.2.3