Mail Archives: djgpp/1995/06/26/10:14:07
In article <DAr9Bx DOT KL3 AT jade DOT mv DOT net>, Peter Horan <peter AT deakin DOT edu DOT au> writes:
|>>
|>> If i do a low level open using OPEN command, i can open 34 (ex files open
|>> by systemm). BUT if i use FOPEN, i cannot open more than 15 files(streams)
|>> and get an error msg " too many files open"
|>>
|>In UNIX, the number of file descriptors is limited to 20, numbered 0 to 19.
|>This limit is a function of the library. Descriptors 0, 1 and 2 correspond to
|>stdin, stdout and stderr. In Microsoft (and Borland? and djgpp?) compilers,
|>stdprn and stdaux are also defined and opened by the system leaving you with
|>15.
|>
The statement 'in UNIX, the number of file descriptors is limited to 20'
is incorrect in my experience. Peter then qualifies this by saying that
the limit is a function of the library. This IS true if we
take 'file descriptors' to mean 'streams', which is what fopen
is creating for us. The libraries
on most systems I have used set the limit at 256, a number much
greater than 20. One is also limited by the number of file descriptors
the OS is willing to supply which is often smaller, but usually
at least 64 in any self-respecting system. DOS may well limit
us to 15. In all environments, one should be able to
interrogate the system to discover the maximum number of file
descriptors and streams, and any program which expects to run
on multiple platforms + open lots of files would be well advised to
do so.
I'm not near my djgpp system at the moment so can't check if returns
something sensible for STREAM_MAX and OPEN_MAX, which is what POSIX
says should return the relevant values.
------------------------------------------------------------------------------
Kevin Ashley K DOT Ashley AT Ulcc DOT ac DOT uk
Systems Development Group Manager http://www.ulcc.ac.uk/staff/Kevin+Ashley
University of London Computer Centre. ...ukc!ncdlab!K.Ashley
This is not a signature
- Raw text -