bradley.grigor@canremote.uucp (BRADLEY GRIGOR) (03/06/90)
dixon@sagittarius.crd.ge.com (walt dixon) writes Subj: ms-dos FILES=fd in config.sys parameter d.>Under DOS 3.3 there is an int 21h request to change the address of the d.>JFT. In previous DOS versions one could change the address and size d.>of the JFT in the PSP to increase the number of open files. In order d.>to have more than 20 open file handles, one must create a new JFT. [based on PC Tech Journal, Vol.6, No.4, April 1988, page 161] The DOS function mentioned by Walt Dixon is INT 21h, function 67h. In register BX, pass the required number of file handles. This function needs to allocate a block of memory to hold the expanded handle table, so the calling program must release some of its memory with function 4Ah prior to calling function 67h. The amount of memory used by function 67h is one byte per handle, rounded up to the next highest multiple of 16, plus 16 bytes for the memory control record. Due to a bug in the implementation of function 67h in IBM DOS 3.3, it is advisable to always request an ODD number of handles. However, one should be able to emulate function 67h as follows: 1. Use malloc or calloc to allocate a block of memory to hold a new handle table, one byte per handle. 2. Initialize this block to FFh, which indicates all files closed. 3. Copy the current 20-byte handle table from the PSP at offset 18h to the allocated block. 4. Store the length of the new handle table in the PSP at offset 32h, as a two-byte integer. 5. Store a far pointer (segment and offset) to the new handle table in the PSP at offset 34h. 6. Be sure the FILES=nn statement in CONFIG.SYS is large enough to accomodate required number of concurrently open files across the entire system. Disclaimer: This procedure is inferred from the PC Tech Journal article but I have not tried it myself. Note: despite the documentation, a child process created with the Exec function can only inherit twenty file handles from its parent. bradley.grigor@canremote.uucp : ALEX is coming to Toronto in April. Newmarket, Ontario, Canada : TelePoker will be there - will YOU? --- ~ DeLuxe 1.11 #4613 Boy, I wouldn't want to be in my shoes right now!
dixon@sagittarius.crd.ge.com (walt dixon) (03/10/90)
In a reply to my previous article bradley grigor writes: [most of message deleted] >Note: despite the documentation, a child process created with the >Exec function can only inherit twenty file handles from its >parent. One would have thought that this would have been cleaned up in DOS 3.3. The DOS 3.1 duplicate PSP code which is called by the int 21h load function (actually at an alternate entry point that sets a flag indicating an internal request), the code exlicitly loads a count of 20 into cx and loops through the JFT. In this older version of DOS there was no explicit support for an alternate JFT (although it worked, sort of). The inheritance logic is really pretty simple. Omiting some details pertaining to file sharing and network devices, DOS (in the internal duplicate PSP function) scans the JFT. For every open file the mode field in the SFT is checked looking at the inheritance bit. If the bit is set, the system file number from the JFT is copied to the new JFT (in the new PSP). The refernce count in the SFT is incremented and the device driver is called if it supports open/close requests and the device is a character or the device is a block device and file sharing is enabled. One could duplicate this function if necessary. Walt Dixon {arpa: dixon@crd.ge.com } {us mail: ge crd } { po box 8 } { schenectady, ny 12301 } {phone: 518-387-5798 } Walt Dixon dixon@crd.ge.com
bradley.grigor@canremote.uucp (BRADLEY GRIGOR) (03/11/90)
dixon@sagittarius.crd.ge.com (walt dixon) comments on my reply: d.>In a reply to my previous article bradley grigor writes: d.>[most of message deleted] >Note: despite the documentation, a child process created with the >Exec function can only inherit twenty file handles from its >parent. d.>One would have thought that this would have been cleaned up in DOS d.>3.3. The DOS 3.1 duplicate PSP code which is called by the int 21h d.>load function (actually at an alternate entry point that sets a flag d.>indicating an internal request), the code exlicitly loads a count d.>of 20 into cx and loops through the JFT. In this older version of d.>DOS there was no explicit support for an alternate JFT (although it d.>worked, sort of). d.>The inheritance logic is really pretty simple. Omiting some details d.>pertaining to file sharing and network devices, DOS (in the internal d.>duplicate PSP function) scans the JFT. For every open file the mode d.>field in the SFT is checked looking at the inheritance bit. If the d.>bit is set, the system file number from the JFT is copied to the new d.>JFT (in the new PSP). The refernce count in the SFT is incremented d.>and the device driver is called if it supports open/close requests d.>and the device is a character or the device is a block device and d.>file sharing is enabled. One could duplicate this function if d.>necessary. What I said about inheriting only 20 files was also quoted from the PC Tech Journal article re: function 67H in DOS V3.3. As to why -- I might assume that it was considered "too tough" to allocate extended handle space along with another PSP, so the developers simply settled for the stock 20-byte handle area in the new PSP. bradley.grigor@canremote.uucp : ALEX is coming to Toronto in April. Newmarket, Ontario, Canada : TelePoker will be there - will YOU? --- ~ DeLuxe 1.11 #4613 How many toads does it take to pave a highway?