From b3c5c18d368801f0835cb4e8b810d25c4c5ef3db Mon Sep 17 00:00:00 2001 From: Bruce Evans Date: Mon, 27 Jan 1997 12:43:36 +0000 Subject: 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. --- sys/kern/init_main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index 37ac64808f3f..24c8ffb0eb2f 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -46,6 +46,7 @@ #include "opt_devfs.h" #include +#include #include #include #include @@ -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; -- cgit v1.3