diff options
author | Marvin Borner | 2020-05-12 20:28:08 +0200 |
---|---|---|
committer | Marvin Borner | 2020-05-12 20:28:08 +0200 |
commit | 3b16ca421aad772e0f40716e2fc66215d322f7f7 (patch) | |
tree | e0f79fd2e3c16ddb80ce2cbdd2fb13036d59687c /src/kernel/tasks/process.c | |
parent | b28552c99b9d2bf59407411c9514d18af3d392c0 (diff) |
Still searching the bug...
And fixed many other small ones
Diffstat (limited to 'src/kernel/tasks/process.c')
-rw-r--r-- | src/kernel/tasks/process.c | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/src/kernel/tasks/process.c b/src/kernel/tasks/process.c index a5b9c87..45c9937 100644 --- a/src/kernel/tasks/process.c +++ b/src/kernel/tasks/process.c @@ -67,7 +67,6 @@ void process_init(struct process *proc) root = proc; root->pid = pid++; root->next = NULL; - root->thread = PROC_ROOT; // Unkillable root->state = PROC_RUNNING; current_proc = root; @@ -105,23 +104,6 @@ u32 process_spawn(struct process *process) return process->pid; } -u32 process_wait_gid(u32 gid, u32 *status) -{ - struct process *i = root; - - while (i != NULL) { - if (i->gid == gid) - if (i->state == PROC_ASLEEP) { - *status = i->registers.ebx; - return i->pid; - } - - i = i->next; - } - - return WAIT_OKAY; -} - u32 process_wait_pid(u32 pid, u32 *status) { struct process *i = current_proc->next; @@ -144,6 +126,9 @@ u32 process_wait_pid(u32 pid, u32 *status) void process_suspend(u32 pid) { debug("Suspending process %d", pid); + if (pid == 1) + panic("Root process died"); + struct process *proc = process_from_pid(pid); if (proc == PID_NOT_FOUND) { @@ -152,6 +137,7 @@ void process_suspend(u32 pid) } proc->state = PROC_ASLEEP; + process_force_switch(); } void process_wake(u32 pid) @@ -163,6 +149,7 @@ void process_wake(u32 pid) return; proc->state = PROC_RUNNING; + process_force_switch(); } u32 process_child(struct process *child, u32 pid) @@ -220,6 +207,7 @@ u32 kexec(char *path) return -1; process_init(proc); + process_force_switch(); return 0; } |