summaryrefslogtreecommitdiff
path: root/v4.0/src/DOS/ABORT.ASM
diff options
context:
space:
mode:
authorGravatar Mark Zbikowski2024-04-25 21:24:10 +0100
committerGravatar Microsoft Open Source2024-04-25 22:32:27 +0000
commit2d04cacc5322951f187bb17e017c12920ac8ebe2 (patch)
tree80ee017efa878dfd5344b44249e6a241f2a7f6e2 /v4.0/src/DOS/ABORT.ASM
parentMerge pull request #430 from jpbaltazar/typoptbr (diff)
downloadms-dos-main.tar.gz
ms-dos-main.tar.xz
ms-dos-main.zip
MZ is back!HEADmain
Diffstat (limited to 'v4.0/src/DOS/ABORT.ASM')
-rw-r--r--v4.0/src/DOS/ABORT.ASM137
1 files changed, 137 insertions, 0 deletions
diff --git a/v4.0/src/DOS/ABORT.ASM b/v4.0/src/DOS/ABORT.ASM
new file mode 100644
index 0000000..43268e3
--- /dev/null
+++ b/v4.0/src/DOS/ABORT.ASM
@@ -0,0 +1,137 @@
1; SCCSID = @(#)abort.asm 1.4 85/10/02
2TITLE DOS_ABORT - Internal SFT close all files for proc call for MSDOS
3NAME DOS_ABORT
4
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.
7;
8; DOS_ABORT
9;
10; Modification history:
11;
12; Created: ARR 30 March 1983
13;
14
15;
16; get the appropriate segment definitions
17;
18
19include dosseg.asm
20
21CODE SEGMENT BYTE PUBLIC 'CODE'
22 ASSUME SS:DOSGROUP,CS:DOSGROUP
23
24.xlist
25.xcref
26INCLUDE DOSSYM.INC
27INCLUDE DEVSYM.INC
28.cref
29.list
30
31Installed = TRUE
32
33 I_Need PROC_ID,WORD ; current process ID
34 I_Need USER_ID,WORD ; current user ID
35 i_need CurrentPDB,WORD
36 i_need sft_addr,DWORD
37 i_need THISSFT,DWORD
38 i_need JSHARE,DWORD
39 I_need sftFCB,DWORD ; pointer to SFTs for FCB cache
40
41Break <DOS_ABORT -- CLOSE all files for process>
42
43; Inputs:
44; [CurrentPDB] set to PID of process aborting
45; Function:
46; Close all files and free all SFTs for this PID
47; Returns:
48; None
49; All destroyed except stack
50
51 Procedure DOS_ABORT,NEAR
52 ASSUME DS:NOTHING,ES:NOTHING
53
54 MOV ES,[CurrentPDB]
55 MOV CX,ES:[PDB_JFN_Length] ; Number of JFNs
56reset_free_jfn:
57 MOV BX,CX
58 PUSH CX
59 DEC BX ; get jfn (start with last one)
60
61 invoke $close
62 POP CX
63 LOOP reset_free_jfn ; and do 'em all
64;
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.
70;
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.
73;
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.
77;
78; Sleazy, eh?
79;
80 context DS
81 CallInstall Net_Abort, multNet, 29
82if installed
83 call JShare + 4 * 4
84else
85 call mftCloseP
86endif
87 assume ds:nothing
88;
89; Scan the FCB cache for guys that belong to this process and zap their ref
90; counts.
91;
92 les di,sftFCB ; grab the pointer to the table
93 mov cx,es:[di].sfCount
94 jcxz FCBScanDone
95 LEA DI,[DI].sfTable ; point at table
96 mov ax,proc_id
97FCBTest:
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
101FCBNext:
102 add di,size sf_Entry
103 loop FCBTest
104FCBScanDone:
105
106;
107; Walk the SFT to eliminate all busy SFT's for this process.
108;
109 XOR BX,BX
110Scan:
111 push bx
112 invoke SFFromSFN
113 pop bx
114 retc
115 cmp es:[di].sf_ref_count,0
116 jz next
117;
118; we have a SFT that is not free. See if it is for the current process
119;
120 mov ax,proc_id
121 cmp es:[di].sf_pid,ax
122 jnz next
123 mov ax,user_id
124 cmp es:[di].sf_uid,ax
125 jnz next
126;
127; This SFT is labelled as ours.
128;
129 mov es:[di].sf_ref_count,0
130next:
131 inc bx
132 jmp scan
133
134EndProc DOS_Abort
135
136CODE ENDS
137 END