diff options
author | kib <kib@FreeBSD.org> | 2012-08-15 15:56:21 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2012-08-15 15:56:21 +0000 |
commit | 604f552e40a9a201162d6c070fd96bc504b30ff3 (patch) | |
tree | a9682200639371dd135caf82e8d5130aa117d0c2 /sys/kern/kern_fork.c | |
parent | ba66fb6ab507c9347d6b74704834eddfad52ed48 (diff) | |
download | FreeBSD-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_fork.c')
-rw-r--r-- | sys/kern/kern_fork.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index 6cb95cd..46cdca1 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -209,8 +209,8 @@ sysctl_kern_randompid(SYSCTL_HANDLER_ARGS) pid = randompid; error = sysctl_handle_int(oidp, &pid, 0, req); if (error == 0 && req->newptr != NULL) { - if (pid < 0 || pid > PID_MAX - 100) /* out of range */ - pid = PID_MAX - 100; + if (pid < 0 || pid > pid_max - 100) /* out of range */ + pid = pid_max - 100; else if (pid < 2) /* NOP */ pid = 0; else if (pid < 100) /* Make it reasonable */ @@ -259,8 +259,8 @@ retry: * 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 >= pid_max) { + trypid = trypid % pid_max; if (trypid < 100) trypid += 100; pidchecked = 0; |