Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!rutgers!seismo!rochester!pt.cs.cmu.edu!b.gp.cs.cmu.edu!ralf From: ralf@b.gp.cs.cmu.edu.UUCP Newsgroups: comp.sys.ibm.pc Subject: Re: Limits on MSDOS file handles Message-ID: <9@b.gp.cs.cmu.edu> Date: Fri, 20-Feb-87 23:14:21 EST Article-I.D.: b.9 Posted: Fri Feb 20 23:14:21 1987 Date-Received: Sat, 21-Feb-87 16:21:15 EST References: <1511@im4u.UUCP> Distribution: world Organization: Carnegie-Mellon University, CS/RI Lines: 46 In article <1511@im4u.UUCP> jai@im4u.UUCP (Jai Srinivasan) writes: > >>Closing inherited handles (standard or otherwise) is freeing them up both >>towards the program limit (20) and the total limit (FILES). In your case, >>though, closing only two handles just wasn't enough. Consider that if PROCOMM >>has 5 non-preset handles opened, it is already occupying 10 handles (5 standard >>plus 5 more)! Another two (or more) go to the COMMAND.COM that started your >>PROCOMM, and there isn't that much left. >> > >That still does not explain the anamoly. I should have mentioned that >the program, when run from ProComm, always succeeded in opening one >file and then failed to open the next one. If the above is correct >(closing a file frees the handle for both the program and the system >limit), the program should have run with stdaux and stdprn closed as 2 >files were being closed in an attempt to open one. But closing stdprn >and stdaux made no difference: it yet opened one and failed to open the >next. > >The conclusion would appear to be that closing standard files (or at >least stdprn and stdaux) does not free handles for the system limit. >Anyone care to comment? That is exactly correct, since the standard files are inherited from the process which loads the current process. When a program is loaded with DOS function 4BH, it inherits all of the currently open files (this is what allows the COMMAND.COM I/O redirection operators < and >). While the new process has its own file handles for them, internally they refer to the same file descriptor. Thus closing handles is like deleting files in UN*X: the DOS-internal file descriptor is only freed when the last handle referencing it it closed. >Jai Srinivasan, UUCP: {gatech,harvard,ihnp4,pyramid,seismo}!ut-sally!im4u!jai >ARPA: jai@im4u.UTEXAS.EDU, jai@sally.UTEXAS.EDU Ralf Brown ARPA: RALF@B.GP.CS.CMU.EDU -- +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=+ | ARPA: RALF@B.GP.CS.CMU.EDU "Teaching COBOL ought to be | | AT&T: (412) 268-3053 (school) regarded as a criminal act" | | Snail: Ralf Brown --- Edsger Dijkstra | | Computer Science Department | | Carnegie-Mellon University DISCLAIMER? Who ever said I claimed | | Pittsburgh, PA 15213 anything? | +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=+