1
2
3
4
5
6
7
8
9
10
11
12
13
14 quotaw: proc;
15
16
17
18
19
20
21
22 dcl (a_astep, a_astep2) ptr,
23 a_t fixed bin (1),
24 (csw, a_csw) fixed bin (2);
25 dcl a_q fixed bin (18);
26 dcl a_code fixed bin (17);
27 dcl a_uc fixed bin (18);
28
29 dcl (addr, fixed, ptr) builtin;
30
31 dcl (astpp, astep1, astep2, ptwp) ptr,
32 (uchange, tchange, qchange, quota) fixed bin (34),
33 code fixed bin,
34 (tsw, ct, nt, qt) fixed bin (1),
35 (a_osu, osu, a_odu, odu, a_nsu, nsu, a_ndu, ndu) fixed bin (34),
36 new_quota fixed bin (34),
37 pcsw bit (1),
38 a_qt bit (1) aligned,
39 pds$processid ext bit (36),
40 pds$quota_inhib ext fixed bin (17),
41 oldmask fixed bin (71),
42 privileged_mode_ut$lock_ptl ext entry (fixed bin (71), ptr),
43 privileged_mode_ut$unlock_ptl ext entry (fixed bin (71), ptr);
44
45 % include aste;
46
47 declare sst$rqover fixed bin (35) external static;
48 declare sst_seg$ external static;
49 declare sstp pointer;
50
51
52
53 cu: entry (a_astep, a_uc, a_qt, a_csw, a_code);
54 csw = a_csw;
55
56 pcsw = "0"b;
57 go to cum;
58 cu_for_pc: entry (a_astep, a_uc, a_qt);
59
60 pcsw = "1"b;
61 csw = 0;
62 cum:
63
64
65 astep = a_astep;
66 uchange = a_uc;
67 qt = fixed (a_qt, 1);
68 code = 0;
69
70 sstp = addr (sst_seg$);
71 if ^pcsw then call privileged_mode_ut$lock_ptl (oldmask, ptwp);
72
73 cu1: astpp = astep;
74 cu2: if csw ^= 1
75 then astpp -> aste.used (qt) = astpp -> aste.used (qt) + uchange;
76 if csw = 2 then do;
77 if uchange > 0 & astpp -> aste.used (qt) > aste.quota (qt)
78 then code = sst$rqover;
79 go to finish;
80 end;
81 if astpp -> aste.tqsw (qt) = "0"b then do;
82 astpp = ptr (sstp, astpp -> aste.par_astep);
83 go to cu2;
84 end;
85 if pds$quota_inhib ^= 0
86 then go to finish;
87 if code ^= 0
88 then go to finish;
89 if uchange <= 0 then go to finish;
90 if csw = 1
91 then tchange = uchange;
92 else tchange = 0;
93 if astpp -> aste.quota (qt) < (astpp -> aste.used (qt) + tchange)
94 then do;
95 uchange = -uchange;
96 code = sst$rqover;
97 if csw = 0
98 then go to cu1;
99 end;
100
101 finish: if pcsw then return;
102 call privileged_mode_ut$unlock_ptl (oldmask, ptwp);
103 a_code = code;
104 return;
105
106
107
108
109
110
111 sq: entry (a_astep, a_q, a_qt, a_t);
112
113
114 astep = a_astep;
115 quota = a_q;
116 qt = fixed (a_qt, 1);
117 tsw = a_t;
118
119 sstp = addr (sst_seg$);
120
121 call privileged_mode_ut$lock_ptl (oldmask, ptwp);
122
123 if tsw = 1
124 then uchange = astep -> aste.used (qt);
125 else uchange = -astep -> aste.used (qt);
126 astpp = astep;
127 sq1: astpp = ptr (sstp, astpp -> aste.par_astep);
128 astpp -> aste.used (qt) = astpp -> aste.used (qt) - uchange;
129 if astpp -> aste.tqsw (qt) = "0"b
130 then go to sq1;
131
132 astep -> aste.quota (qt) = quota;
133 astep -> aste.tqsw (qt) = (tsw = 1);
134
135 call privileged_mode_ut$unlock_ptl (oldmask, ptwp);
136
137 return;
138
139
140
141
142
143 mq: entry (a_astep, a_astep2, a_q, a_qt, a_code);
144
145
146 astep1 = a_astep;
147 astep2 = a_astep2;
148 qchange = a_q;
149 qt = fixed (a_qt, 1);
150 code = 0;
151 sstp = addr (sst_seg$);
152
153 call privileged_mode_ut$lock_ptl (oldmask, ptwp);
154
155 ct = fixed (astep2 -> aste.tqsw (qt), 1);
156 if astep2 -> aste.quota (qt) + qchange ^= 0
157 then do;
158 nt = 1;
159 if astep2 -> aste.quota (qt) + qchange < astep2 -> aste.used (qt)
160 then go to error;
161
162 if ct = 0
163 then uchange = -astep2 -> aste.used (qt);
164 else uchange = 0;
165 end;
166 else do;
167 nt = 0;
168 if ct = 1
169 then uchange = astep2 -> aste.used (qt);
170 else uchange = 0;
171 end;
172 new_quota = astep1 -> aste.quota (qt) - qchange;
173 if new_quota <= 0 then go to error;
174 if new_quota < astep1 -> aste.used (qt)+uchange then go to error;
175 astep1 -> aste.quota (qt) = new_quota;
176 astep1 -> aste.used (qt) = astep1 -> aste.used (qt)+uchange;
177 astep2 -> aste.quota (qt) = astep2 -> aste.quota (qt)+qchange;
178 astep2 -> aste.tqsw (qt) = (nt = 1);
179
180 mqfinish:
181 call privileged_mode_ut$unlock_ptl (oldmask, ptwp);
182
183 a_code = code;
184 return;
185
186 error: code = sst$rqover;
187 go to mqfinish;
188
189
190
191 rvq: entry (a_astep, a_osu, a_odu, a_nsu, a_ndu);
192
193
194
195 astep = a_astep;
196
197 sstp = addr (sst_seg$);
198
199 call privileged_mode_ut$lock_ptl (oldmask, ptwp);
200
201 osu = aste.used (0);
202 odu = aste.used (1);
203 nsu = 0;
204 ndu = fixed (aste.records, 9);
205
206 do astep = ptr (sstp, aste.infp) repeat ptr (sstp, aste.infl) while (astep ^= sstp);
207
208 if aste.dirsw then do;
209 if ^aste.tqsw (0) then nsu = nsu + aste.used (0);
210 if ^aste.tqsw (1) then ndu = ndu + aste.used (1);
211 end;
212 else nsu = nsu + fixed (aste.records, 9);
213 end;
214
215 call privileged_mode_ut$unlock_ptl (oldmask, ptwp);
216
217 a_osu = osu;
218 a_odu = odu;
219 a_nsu = nsu;
220 a_ndu = ndu;
221
222 return;
223 end quotaw;