1 ; SCCSID = @(#)abort.asm 1.4 85/10/02
2 TITLE DOS_ABORT
- Internal SFT close all files for proc
call for MSDOS
5 ; Internal Abort call closes all handles and FCBs associated with a process.
6 ; If process has NET resources a close all is sent out over the net.
10 ; Modification history:
12 ; Created: ARR 30 March 1983
16 ; get the appropriate segment definitions
21 CODE SEGMENT BYTE PUBLIC 'CODE'
22 ASSUME
SS:DOSGROUP
,CS:DOSGROUP
33 I_Need PROC_ID
,WORD ; current process ID
34 I_Need USER_ID
,WORD ; current user ID
35 i_need CurrentPDB
,WORD
39 I_need sftFCB
,DWORD ; pointer to SFTs for FCB cache
41 Break <DOS_ABORT
-- CLOSE all files for process
>
44 ; [CurrentPDB] set to PID of process aborting
46 ; Close all files and free all SFTs for this PID
49 ; All destroyed except stack
51 Procedure DOS_ABORT
,NEAR
52 ASSUME
DS:NOTHING
,ES:NOTHING
55 MOV CX,ES:[PDB_JFN_Length
] ; Number of JFNs
59 DEC BX ; get jfn (start with last one)
63 LOOP reset_free_jfn
; and do 'em all
65 ; Note: We do need to explicitly close FCBs. Reasons are as follows: If we
66 ; are running in the no-sharing no-network environment, we are simulating the
67 ; 2.0 world and thus if the user doesn't close the file, that is his problem
68 ; BUT... the cache remains in a state with garbage that may be reused by the
69 ; next process. We scan the set and blast the ref counts of the FCBs we own.
71 ; If sharing is loaded, then the following call to close process will
72 ; correctly close all FCBs. We will then need to walk the list AFTER here.
74 ; Finally, the following call to NET_Abort will cause an EOP to be sent to all
75 ; known network resources. These resources are then responsible for cleaning
76 ; up after this process.
81 CallInstall Net_Abort
, multNet
, 29
89 ; Scan the FCB cache for guys that belong to this process and zap their ref
92 les di,sftFCB
; grab the pointer to the table
93 mov cx,es:[di].sfCount
95 LEA DI,[DI].sfTable
; point at table
98 cmp es:[di].sf_PID
,ax ; is this one of ours
99 jnz FCBNext
; no, skip it
100 mov es:[di].sf_ref_count
,0 ; yes, blast ref count
107 ; Walk the SFT to eliminate all busy SFT's for this process.
115 cmp es:[di].sf_ref_count
,0
118 ; we have a SFT that is not free. See if it is for the current process
121 cmp es:[di].sf_pid
,ax
124 cmp es:[di].sf_uid
,ax
127 ; This SFT is labelled as ours.
129 mov es:[di].sf_ref_count
,0