summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1997-01-27 12:43:36 +0000
committerbde <bde@FreeBSD.org>1997-01-27 12:43:36 +0000
commit403480160033d8fe44d62f585302fa43f6ba55ff (patch)
tree3cc15d7fd953acb5f200c1dcb334ff8e61372427 /sys
parent9fa6f97ca24d9db8ebdbc8985987028fca5bb16d (diff)
downloadFreeBSD-src-403480160033d8fe44d62f585302fa43f6ba55ff.zip
FreeBSD-src-403480160033d8fe44d62f585302fa43f6ba55ff.tar.gz
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.
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/init_main.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
index 37ac648..24c8ffb 100644
--- a/sys/kern/init_main.c
+++ b/sys/kern/init_main.c
@@ -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;
OpenPOWER on IntegriCloud