Article View: comp.sys.ibm.pc.programmer
Article #700Re: Why won't DOS allow more than 20 open files?
From: david nugent
Date: Tue, 12 Jun 1990 16:52
Date: Tue, 12 Jun 1990 16:52
45 lines
2178 bytes
2178 bytes
>Even though I have the statement FILES = 40 in my config.sys, DOS refuses
>to open more than 20 files at once and returns error code 4 (no handles
>available) if I try to open more. I've tested this on 3 different version
>of DOS (all of which allegedly support the FILES statement) Any clues why
>this is?
20 files (including the standard 4 handles: stdin, stdout, stderr &
stdin) is the _process_ limit for MS-DOS. The FILES= statement sets
the global number of files available to all processes.
DOS 3.10 above includes an undocumented way of increasing the number
of handles available to a particular process. DOS 3.30 above has
a documented way of achieving this. Rather than explain the fairly
complex undocumented method, it's easier and cheaper to just make
sure your program runs on DOS 3.30 or later (this is a reasonable
requirement, IMO).
The call you need is DOS Fn 67H. The specs for it are:
AH = 67H
BX = the desired number of handles (up to 0FFFFh)
Returns:
AX = error code if carry is set
If BX is 20, then 20 is used.
If BX is less than the current max and more than that many are
currently open, then the change will take place when there are
no more than the number of requested handles open.
If BX is greater than the current max, then there must be enough
memory available for the new file handle table.
Once this takes effect, it remains in effect for ALL processes in
the system. The number of files request can exceed the FILES=
statement in CONFIG.SYS - which makes it sort of redundant. :-)
Hope this helps,
david
--
Unique Computing Pty Ltd, Melbourne, Aust.
david@csource.oz.au 3:632/348@fidonet 28:4100/1@signet
Technical Details
Message-ID:
<17@csource.OZ.AU>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uwm.edu!zaphod.mps.ohio-state.edu!usc!samsung!munnari.oz.au!csource!davidReferences:
<90160.191651JXS118@psuvm.psu.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uwm.edu!zaphod.mps.ohio-state.edu!usc!samsung!munnari.oz.au!csource!david From: david@csource.OZ.AU (david nugent) Newsgroups: comp.sys.ibm.pc.programmer Subject: Re: Why won't DOS allow more than 20 open files? Message-ID: <17@csource.OZ.AU> Date: 12 Jun 90 16:52:54 GMT References: <90160.191651JXS118@psuvm.psu.edu> Organization: Unique Computing Pty Ltd, Melb, Aust. Lines: 48