summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_thread.c
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2012-08-15 15:56:21 +0000
committerkib <kib@FreeBSD.org>2012-08-15 15:56:21 +0000
commit604f552e40a9a201162d6c070fd96bc504b30ff3 (patch)
treea9682200639371dd135caf82e8d5130aa117d0c2 /sys/kern/kern_thread.c
parentba66fb6ab507c9347d6b74704834eddfad52ed48 (diff)
downloadFreeBSD-src-604f552e40a9a201162d6c070fd96bc504b30ff3.zip
FreeBSD-src-604f552e40a9a201162d6c070fd96bc504b30ff3.tar.gz
Add a sysctl kern.pid_max, which limits the maximum pid the system is
allowed to allocate, and corresponding tunable with the same name. Note that existing processes with higher pids are left intact. MFC after: 1 week
Diffstat (limited to 'sys/kern/kern_thread.c')
-rw-r--r--sys/kern/kern_thread.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c
index 69a416e..d21763c 100644
--- a/sys/kern/kern_thread.c
+++ b/sys/kern/kern_thread.c
@@ -269,7 +269,11 @@ threadinit(void)
{
mtx_init(&tid_lock, "TID lock", NULL, MTX_DEF);
- /* leave one number for thread0 */
+
+ /*
+ * pid_max cannot be greater then PID_MAX.
+ * leave one number for thread0.
+ */
tid_unrhdr = new_unrhdr(PID_MAX + 2, INT_MAX, &tid_lock);
thread_zone = uma_zcreate("THREAD", sched_sizeof_thread(),
OpenPOWER on IntegriCloud