Post by Lew Pitcher
I would like to be able to increase the maximum number of open files in
Slackware. After doing some googling, it would seem that one has to do
echo 20000000 > /proc/sys/fs/file-max
The new limit applies immediately. /BUT/, fs/file-max is /NOT/ a
per-process limit (for that, you want to look at something else, like
setrlimit() ); fs/file-max governs the total number of open files
system-wide (the sum of all files opened by all processes). /AND/, it
has an upper limit set by the kernel constant NR_OPEN. (See the
/proc/sys/fs/file-max section of proc(5) for details).
3. Does the limit established as above override the ulimit values?
No. And, you really mean getrlimit(2)/setrlimit(2)/sysconf(3), as
ulimit(3) is obsolete.
If you want to increase the per process limit of file descriptors the
place to look is the man page of initscript which has an example of how
to edit /etc/initscript to increase the hard limit of number of open file
descriptors to allow unprivileged processes to by themselves increase
their soft limits. Even though the api ulimit(3) is obsolete the builtin
command in bash to increase the soft limit is still called "ulimit", if
you instead use tcsh the built in command is called "limit". To see how
to edit the initscript file to increase both the hard and the default
soft limit you will need to read up on ulimit in the man page of bash.
But I would say that it is probably a good idea to reconsider the design
if you are designing a system to have millons of simultaneously open file