Maximum open file descriptors in 3.51m kernel

Dave Lampe djl at dplace.UUCP
Mon May 7 05:23:54 AEST 1990


mdapoz at hybrid.uucp (Mark Dapoz) writes:

>I seem to be running into a problem with the maximum number of open files
>the 3.51m kernel can handle.  I've bumped the parameter nfile to have a
>value of 300 but whenever I run the following program it can only open
>a maximum of 77 files.

>main()
>{
>	int x=0;

>	while (fopen("/dev/null", "r") != 0)
>	    x++;
>	printf("%d\n", x);
>}

>Now, the default minimum value for nfile is 80 which is suspiciously close to
>77

I can't run 3.51m so I can't test this but I think the problem is the standard
I/O library.  Notice that you are using fopen, not open. Before fopen even
attempts to open the file it checks to be sure that there is an available
iobuf structure.  The limit in stdio is obviously set to the default for the
kernal.  Then reason you only get 77 is because you still have stdin, stdout
and stderr open. If you have source for the library it is easy to fix, without
it you can try changing _NFILE in stdio.h but I suspect that is an output
parameter, not an input parameter.  There was source for a stdio replacement
posted to alt.sources by Steve Summit in February.
-- 
Dave Lampe
{ames | lll-tis | sun | pyramid}!pacbell!dplace!djl
(415) 455-1571 (H)
(408) 986-9770 (W)



More information about the Comp.sys.att mailing list