summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMateusz Guzik <mjg@FreeBSD.org>2019-08-17 17:42:01 +0000
committerMateusz Guzik <mjg@FreeBSD.org>2019-08-17 17:42:01 +0000
commitb05641b6bde45eb526b4247c68956587c10a9ea9 (patch)
treeeb6013fd9de0bcfe1bd58dda32a2c29c18d01a4d
parent60df116853641945faa904d69ff1c1834518cc52 (diff)
Notes
-rw-r--r--sys/kern/kern_fork.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index c292be55e97c..28ef275ba274 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -258,20 +258,13 @@ fork_findpid(int flags)
}
mtx_lock(&procid_lock);
retry:
- /*
- * If the process ID prototype has wrapped around,
- * restart somewhat above 0, as the low-numbered procs
- * tend to include daemons that don't exit.
- */
- if (trypid >= pid_max) {
- trypid = trypid % pid_max;
- if (trypid < 100)
- trypid += 100;
- }
+ if (trypid >= pid_max)
+ trypid = 2;
bit_ffc_at(&proc_id_pidmap, trypid, pid_max, &result);
if (result == -1) {
- trypid = 100;
+ KASSERT(trypid != 2, ("unexpectedly ran out of IDs"));
+ trypid = 2;
goto retry;
}
if (bit_test(&proc_id_grpidmap, result) ||