1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30 load_system: procedure;
31
32
33
34 dcl access bit (3);
35 dcl bitcount fixed bin (24);
36 dcl count fixed bin (18);
37 dcl cp ptr;
38 dcl 1 cw aligned,
39 ( 2 type fixed bin (18) uns,
40 2 count fixed bin (18) uns) unaligned;
41 dcl 1 del_acl (1) aligned like delete_acl_entry;
42 dcl dir_name char (168);
43 dcl entry_bound fixed bin (14);
44 dcl entryname char (32);
45 dcl ercode fixed bin (35);
46 dcl header_area (1000) fixed bin (35);
47 dcl hp ptr;
48 dcl lastword ptr;
49 dcl mapword fixed bin (18);
50 dcl must_delete_acl bit (1) aligned;
51 dcl must_set_acl bit (1) aligned;
52 dcl object_map_ptr ptr;
53 dcl old_mode bit (36);
54 dcl 1 seg_acl_struc aligned,
55 2 version fixed bin,
56 2 count fixed bin,
57 2 seg_acl (1) aligned like segment_acl_entry;
58 dcl segp ptr;
59 dcl wordcount fixed bin (18);
60
61
62
63 dcl just_reference fixed bin (35) based;
64
65
66
67 dcl (addr, addrel, bit, divide, fixed, null, size, substr) builtin;
68
69
70
71 dcl pds$process_group_id ext static char (32) aligned;
72
73
74
75 dcl asd_$add_sentries entry (char (*), char (*), ptr, fixed bin, fixed bin (35));
76 dcl asd_$del_sentries entry (char (*), char (*), ptr, fixed bin, fixed bin (35));
77 dcl asd_$r_list_sall entry (char (*), char (*), ptr, ptr, fixed bin (35));
78 dcl disk_reader entry (ptr, fixed bin (18));
79 dcl init_branches$branch entry (ptr, ptr, ptr, bit (3), ptr);
80 dcl set$entry_bound_ptr entry (ptr, fixed bin (14), fixed bin (35));
81 dcl syserr entry options (variable);
82 dcl syserr$error_code entry options (variable);
83 %page;
84 hp = addr (header_area);
85 cp = addr (cw);
86
87 seg_acl_struc.version = ACL_VERSION_1;
88 seg_acl_struc.count = 1;
89 seg_acl_struc.seg_acl (1).access_name = pds$process_group_id;
90
91 loop: call disk_reader (cp, 1);
92 if cw.type = 2 then do;
93 call disk_reader (cp, 1);
94 return;
95 end;
96 if cw.type ^= 0 then call syserr (CRASH, "load_system: illegal type in mst source");
97 count = cw.count;
98 if count > 1000 then call syserr (CRASH, "load_system: illegal header length in mst source");
99
100 call disk_reader (hp, count);
101 namep = addrel (hp, size (slte));
102 pathp = addrel (namep, namep -> segnam.count * 9 + 1);
103 access = bit (hp -> slte.access, 3);
104 bitcount = hp -> slte_uns.bit_count;
105
106 call init_branches$branch (pathp, namep, hp, access, segp);
107
108 dir_name = pathp -> path.name;
109 entryname = namep -> segnam.names (1).name;
110
111 must_set_acl, must_delete_acl = "0"b;
112 old_mode = ""b;
113
114 call asd_$r_list_sall (dir_name, entryname, null (), addr (seg_acl_struc), ercode);
115
116 if ercode ^= 0 then call syserr$error_code (CRASH, ercode, "load_system: error from asd_$r_list_sall on ^a>^a.", dir_name, entryname);
117
118 if seg_acl_struc.seg_acl (1).status_code = 0 then if ^substr (seg_acl_struc.seg_acl (1).mode, 3, 1) then do;
119 must_set_acl = "1"b;
120 must_delete_acl = "0"b;
121 old_mode = seg_acl_struc.seg_acl (1).mode;
122 end;
123 else must_set_acl, must_delete_acl = "0"b;
124 else must_set_acl, must_delete_acl = "1"b;
125
126 if must_set_acl then do;
127 seg_acl_struc.seg_acl (1).mode = RW_ACCESS;
128 call asd_$add_sentries (dir_name, entryname, addr (seg_acl_struc.seg_acl), 1, ercode);
129 if ercode ^= 0 then
130 asd_error: call syserr$error_code (CRASH, ercode, "load_system: error from asd_$add_sentries on ^a>^a.", dir_name, entryname);
131 end;
132
133 call disk_reader (cp, 1);
134 if cw.type ^= 1 then call syserr (CRASH, "load_system: illegal type in mst source");
135
136 call disk_reader (segp, (cw.count));
137
138
139
140 if bitcount = 0 then go to no_entry_bound;
141 wordcount = divide (bitcount + 35, 36, 18, 0);
142 lastword = addrel (segp, wordcount - 1);
143 mapword = fixed (lastword -> map_ptr, 18);
144
145 if mapword <= 0 then go to no_entry_bound;
146 if mapword >= wordcount then go to no_entry_bound;
147 object_map_ptr = addrel (segp, lastword -> map_ptr);
148 if object_map_ptr -> object_map.identifier ^= "obj_map " then goto no_entry_bound;
149 if object_map_ptr -> object_map.decl_vers ^= 2 then go to no_entry_bound;
150
151 entry_bound = fixed (object_map_ptr -> object_map.entry_bound, 18);
152 if entry_bound > 0 then do;
153 call set$entry_bound_ptr (segp, entry_bound, ercode);
154 if ercode ^= 0 then
155 call syserr$error_code (CRASH, ercode, "load_system: error from set$entry_bound_ptr for ^a>^a.", dir_name, entryname);
156 end;
157
158 no_entry_bound:
159 if must_set_acl & ^must_delete_acl then do;
160 seg_acl_struc.seg_acl (1).mode = old_mode;
161 call asd_$add_sentries (dir_name, entryname, addr (seg_acl_struc.seg_acl), 1, ercode);
162 if ercode ^= 0 then go to asd_error;
163 end;
164
165 if must_delete_acl then do;
166 del_acl (1).access_name = pds$process_group_id;
167 call asd_$del_sentries (dir_name, entryname, addr (del_acl), 1, ercode);
168 if ercode ^= 0 then
169 call syserr$error_code (CRASH, ercode, "load_system: error from asd_$delete_sentries for ^a>^a.", dir_name, entryname);
170 end;
171
172
173 ercode = segp -> just_reference;
174 ercode = 0;
175 go to loop;
176 %page; %include access_mode_values;
177 %page; %include acl_structures;
178 %page; %include object_map;
179 %page; %include slt;
180 %page; %include slte;
181 %page; %include syserr_constants;
182 %page;
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254 end;