georgez@soafy.bhpese.oz.au (George Zarev) (02/19/91)
I am currently writing a large program in microsoft C (6.00) and need to open more files.My program is spread over 4 separate source code files.The program needs to operate with around 26 files open simultaneously. I have redefined FOPEN_MAX=40 and SYS_OPEN =40 and _NFILES =40. Also in config.sys I have set files = 40 The redefinitions have been included in each of the source code files which compile successfully.The program runs normally save for the fact that it won't recognise the new file open limit and still only lets me open the default limit of 20. I've spent two days tearing my hair out on this.Can anyone out there giveme some advice to help solve my problem.
emills@ux1.cso.uiuc.edu (Evan Mills) (02/23/91)
David Burki presented an excellent article in the February issue of Tech Specialist magazine on just this topic. I recommend you pick up a copy if you're interested in this subject. Burki says that INT 21h, Func 67h is documented for DOS 3.3, and he presents a method using undocumented DOS calls to raise the limit to 255 in DOS3.1 and above. Two notes. One, the total number of file handles will still be limited by the maximum allowed by the system. If you have a FILES=20 statement in your CONFIG.SYS file, you'll still be limited to 20 system-wide file handles. And two, the DOS Load & Exec function (INT 21h, Func 4Bh) will not automatically recognize any relocated file handle tables, so if you wish to pass the file handle table of a process to one of it's child processes, you'll have to do this manually. Hope this helps! --- Evan -- Evan Mills, Programmer/Patriot Missile Launcher "Hug me." Illinois State Water Survey "Who ARE you?" Office of Surface Water Resources & Systems Resources "I'm a signpost." EMAIL: evan-mills@uiuc.edu -- L.A. Story
mcastle@mcs213f.cs.umr.edu (Mike Castle {Nexus}) (02/24/91)
In article <1991Feb19.043755.1109@cerberus.bhpese.oz.au> georgez@soafy.bhpese.oz.au (George Zarev) writes: > > I am currently writing a large program in microsoft C (6.00) and need >to open more files.My program is spread over 4 separate source code files.The >program needs to operate with around 26 files open simultaneously. The first is specific to what you want, the others may be helpful. MFILE.ASM PD1:<MSDOS.C> Allows more than 20 files open at once in MS-C EXTEND32.ZIP PD1:<MSDOS.TURBOPAS> Open more than 20 files at once in TurboPascal EXTEND5.ZIP PD1:<MSDOS.TURBOPAS> Allows more than 20 files open at once in TP6 These are all available at: New Mexico: simtel20.army.mil (26.2.0.74) in the directory listed above (PDx:<MSDOS.xxxxx> ) Missouri: wuarchive.wustl.edu (128.252.135.4) in mirrors/msdos/xxxxx Australia: sol.deakin.oz.au (128.184.1.1) in pub/PC/simtel-20/xxxxx There are several mail servers that will process the ftp commands for those who have access to e-mail, but not FTP. Addresses are: In North America (Simtel20 access only): LISTSERV@VM1.NODAK.EDU North Dakota State University. LISTSERV@VM.ECS.RPI.EDU Rensselaer Polytechnic Institute. In the body of the mail have the command: GET PDGET HELP PCSERV-L Also (any ftp site): BITFTP@PUCC.PRINCETON.EDU In the body of the mail have the command: HELP Trickle servers (Simtel20 access only): In Denmark: TRICKLE@DKTC11 In Turkey: TRICKLE@TREARN In Italy: TRICKLE@IMIPOLI In Belgium: TRICKLE@BANUFS11 In Austria: TRICKLE@AWIWUW11 In Germany: TRICKLE@DTUZDV1 In Spain: TRICKLE@EB0UB011 In Israel: TRICKLE@TAUNIVM In Netherlands: TRICKLE@HEARN France: TRICKLE@FRMOP11 Germany: TRICKLE@DB0FUB11 Chile: TRICKLE@USACHVM1 Not sure: TRICKLE@DS0RUS1I (note: these are EARN/BITNET style addresses. Internet users should try BITNET domain addresses such as TRICKLE@TREAN.BITNET) In the body of the mail have the command: /HELP If anyone knows of any other mirrored archives of Simtel20, please let me know and I'll add them to this generic response. Thanks. -- Mike Castle (Nexus) S087891@UMRVMA.UMR.EDU (preferred) | XEDIT: Emacs mcastle@mcs213k.cs.umr.edu (unix mail-YEACH!)| on a REAL Life is like a clock: You can work constantly, and be right | operating all the time, or not work at all, and be right twice a day. | system. :->
rdb@rand.mel.cocam.oz.au (Rodney Brown) (03/04/91)
In article <1991Feb19.043755.1109@cerberus.bhpese.oz.au> georgez@soafy.bhpese.oz.au (George Zarev) writes: > I am currently writing a large program in microsoft C (6.00) and need >to open more files.My program is spread over 4 separate source code files.The >program needs to operate with around 26 files open simultaneously. > I have redefined FOPEN_MAX=40 and > SYS_OPEN =40 and > _NFILES =40. > Also in config.sys I have set > files = 40 >The program runs normally save for the fact that it won't recognise the >new file open limit and still only lets me open the default limit of 20. My understanding of the limits on the number of files handles a process can open on MS-DOS. DOS 2.11 Remaining number of files left from CONFIG FILES = by other processes DOS 3.0 Minimum of above remainder and 20 DOS 3.3 As DOS 3.0 but a process may expand the 20 maximum by using the Set Handle Count function. The MS-DOS Encyclopedia pp 1448-1449 New file-management functions MS-DOS version 3.3 includes two new Interrupt 21H file-management functions: Set Handle Count (Function 67H) and Commit File (Function 68H) Set Handle Count The Set Handle Count function (Interrupt 21H Function 67H) allows a single process to have more than 20 handles for files or devices open simultaneously. Function 67H is invoked by issuing a software interrupt 21H with AH = 67H BX = number of desired handles On return, If function is successful: Carry flag is clear. If function is not successful: Carry flag is set. AX = error code For each process the operating system maintains a table that relates file handle numbers for the process to MS-DOS's internal global table for all open files in the system. In MS-DOS 3.0 and later, the per-process table is ordinarily stored within the reserved area of the program segment prefix (PSP) and has only enough room for 20 handle entries. If 20 or fewer handles are requested in register BX, Function 67H takes no action and returns a success signal. If more than 20 handles are requested however, Function 67H allocates on behalf of the calling program a new block of memory that is large enough to hole the expanded table of handle numbers and then copies the process's old handle table to the new table. Because the function will fail if the system does not have sufficient free memory to allocate the new block most programs need to make a call to Interrupt 21H Function 4AH (Resize Memory Block) to "shrink" their initial memory block allocations before calling Function 67H. Function 67H does not fail if the number requested is larger than the available entries in the system's global table for file and device handles. However a subsequent attempt to open a file or device or to create a new file will fail if all the entries in the system's global file table are in use, even if the requesting process has not used up all its own handles. (The size of the global table is controlled by the FILES entry in the CONFIG.SYS file. See USER COMMANDS:CONFIG.SYS: FILES; PROGRAMMING IN THE MS-DOS ENVIRONMENT: PROGRAMMING FOR MS-DOS: File and Record Management.) Example: Set the maximum handle count for the current process to 30, so that the process can have as many as 25 files or devices open simultaneously (5 of the handles are already expended by the MS-DOS standard devices when the process starts up). Note that a FILES=30 (or greater value) entry in the CONFIG.SYS file also is required for the process to successfully open 30 files or devices. . . . mov ah,67h ; Function 67H = set handle count mov bx,30 ; Maxiumum number of handles. int 21h ; Transfer to MS-DOS jc error ; Jump if function failed. . . . <<End of Quotation>> If you can justify it's $A105, $US70 cost the MS-DOS Encyclopedia is worth having for this kind of esoterica. I haven't tried this function yet - we are watching for the NFILE? error and closing & reopening files. NB there is nothing to stop you closing some of the 5 standard devices - closing stdprn loses you Ctl-P logging and the Ctl-PrtScn stuff.
ralf+@cs.cmu.edu (Ralf Brown) (03/05/91)
In article <182@rand.mel.cocam.oz.au> rdb@rand.mel.cocam.oz.au (Rodney Brown) writes: }My understanding of the limits on the number of files handles a process can }open on MS-DOS. } }DOS 2.11 Remaining number of files left from CONFIG FILES = } by other processes } }DOS 3.0 Minimum of above remainder and 20 The limit for DOS 2.x is that same as for DOS 3.0-3.2, except that the handle table can't be moved or expanded, because the address is hardwired into DOS instead of being a pointer in the PSP. It is possible, however, to sneak around the open file limit by swapping descriptor values in and out of the handle table (doing so is of course making use of undocumented DOS features). -- {backbone}!cs.cmu.edu!ralf ARPA: RALF@CS.CMU.EDU FIDO: Ralf Brown 1:129/3.1 BITnet: RALF%CS.CMU.EDU@CMUCCVMA AT&Tnet: (412)268-3053 (school) FAX: ask DISCLAIMER? Did | It isn't what we don't know that gives us trouble, it's I claim something?| what we know that ain't so. --Will Rogers