diff options
author | Marvin Borner | 2020-05-11 23:36:08 +0200 |
---|---|---|
committer | Marvin Borner | 2020-05-11 23:36:08 +0200 |
commit | fa5aa82470783d20621f3d21e419f5b8ce70ad0a (patch) | |
tree | 03b175f47f918bcea522a1da2ce82f754e0e64a5 /src | |
parent | fe4280eb69fbeb386b5442b3aeb515dde1c117ec (diff) |
Fixed process name and added process tree print
Diffstat (limited to 'src')
-rw-r--r-- | src/kernel/interrupts/isr.c | 3 | ||||
-rw-r--r-- | src/kernel/tasks/process.c | 16 | ||||
-rw-r--r-- | src/kernel/tasks/process.h | 2 |
3 files changed, 19 insertions, 2 deletions
diff --git a/src/kernel/interrupts/isr.c b/src/kernel/interrupts/isr.c index 8bfb7bd..1ad5f67 100644 --- a/src/kernel/interrupts/isr.c +++ b/src/kernel/interrupts/isr.c @@ -126,7 +126,8 @@ void fault_handler(struct regs *r) } if (current_proc != NULL) { - warn("%s: Halting process %d", message, current_proc->pid); + warn("%s: Suspending process %s with ID %d", message, current_proc->name, + current_proc->pid); memcpy(¤t_proc->registers, r, sizeof(struct regs)); process_suspend(current_proc->pid); process_force_switch(r); diff --git a/src/kernel/tasks/process.c b/src/kernel/tasks/process.c index a361355..2f45898 100644 --- a/src/kernel/tasks/process.c +++ b/src/kernel/tasks/process.c @@ -74,6 +74,21 @@ void process_init(struct process *proc) userspace_enter(proc); } +// Only for debugging purposes +void process_print_tree() +{ + serial_put('\n'); + info("PROCESS TREE"); + struct process *proc = root; + + while (proc != NULL) { + info("%s with PID %d (state: %s)", proc->name, proc->pid, + proc->state == PROC_RUNNING ? "running" : "sleeping"); + proc = proc->next; + } + serial_put('\n'); +} + u32 process_spawn(struct process *process) { debug("Spawning process %d", process->pid); @@ -82,6 +97,7 @@ u32 process_spawn(struct process *process) process->state = PROC_RUNNING; process->parent = current_proc; + process_print_tree(); //process_suspend(current_proc->pid); diff --git a/src/kernel/tasks/process.h b/src/kernel/tasks/process.h index c015df9..b10c63c 100644 --- a/src/kernel/tasks/process.h +++ b/src/kernel/tasks/process.h @@ -18,7 +18,7 @@ struct process { u32 pid; u32 gid; - char *name; + char name[256]; int state; int thread; |