Problems with fopen and many open files
Mattias.Gronlund at sa.erisoft.se
Thu Sep 16 21:03:03 GMT 1999
Frank van Maarseveen wrote:
> I think Solaris uses sysconf(_SC_OPEN_MAX). On a Solaris 2.7 it says 64
> though. File descriptor 320 is quite high with this _SC_OPEN_MAX but
> maybe only real files are counted and no network connections.
> In <stdio.h> there are other defines which may also be the cause: _NFILE
> and FOPEN_MAX but this depends on the compiler & C library being used.
I do not care that much which define that is limiting the libc in
The problem is that it is hardly limited.
This limit is two fold.
1. We can't have more than 64 fopen:ed files.
2. A fopen:ed file can't be connected to a filedescriptor higher than
I'm going to implement a local patch that open /dev/null for fd 3 right
at the begining of smbd. And then make sys_fopen close that descriptor
just before calling fopen. Then let sys_fclose open /dev/null right
But I would like more comments on how to solve this in comming releases
Should we do this fd-preallocation on platforms that can't handle fopen
when all low fd:s are in use?
Or should we just remove our need for fopen and use open insted?
What do you think?
More information about the samba-technical