aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/syscall/actions
diff options
context:
space:
mode:
authorMarvin Borner2020-05-07 18:10:22 +0200
committerMarvin Borner2020-05-07 18:10:22 +0200
commit4286b14839c0c4ec016d816e426660f6685ae349 (patch)
treeccfefa4313d012fb78d8252cff98d27dfd187dc8 /src/kernel/syscall/actions
parent130121dd61a9adf70d1800ceb03007275bfb589d (diff)
Fixed many bugs with wait() and fork()
This also adds many race conditions which really need to be fixed..
Diffstat (limited to 'src/kernel/syscall/actions')
-rw-r--r--src/kernel/syscall/actions/sys_exec.c1
-rw-r--r--src/kernel/syscall/actions/sys_fork.c5
-rw-r--r--src/kernel/syscall/actions/sys_wait.c3
3 files changed, 8 insertions, 1 deletions
diff --git a/src/kernel/syscall/actions/sys_exec.c b/src/kernel/syscall/actions/sys_exec.c
index 049d085..99c6539 100644
--- a/src/kernel/syscall/actions/sys_exec.c
+++ b/src/kernel/syscall/actions/sys_exec.c
@@ -1,5 +1,6 @@
#include <stdint.h>
#include <tasks/process.h>
+#include <io/io.h>
u32 sys_exec(char *path)
{
diff --git a/src/kernel/syscall/actions/sys_fork.c b/src/kernel/syscall/actions/sys_fork.c
index f0a5711..084659e 100644
--- a/src/kernel/syscall/actions/sys_fork.c
+++ b/src/kernel/syscall/actions/sys_fork.c
@@ -4,16 +4,19 @@
#include <tasks/process.h>
#include <lib/lib.h>
#include <system.h>
+#include <io/io.h>
u32 sys_fork(struct regs *r)
{
+ cli();
struct page_directory *dir = paging_copy_user_directory(current_proc->cr3);
struct process *proc = process_make_new();
proc->cr3 = dir;
memcpy(&proc->registers, r, sizeof(struct regs));
proc->registers.eax = proc->pid;
- proc->pid = current_proc->pid;
+ proc->pid = current_proc->pid + 1;
+ sti();
process_spawn(proc);
return 0;
diff --git a/src/kernel/syscall/actions/sys_wait.c b/src/kernel/syscall/actions/sys_wait.c
index 7cea24f..6015b8b 100644
--- a/src/kernel/syscall/actions/sys_wait.c
+++ b/src/kernel/syscall/actions/sys_wait.c
@@ -1,7 +1,10 @@
+#include <stdint.h>
#include <tasks/process.h>
+#include <io/io.h>
u32 sys_wait(u32 pid, u32 *status, u32 options)
{
+ sti();
u32 ret;
if (pid < 0) { // Wait for any process in gid to die