Set the soft openfiles limit to maxfiles instead of to NOFILE.
The limit is now only used by init, so it may as well be "infinite". Don't use RLIM_INFINITY, since setrlimit() doesn't allow setting that value. Use maxfiles instead of RLIM_INFINITY for the hard limit for the same reason. Similarly for the maxprocesses limits (use the "infinite" value of maxproc instead if MAXUPRC and RLIM_INFINITY). NOFILES, MAXUPRC, CHILD_MAX and OPEN_MAX are no longer used in /usr/src and should go away. Their values are almost guaranteed to be wrong now that login.conf exists, so anything that uses the values is broken. Unfortunately, there are probably a lot of ports that depend on them being defined. The global limits maxfilesperproc and maxprocperuid should go away too.
This commit is contained in:
parent
9e67849f40
commit
08207e4c10
@ -46,6 +46,7 @@
|
||||
#include "opt_devfs.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/filedesc.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/mount.h>
|
||||
@ -372,8 +373,10 @@ proc0_init(dummy)
|
||||
for (i = 0; i < sizeof(p->p_rlimit)/sizeof(p->p_rlimit[0]); i++)
|
||||
limit0.pl_rlimit[i].rlim_cur =
|
||||
limit0.pl_rlimit[i].rlim_max = RLIM_INFINITY;
|
||||
limit0.pl_rlimit[RLIMIT_NOFILE].rlim_cur = NOFILE;
|
||||
limit0.pl_rlimit[RLIMIT_NPROC].rlim_cur = MAXUPRC;
|
||||
limit0.pl_rlimit[RLIMIT_NOFILE].rlim_cur =
|
||||
limit0.pl_rlimit[RLIMIT_NOFILE].rlim_max = maxfiles;
|
||||
limit0.pl_rlimit[RLIMIT_NPROC].rlim_cur =
|
||||
limit0.pl_rlimit[RLIMIT_NPROC].rlim_max = maxproc;
|
||||
i = ptoa(cnt.v_free_count);
|
||||
limit0.pl_rlimit[RLIMIT_RSS].rlim_max = i;
|
||||
limit0.pl_rlimit[RLIMIT_MEMLOCK].rlim_max = i;
|
||||
|
Loading…
Reference in New Issue
Block a user