number of simultanously opened files
Sam Lawrance
boris at brooknet.com.au
Sun Aug 21 13:30:56 GMT 2005
On Sun, 2005-08-21 at 11:48 +0200, Divacky Roman wrote:
> hi
>
> I wrote this:
> witten /tmp# cat x.c
> #include <stdio.h>
> #include <fcntl.h>
> #include <sys/limits.h>
>
> #define MAX 100000
> main()
> {
> int i = MAX;
>
> for (; i>0; i--) {
> if (open("/dev/null", O_RDONLY) == -1) {
> printf("FUCK: %i\n", MAX-i);
> printf("FUCK: %i\n", i);
> break;
> }
> }
> getchar();
> }
>
> set:
>
> witten ~# sysctl kern.maxfiles=100000
> kern.maxfiles: 100000 -> 100000
> witten ~# sysctl kern.maxfilesperproc=100000
> kern.maxfilesperproc: 100000 -> 100000
> witten ~#
>
> but I still cannot open more than 7319 files simultaneously. pls can you tell
> me why?
Possibly because maximum open files is a per-process value that is set
at process creation, and also inherited, so you won't see the change in
existing processes.
Try setting it before boot, or maybe restarting a login on a vty might
work.
Cheers
Sam
Sam Lawrance lawrance at FreeBSD.org
ph +61 0425 228 579 boris at brooknet.com.au
More information about the freebsd-hackers
mailing list