Thread View: alt.msdos.programmer
5 messages
5 total messages
Started by Jeff Siegel, Op from Atherton Ha...
Sat, 09 Jun 1990 23:16
Why won't DOS allow more than 20 open files?
Author: Jeff Siegel, Op from Atherton Ha...
Date: Sat, 09 Jun 1990 23:16
Date: Sat, 09 Jun 1990 23:16
14 lines
1210 bytes
1210 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? A while back I remember seeing a question on how to get more than 20 open files in TurboC. I've come up with a solution to the limitation TurboC places on the number of open streams, but when I went to test it I ran into this DOS problem. I will post the code if I manage to get it working. Has a 'cure' for this problem already been posted on the net? (I don't want to repeat a lot of work someone else has already done) Jeff
Re: Why won't DOS allow more than 20 open files?
Author: Hi Ho Silver
Date: Sun, 10 Jun 1990 15:15
Date: Sun, 10 Jun 1990 15:15
24 lines
1817 bytes
1817 bytes
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? Yup. Unless you fiddle DOS otherwise (and I forget how to), each process is only allowed 20 file handles, irrespective of your FILES= statement. The FILES= statement controls how many files can be open at once, not how many one process can have open. Keep in mind, also, that each process is provided with 5 file handles already used (stdin, stdout, stderr, stdprn, and stdaux) so you really only have 15 to work with. The workaround involves using some DOS call that expands the table of file handles for your process, but I've never done it and I can't recall how to do it. I'm sure someone else will post it. -- /Nikebo \ Nikebo says "Nikebo knows how to post. Just do it."\silver@xrtll/ /---------\_____________________________________________________\----------/ /yunexus!xrtll!silver (L, not 1)\ Hi Ho Silver \ just silver for short / /Silver: Ever Searching for SNTF \ Life sucks. \ someone buy me a BEER! /
Re: Why won't DOS allow more than 20 open files?
Author: Tom Almy
Date: Mon, 11 Jun 1990 16:38
Date: Mon, 11 Jun 1990 16:38
33 lines
2041 bytes
2041 bytes
In article <1990Jun10.151538.25462@xrtll.uucp> silver@.UUCP (PUT YOUR NAME HERE) writes: >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. > Yup. Unless you fiddle DOS otherwise (and I forget how to), each process >is only allowed 20 file handles, irrespective of your FILES= statement. The >FILES= statement controls how many files can be open at once, not how many >one process can have open. > The workaround involves using some DOS call that expands the table of >file handles for your process, but I've never done it and I can't recall >how to do it. I'm sure someone else will post it. Well, the INT 21H call is: AH =67H BX = # desired handles It returns carry flag clear if successful. The function is only available in DOS versions >=3.3. *BUT* if you are using a C compiler, and the stdio package, then you have an additional hurdle. Every C compiler library I have seen maintains a static table for FILE, which has 20 entries. The only way I know to expand these tables is to have access to the library source, make the change, and recompile the library. If you use open(), read(), etc. (not stdio), or many other languages, then you are home free. Tom Almy toma@tekgvs.labs.tek.com Standard Disclaimers Apply
Re: Why won't DOS allow more than 20 open files?
Author: Matthias Barmeier
Date: Wed, 13 Jun 1990 07:06
Date: Wed, 13 Jun 1990 07:06
22 lines
1608 bytes
1608 bytes
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?
Try this :
MSDOS INT 21 with AX=6700h and BX=Number of handles to open.
This Msdos function returns in AX the error code if carry flag is set.
This call allows programs to control number of file handles available fo use.
Memory is allocated from memory freed by int 21 AX=4A00h. If number of handles
is less than current number of open files, change becomes effective when currentnumber of files drops below new limit.
INT 21 with AX=4A00h and BX=New requested block size in paragraphs (16 Byte).
and ES=Segment of Block to be modified.
I hope this will help you !
Ciao
mat@zelator.UUCP
Re: Why won't DOS allow more than 20 open files?
Author: Russ Cage
Date: Sat, 16 Jun 1990 16:16
Date: Sat, 16 Jun 1990 16:16
30 lines
2148 bytes
2148 bytes
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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads