---------------------------------------------------------------------------
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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/