From mint-bounce@lists.fishpool.fi Tue Nov 30 11:32:09 2004 X-Original-To: fnaumann@mail.boerde.de Delivered-To: fnaumann@mail.boerde.de Date: Tue, 30 Nov 2004 11:30:20 +0100 (CET) From: Frank Naumann X-X-Sender: fnaumann@wh58-508.st.uni-magdeburg.de To: mint@fishpool.com Subject: Re: [MiNT] Ammount of file descriptors per process In-Reply-To: <41AC2CD6.6030000@gabo.pl> Message-ID: References: <41AC2CD6.6030000@gabo.pl> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Scan-Signature: 366eefd73c29ea74678ce441fcd8e66b X-ecartis-version: Ecartis v1.0.0 Sender: mint-bounce@lists.fishpool.fi Errors-To: mint-bounce@lists.fishpool.fi X-original-sender: fnaumann@cs.uni-magdeburg.de Precedence: bulk List-help: List-unsubscribe: List-Id: X-List-ID: X-Virus-Scanned: by amavisd-new at relay.boerde.de X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on relay.boerde.de X-Spam-Status: No, hits=-1.0 tagged_above=-50.5 required=3.8 tests=BAYES_00 X-Spam-Level: Hello! > 2. Opening files using library call open(), the maximum ammount of files it > tries to open is taken from RLIMIT_NOFILE library constant. This is not a constant, this is a dynamic per process resource limit. And this number don't represent the number of descriptors a process can open: RLIMIT_NOFILE This is a number one greater than the maximum value that the system may assign to a newly-created descriptor. If this limit is exceeded, functions that allocate new file descriptors may fail with errno set to [EMFILE]. This limit constrains the number of file descriptors that a process may allocate. > 3. Opening (creating) files using system call Fcreate(), the maximum ammount > of files it tries to open is taken from Sysconf(SYS_MAXFILES) system call. * Sysconf(which): returns information about system configuration. * 2 max. number of open files per process {OPEN_MAX} > Ad 3. Sysconf(SYS_MAXFILES) returns 32. Test fails after opening 26 files. This is not the number of files you can open, this is the maximum number of files a process can have open. Under Unix every process have at least 3 open file descriptors at start (stdin, stdout, stderr). Under FreeMiNT it's more due to TOS emulation. > Conclusions: > > At the beginning _process_that_does_nothing_ has 9 file descriptors opened > (according to /kerm/*/fd). If 32 is a maximum ammount of file descriptors per > process, then 26 + 9 = 35, so there is something wrong here. > > On the other hand FOPEN_MAX is wrong, and can lead to hard to trace errors in > ported software. > > > Or, if I'm wrong please correct me. Except the FOPEN_MAX constant I don't see any problem or violation of the standards. Regards, Frank -- ATARI FALCON 060 // MILAN 060 ----------------------------------------- http://www.cs.uni-magdeburg.de/~fnaumann/ e-Mail: fnaumann@freemint.de