Xref: utzoo alt.msdos.programmer:1771 comp.sys.ibm.pc.programmer:2007 Path: utzoo!utgpu!watserv1!watmath!att!bellcore!rutgers!mailrus!umich!ox.com!kitenet!russ From: russ@m-net.ann-arbor.mi.us (Russ Cage) Newsgroups: alt.msdos.programmer,comp.sys.ibm.pc.programmer Subject: Re: Why won't DOS allow more than 20 open files? Summary: Hard table size limit in the PSP. Message-ID: <1990Jun16.161612.2509@m-net.ann-arbor.mi.us> Date: 16 Jun 90 16:16:12 GMT References: <90160.191651JXS118@psuvm.psu.edu> Organization: M-net -- Public Access UNIX & Conferencing: (313)994-6333 Lines: 30 In article <90160.191651JXS118@psuvm.psu.edu> JXS118@psuvm.psu.edu (Jeff Siegel, Op from Atherton Hall) writes: >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? Down in the PSP of your process, there is a table which maps handle numbers for your process to DOS internal file reference numbers. (Examine the table and you will see entries of 01 for stdin, stdout, and stderr on an interactive process. I think 02 is stdprn unless redirected, dunno what 0 is. The unused entries are marked with 0xff.) This table is only 20 bytes long; it goes from PSP:0018 to PSP:002b. However, this table can be re-located. In DOS 3.x, there is a FAR pointer to the handle table at PSP:0034, and the length is at PSP:0032. So, by moving the table to an area of memory with more space, filling the remainder with 0xff, and changing the pointer to (and length of) the table in your PSP, your process can have more than 20 files open at once. I have done this, it works quite well. Condor 3 v. 2.20 uses it to good effect. My knowledge of this ends with DOS 3.x, there may be cleaner methods of doing this with more recent versions of DOS. -- I am paid to write all of RSI's opinions. Want me to write some for you? (313) 662-4147 Forewarned is half an octopus. Russ Cage, Robust Software Inc. russ@m-net.ann-arbor.mi.us