/proc/sys/fs/file-max broken in 2.4.22-pre5
Setting /proc/sys/fs/file-max to 60000 results in a max of 1024 file handles. In 2.4.21-rc7-ac1 and random earlier kernels this works as expected.
---------------------------------------------------------------------------
root@athlon:/root # cat file-max.c
#include <sys/time.h>
#include <sys/resource.h>
#include <unistd.h>
main() {
int i = 0;
struct rlimit r;
getrlimit(RLIMIT_NOFILE, &r);
r.rlim_cur = 50000;
setrlimit(RLIMIT_NOFILE, &r);
while(1) {
if(fopen("/tmp/file-max-test", "w") == 0) {
perror("");
break;
}
i++;
}
printf("opened %d files\n", i);
}root@athlon:/root # echo 60000 > /proc/sys/fs/file-max root@athlon:/root # cc file-max.c
root@athlon:/root # a.out
Too many open files
opened 1021 files
root@athlon:/root # uname -a
Linux athlon 2.4.22-pre5 #2 SMP Sun Jul 13 12:38:04 PDT 2003 i686 unknown
Quoted 7 lines · Andrew Burgess
root@athlon:/root # echo 60000 >
/proc/sys/fs/file-maxroot@athlon:/root # ccfile-max.c
root@athlon:/root # a.out
Too many open files
opened 1021 files
root@athlon:/root # uname -a
Linux athlon 2.4.22-pre5 #2 SMP Sun Jul 13 12:38:04 PDT 2003 i686 unknown
ulimit -n ?
Willy