MFC r288068:

Ensure that maxproc does not exceed pid_max, at the time of boot.
This commit is contained in:
kib 2015-10-05 05:33:30 +00:00
parent 30cb993101
commit b41e3ae634

View File

@ -76,7 +76,7 @@ __FBSDID("$FreeBSD$");
#define NBUF 0 #define NBUF 0
#endif #endif
#ifndef MAXFILES #ifndef MAXFILES
#define MAXFILES (maxproc * 2) #define MAXFILES (40 + 32 * maxusers)
#endif #endif
static int sysctl_kern_vm_guest(SYSCTL_HANDLER_ARGS); static int sysctl_kern_vm_guest(SYSCTL_HANDLER_ARGS);
@ -261,6 +261,8 @@ init_param2(long physpages)
TUNABLE_INT_FETCH("kern.maxproc", &maxproc); TUNABLE_INT_FETCH("kern.maxproc", &maxproc);
if (maxproc > (physpages / 12)) if (maxproc > (physpages / 12))
maxproc = physpages / 12; maxproc = physpages / 12;
if (maxproc > pid_max)
maxproc = pid_max;
maxprocperuid = (maxproc * 9) / 10; maxprocperuid = (maxproc * 9) / 10;
/* /*