From 4ca728bb28bb9d1066320555233c94fdc5d75e58 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Wed, 18 Aug 2021 19:51:42 +0200 Subject: processes now store a PID for debugging purposes --- src/kernel/proc.c | 4 ++++ src/kernel/proc.h | 2 ++ 2 files changed, 6 insertions(+) (limited to 'src') diff --git a/src/kernel/proc.c b/src/kernel/proc.c index eea651f..eb36caf 100644 --- a/src/kernel/proc.c +++ b/src/kernel/proc.c @@ -6,6 +6,7 @@ struct process *process_first; struct process *process_current; +uint32_t next_pid = 0; struct process *process_seed() { struct process *proc = kmalloc(sizeof(struct process)); @@ -14,6 +15,7 @@ struct process *process_seed() { proc->sibling = NULL; proc->child = NULL; proc->parent = NULL; + proc->id = next_pid++; process_first = proc; @@ -41,6 +43,8 @@ struct process *process_fork(struct process *parent) { child->parent = parent; parent->child = child; + child->id = next_pid++; + return child; } diff --git a/src/kernel/proc.h b/src/kernel/proc.h index f50ab33..6bafca9 100644 --- a/src/kernel/proc.h +++ b/src/kernel/proc.h @@ -15,6 +15,8 @@ struct process { struct process *sibling; struct process *child; struct process *parent; + + uint32_t id; // only for debugging, don't expose to userland }; extern struct process *process_first; -- cgit v1.2.3