From d0c5a584ab842b3c0829918ceeeacb7a37eb16aa Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Mon, 26 Feb 2024 00:14:10 -0500 Subject: kernel: sched: Fix PID allocation logic Signed-off-by: Ian Moffett --- sys/kern/kern_sched.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sys/kern') diff --git a/sys/kern/kern_sched.c b/sys/kern/kern_sched.c index ff26e0a..01f2efe 100644 --- a/sys/kern/kern_sched.c +++ b/sys/kern/kern_sched.c @@ -43,6 +43,7 @@ * scheduled should be added to this queue. */ static TAILQ_HEAD(, proc) td_queue; +static size_t nthread = 0; /* * Thread queue lock - all operations to `td_queue' @@ -79,7 +80,7 @@ sched_enqueue_td(struct proc *td) spinlock_acquire(&tdq_lock); - td->pid = TAILQ_NELEM(&td_queue); + td->pid = nthread++; TAILQ_INSERT_TAIL(&td_queue, td, link); spinlock_release(&tdq_lock); -- cgit v1.2.3