mdapoz@hybrid.uucp (Mark Dapoz) (05/06/90)
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 so I'm wondering if the kernel is even picking up on the fact that nfile
has been increased. Also, I seem to be losing kernel file descriptors since
if I run the above program on my system right now, it'll report a value of
46 but when I first booted it would report 77. The system has been up and
running for just over 8 days. Has anyone else experienced problems with
maximum open files? How can I get the system to really let me open as many
files as nfile is set to?
--
Managing a software development team | Mark Dapoz
is a lot like being on the psychiatric | mdapoz%hybrid@cs.toronto.edu
ward. -Mitch Kapor, San Jose Mercury | ...uunet!mnetor!hybrid!mdapoz
djl@dplace.UUCP (Dave Lampe) (05/07/90)
mdapoz@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)