From fa5aa82470783d20621f3d21e419f5b8ce70ad0a Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Mon, 11 May 2020 23:36:08 +0200 Subject: Fixed process name and added process tree print --- src/kernel/tasks/process.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/kernel/tasks/process.c') 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); -- cgit v1.2.3