I appreciate that I am now on my own. FWIW, though, your statement below is untrue, at least on Solaris 8. Open is not limited in the same way that fopen is w/ regard to # of fds. Also, fwiw, nether is socket(2).
OPEN: [craigk:/tmp]$ cat /home/craigk/tmp/fopen/foo2.c #include <stdio.h> #include <errno.h> #include <fcntl.h> int main() { int i = 0; int ret; char filename[100]; do { sprintf(filename, "file.%d", i++); ret = open(filename, O_CREAT); } while (ret != -1); fprintf(stderr, "Made it %d times. Errno %d (%s)\n", i, errno, strerror(errno)); } [craigk:/tmp]$ ulimit -n 2048 [craigk:/tmp]$ /home/craigk/tmp/fopen/foo2 Made it 2046 times. Errno 24 (Too many open files) FOPEN: craigk:/tmp]$ cat /home/craigk/tmp/fopen/foo.c #include <stdio.h> #include <errno.h> #include <fcntl.h> int main() { int i = 0; FILE *ret; char filename[100]; do { sprintf(filename, "file.%d", i++); ret = fopen(filename, "a"); } while (ret); fprintf(stderr, "Made it %d times. Errno %d (%s)\n", i, errno, strerror(errno)); } [craigk:/tmp]$ ulimit -n 2048 [craigk:/tmp]$ /home/craigk/tmp/fopen/foo Made it 254 times. Errno 24 (Too many open files) Cheers, Craig Lutz Jaenicke via RT wrote: > On Wed, Sep 11, 2002 at 09:21:09AM +0200, Craig Kaes via RT wrote: > >>OPEN_MAX, the max # of fds allowable to me is honored by fopen and on >>BSD and Gnu this value tracks ulimit values. On Solaris, tho, it >>appears hard coded. To wit: >> >>[craigk:~/tmp/fopen]$ cat foo.c >>#include <stdio.h> >>#include <errno.h> >> >>int main() >>{ >> int i = 0; >> while (fopen("/etc/passwd", "r")) >> { >> i++; >> } >> fprintf(stderr, "Made it %d times. Errno %d (%s)\n", i, errno, >> strerror(errno)); >>} >>[craigk:~/tmp/fopen]$ ulimit -n >>16384 >>[craigk:~/tmp/fopen]$ ./foo >>Made it 253 times. Errno 24 (Too many open files) >>[craigk:~/tmp/fopen]$ uname -a >>SunOS dev3 5.8 Generic_108528-15 sun4u sparc SUNW,Ultra-60 >> >>Errored out at 253 + stdin + stdout + stderr = 256. How do I work >>around this issue without rewriting all the BIO stuff to use >>open/read/write/etc.? Have others encountered and solved this problem? >> Both the multiplexor and the little fopen test program work the way >>I'd like them to work on Linux. > > > The "Too many open files" issue is caused by a table limit to the number > of open files. It does not matter whether you are using buffered (stdio.h: > fopen, fread, ...) or unbuffered (io.h: open, read, ...) I/O is used. > > Depending on the system, the corresponding table sizes are the number > of file descriptors per process and for the overall system, which > may be generous (Linux defaults to 1024) or small (HP-UX 10.20 defaults > to 70(?)). Linux allows even to dynamically extend this value, if > memory serves me right. On HP-UX these table sizes are kernel settings. > One has to change the settings and recompile the kernel (and reboot). > I don't know how this is handled under Solaris. > > Please also note, that several processes rely on "select()", which > may require special handling once the number of open file descriptors > exceeds FD_SETSIZE. > > This is no problem of OpenSSL but of your system setup. I will therefore > close this ticket. > > Best regards, > Lutz ______________________________________________________________________ OpenSSL Project http://www.openssl.org Development Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]