summaryrefslogtreecommitdiff
path: root/sys/kern/kern_spawn.c
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-08-11 04:57:52 -0400
committerIan Moffett <ian@osmora.org>2025-08-11 04:57:52 -0400
commitac5d6bcfa52d97f3d0d00773506464a256dcb678 (patch)
tree19071f546ab916099c6d4834be87c1982944a11a /sys/kern/kern_spawn.c
parent7fc5f9b02fa12918188123167bbfec9178726e53 (diff)
kernel: Increment g_nthreads in proc_init() only
It seems somewhat dangerous to have to manually increment the number of threads every time we make a process. This change makes every call to proc_init() increment the number of threads. The value is decremented once the process exits. Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/kern/kern_spawn.c')
-rw-r--r--sys/kern/kern_spawn.c5
1 files changed, 0 insertions, 5 deletions
diff --git a/sys/kern/kern_spawn.c b/sys/kern/kern_spawn.c
index 5f9262d..7962ced 100644
--- a/sys/kern/kern_spawn.c
+++ b/sys/kern/kern_spawn.c
@@ -34,10 +34,8 @@
#include <sys/mman.h>
#include <sys/systm.h>
#include <sys/errno.h>
-#include <sys/atomic.h>
#include <sys/syslog.h>
#include <sys/syscall.h>
-#include <sys/atomic.h>
#include <sys/signal.h>
#include <sys/limits.h>
#include <sys/sched.h>
@@ -50,7 +48,6 @@
#define ARGVP_MAX (ARG_MAX / sizeof(void *))
static size_t next_pid = 1;
-extern volatile size_t g_nthreads;
/*
* TODO: envp
@@ -183,8 +180,6 @@ spawn(struct proc *cur, void(*func)(void), void *p, int flags, struct proc **new
}
newproc->data = p;
- atomic_inc_64(&g_nthreads);
-
newproc->pid = next_pid++;
sched_enqueue_td(newproc);
pid = newproc->pid;