home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!haven.umd.edu!darwin.sura.net!gatech!usenet.ins.cwru.edu!agate!ames!ig!invid.mwc.com!ed
- From: ed@invid.mwc.com (Ed Bravo)
- Newsgroups: comp.os.coherent
- Subject: Re: how many open files in 4.0.1?
- Message-ID: <9301061307.AA10689@invid.mwc.com>
- Date: 6 Jan 93 19:49:16 GMT
- References: <9212212304.AA12222@relay1.UU.NET>
- Sender: daemon@presto.ig.com
- Reply-To: "Coherent operating system" <COHERENT@indycms.bitnet>
- Lines: 81
-
- >
- > I've been running a test program on many systems latey, to see how many
- > files each system allows a single process to oopen. I was astonished
- > to find that I could open 2000 files on AIX 3.2 on an RS/6000.
- >
- > I was further astonished to see that the program thought it failed after
- > opening 13 files on Coherent 4.0.1.
-
- At present Coherent supports 20 files but with other processes running the
- system may have only 13 to 18. On the next version of Coherent you will
- have 60!
-
-
- >
- > Here's the program:
- > ---------------------------------------------------------------------------
- >
- > #include <stdio.h>
- > #include <fcntl.h>
- >
- > #define NUMFILES 5000
- > main ()
- > {
- > int fds[NUMFILES];
- > char fname[50];
- > int index;
- >
- > for ( index = 0 ; index < NUMFILES ; index++ )
- > {
- > sprintf (fname, "file.%d", index);
- > fds[index] = creat (fname, 0666);
- > printf ("%d\n", fds[index]);
- > if (fds[index] == -1)
- > {
- > fprintf (stderr, "Failure opening file %s\n", fname);
- > break;
- > }
- > printf ("opened file handle %d, filename %s\n", fds[index],
- fname);
- > sleep (1);
- > }
- >
- > getchar();
- > for ( --index ; index >= 0 ; index-- )
- > {
- > close (fds[index]);
- > sprintf (fname, "file.%d", index);
- > printf ("unlinking %s\n", fname);
- > unlink (fname);
- > }
- > }
- >
- > ---------------------------------------------------------------------------
- >
- > Now, another thing that's interesting, is that even though the creat call
- > returns -1 when opening file.13, IT STILL CREATES THE FILE. If I hack it
- > up a bit so that it loops 20 times without regard to the return from
- > creat() IT CREATES 20 FILES. The same thing happens when using open()
- > rather than creat().
- >
- > Firstly, isn't this an unusually low limit on how many files a process
- > can have open ?? (especially on a 4mb machine!?!??), and secondly,
- > isn't this bizarre behavior of creating the file even though the
- > returned file handle indicates an error rather BIZARRE? Is this
- > a bug (or two) or what?
- >
- > Fred
- >
- >
- -------------------------------------------------------------------------------
- > .---- Fred Smith / Office: 508-663-2524|Home:
- 617-438-5471
- > ( /__ ,__. __ __ / __ : /
- fredex%fcshome@merk.merk.com
- > / / / /__) / / /__) .+' or
- uunet!merk!fcshome!fredex
- > / / (__ (___ (__(_ (___ / :__ BIX: fredex or
- primerd!fcshome!fredex
- >
- -------------------------------------------------------------------------------
- >
-