1
2
3
4
5
6
7
8
9
10
11
12
13 init_branches:
14 procedure;
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46 dcl (ntp, segp, pastep) ptr,
47 relp bit (18) aligned,
48 write_lock bit (36) aligned,
49 (fi, i, pddq) fixed bin,
50 ustr char (15),
51 (code, ercode) fixed bin (35),
52 ename char (32),
53 next_astep ptr,
54 rb (3) fixed bin (3),
55 correct_max_length fixed bin (9),
56 pds$process_group_id char (32) aligned ext,
57 pds$ ext,
58 dseg$ (0:4095) fixed bin (71) external static,
59 (
60 slt$,
61 name_table$
62 ) fixed bin ext;
63
64 dcl 1 sdwi aligned like sdw_info automatic;
65
66 dcl zzBB char (15) static options (constant) init ("!zzzzzzzbBBBBBB");
67
68 dcl No_daemon bit (1) aligned static options (constant) init ("1"b);
69
70
71
72 dcl (
73 error_table_$noentry,
74 error_table_$namedup
75 ) fixed bin (35) external static,
76 active_hardcore_data$sl1_uid bit (36) aligned ext,
77 active_hardcore_data$pdd_uid bit (36) aligned ext,
78 active_hardcore_data$pdir_quota fixed bin ext,
79 active_hardcore_data$pdir_dir_quota fixed bin ext;
80 dcl pvt$rlv_needs_salv bit (1) aligned external;
81
82 dcl 1 dir_acl (2) aligned like directory_acl_entry;
83 dcl 1 del_acl (1) aligned like delete_acl_entry;
84
85 dcl 1 branch aligned like status_branch;
86
87 dcl update_vtoce entry (ptr),
88 thread$out ext entry (ptr, bit (18)),
89 search_ast$hash_in entry (ptr),
90 quota$dqset entry (char (*), fixed bin, fixed bin (35)),
91 quota$dqmove entry (char (*), char (*), fixed bin, fixed bin (35)),
92 quota$qset entry (char (*), fixed bin, fixed bin (35)),
93 quota$qmove entry (char (*), char (*), fixed bin, fixed bin (35)),
94 get_ptrs_$given_segno ext entry (fixed bin (18)) returns (ptr),
95 sum$getbranch_root_my entry (ptr, bit (36) aligned, ptr, fixed bin (35)),
96 asd_$del_sentries entry (char (*), char (*), ptr, fixed bin, fixed bin (35)),
97 asd_$replace_dall entry (char (*), char (*), ptr, fixed bin, bit (1) aligned, fixed bin (35)),
98 unique_chars_ entry (bit (*)) returns (char (15)),
99 append$branchx entry (char (*), char (*), fixed bin (5), (3) fixed bin (3), char (*), fixed bin (1),
100 fixed bin (1), fixed bin (24), fixed bin (35)),
101 sdw_util_$dissect entry (pointer, pointer),
102 syserr entry options (variable),
103 syserr$error_code entry options (variable),
104 (addr, baseno, binary, bin, bit, divide, fixed, max, null, ptr, rel, rtrim) builtin,
105 lock$dir_unlock ext entry (ptr),
106 chname$cfile entry (char (*), char (*), char (*), char (*), fixed bin (35)),
107 get_ptrs_$given_astep entry (ptr, fixed bin (71)),
108 initiate entry (char (*), char (*), char (*), fixed bin, fixed bin, ptr, fixed bin (35)),
109 make_branches entry (ptr, ptr, fixed bin (24), ptr, (3) fixed bin (3), bit (3), fixed bin (35)),
110 set$max_length_path entry (char (*), char (*), fixed bin (19), fixed bin (35)),
111 status_$long entry (char (*), char (*), fixed bin (1), ptr, ptr, fixed bin (35)),
112 terminate_$teseg entry (ptr, fixed bin, fixed bin (35));
113 dcl salvager$dir_salv_boot entry (char (*));
114 ^L
115
116
117
118
119
120
121 ustr = unique_chars_ (""b);
122 call chname$cfile (">", "process_dir_dir", "process_dir_dir", "process_dir_dir." || ustr, code);
123
124 if (code ^= 0) & (code ^= error_table_$noentry)
125 then call syserr$error_code (CRASH, code, "init_branches: renaming process_dir_dir:");
126
127 call chname$cfile (">", "pdd", "pdd", "pdd." || ustr, code);
128
129 if (code ^= 0) & (code ^= error_table_$noentry)
130 then call syserr$error_code (CRASH, code, "init_branches: renaming old pdd:");
131
132 rb (*) = 7;
133
134 dir_acl (1).access_name = pds$process_group_id;
135 dir_acl (1).mode = SMA_ACCESS;
136
137
138
139 call append$branchx (">", "process_dir_dir", SMA_ACCESS_BIN, rb, (pds$process_group_id), 1, 0, 0, code);
140 if code ^= 0 then call syserr$error_code (CRASH, code, "init_branches: unable to make process_dir_dir:");
141
142 call chname$cfile (">", "process_dir_dir", "", "pdd", ercode);
143
144 if ercode ^= 0
145 then call syserr$error_code (ANNOUNCE, ercode, "init_branches: couldn't add name pdd to process_dir_dir:");
146
147
148
149 call initiate (">", "process_dir_dir", "", 0, 1, dp, code);
150 if code ^= 0 then call syserr$error_code (CRASH, code, "init_branches: unable to initiate >pdd:");
151 dp -> dir.per_process_sw = "1"b;
152 active_hardcore_data$pdd_uid = dp -> dir.uid;
153
154 pddq = 131071;
155
156
157 call quota$qset (">process_dir_dir", pddq, code);
158 if code ^= 0 then call syserr$error_code (ANNOUNCE, code, "init_branches: couldn't set quota on >pdd to ^d ", pddq);
159 call quota$dqset (">process_dir_dir", pddq, code);
160 if code ^= 0 then call syserr$error_code (ANNOUNCE, code, "init_branches: couldn't set dir quota on >pdd to ^d ", pddq);
161
162
163
164 ename = "";
165 call chname$cfile (">", "system_library_1", "system_library_1", "system_library_1." || ustr, code);
166
167 if code = 0 then ename = "system_library_1." || ustr;
168 else if code ^= error_table_$noentry
169 then call syserr$error_code (CRASH, code, "init_branches: Renaming >system_library_1.");
170
171 call chname$cfile (">", "sl1", "sl1", "sl1." || ustr, code);
172 if code = 0 then ename = "sl1." || ustr;
173 else if code ^= error_table_$noentry
174 then call syserr$error_code (CRASH, code, "init_branches: Renaming >sl1.");
175
176 if ename ^= "" then do;
177 call dc_find$obj_status_write_priv (">", ename, DC_FIND_NO_CHASE, FS_OBJ_SOOS_MOD, ep, code);
178 if code ^= 0
179 then call syserr$error_code (CRASH, code, "init_branches: Setting security_oosw for old >system_library_1.");
180 ep -> entry.security_oosw = "1"b;
181 call dc_find$finished (ptr (ep, 0), DC_FIND_UNLOCK_DIR);
182 end;
183
184 call append$branchx (">", "system_library_1", SMA_ACCESS_BIN, rb, (pds$process_group_id), 1, 0, 0, code);
185 if code ^= 0 then call syserr$error_code (CRASH, code, "init_branches: unable to make >system_library_1:");
186
187
188
189 dir_acl (2).access_name = "*.*.*";
190 dir_acl (2).mode = S_ACCESS;
191 call asd_$replace_dall (">", "system_library_1", addr (dir_acl), 2, No_daemon, ercode);
192 if ercode ^= 0 then call syserr$error_code (ANNOUNCE, ercode, "init_branches: error in replacing acl of >sl1.");
193
194
195
196 call chname$cfile (">", "system_library_1", "", "sl1", ercode);
197 if ercode ^= 0
198 then call syserr$error_code (ANNOUNCE, ercode, "init_branches: couldn't add name sl1 to system_library_1:");
199
200
201
202 call initiate (">", "sl1", "", 0, 1, dp, code);
203 if code ^= 0 then call syserr$error_code (CRASH, code, "init_branches: unable to initiate >sl1");
204 active_hardcore_data$sl1_uid = dp -> dir.uid;
205
206
207
208 sltp = addr (slt$);
209 ntp = addr (name_table$);
210 sstp = addr (sst_seg$);
211 write_lock = "1"b;
212 do fi = 0 to 3;
213 relp = sstp -> sst.ausedp (fi);
214 if relp ^= "0"b then do;
215 astep = ptr (sstp, relp);
216 back:
217 next_astep = ptr (astep, aste.fp);
218 if astep -> aste.usedf &
219 astep -> aste.hc_sdw then do;
220 i = fixed (astep -> aste.strp, 18);
221 astep -> aste.strp = ""b;
222 sltep = addr (sltp -> slt.seg (i));
223
224
225
226 call create_branch (ptr (ntp, sltep -> slte.path_ptr), ptr (ntp, sltep -> slte.names_ptr),
227 sltep, bit (sltep -> slte.access, 3), segp, correct_max_length);
228
229 call sum$getbranch_root_my (segp, write_lock, ep, ercode);
230
231 if ercode ^= 0 then call syserr$error_code (CRASH, ercode, "init_branches: getting dir entry pointer:");
232 dp = ptr (ep, 0);
233 pastep = get_ptrs_$given_segno (fixed (baseno (dp), 18));
234
235 if pastep = null then call syserr (CRASH, "init_branches: Mysterious directory deactivation ");
236 astep -> aste.par_astep = rel (pastep);
237 astep -> aste.infl = pastep -> aste.infp;
238
239 pastep -> aste.infp = rel (astep);
240
241
242 astep -> aste.per_process = ep -> entry.per_process_sw;
243
244 astep -> aste.msl = bit (correct_max_length, 9);
245
246 astep -> aste.uid = ep -> entry.uid;
247 call thread$out (astep, sst.ausedp (fixed (aste.ptsi, 2)));
248
249 call search_ast$hash_in (astep);
250 astep -> aste.vtocx = ep -> entry.vtocx;
251
252 call sdw_util_$dissect (addr (dseg$ (i)), addr (sdwi));
253
254 ep -> entrypt_sw = (sdwi.gate_entry_bound > 0);
255 if sdwi.gate_entry_bound > 0
256 then ep -> entrypt_bound = bit (binary (sdwi.gate_entry_bound - 1, 14), 14);
257 else ep -> entrypt_bound = ""b;
258
259 nm_astep = astep;
260 temp_entry_name = (addr (ep -> entry.primary_name) -> names.name);
261 %include make_sstnt_entry;
262 call update_vtoce (astep);
263 call lock$dir_unlock (dp);
264 call terminate_$teseg (segp, 0, ercode);
265
266 if ercode ^= 0 then call syserr$error_code (CRASH, ercode, "init_branches: error from terminate_:");
267 end;
268 astep = next_astep;
269 if rel (astep) ^= relp then go to back;
270 end;
271 end;
272
273
274
275
276
277 astep = get_ptrs_$given_segno (fixed (baseno (addr (pds$)), 18));
278
279 astep = ptr (sstp, astep -> aste.par_astep);
280 astep -> aste.per_process = "1"b;
281 ptr (sstp, astep -> aste.par_astep) -> aste.per_process = "1"b;
282
283 do astep = ptr (sstp, astep -> aste.infp)
284 repeat ptr (sstp, astep -> aste.infl) while (astep ^= sstp);
285
286 astep -> aste.per_process = "1"b;
287 end;
288
289 call set_ml ("slt");
290 call set_ml ("name_table");
291
292 call quota$qmove (">process_dir_dir", zzBB, active_hardcore_data$pdir_quota, code);
293 if code ^= 0 then call syserr$error_code (ANNOUNCE, code, "init_branches: quotas for pdir:");
294 call quota$dqmove (">process_dir_dir", zzBB, active_hardcore_data$pdir_dir_quota, code);
295 if code ^= 0 then call syserr$error_code (ANNOUNCE, code, "init_branches: dir quotas for pdir:");
296
297 call asd_$replace_dall (">", "process_dir_dir", addr (dir_acl), 1, No_daemon, ercode);
298 if ercode ^= 0 then call syserr$error_code (ANNOUNCE, ercode, "init_branches: replacing >pdd acl:");
299
300
301
302 call asd_$replace_dall (">process_dir_dir", zzBB, addr (dir_acl), 1, No_daemon, ercode);
303 if ercode ^= 0 then call syserr$error_code (ANNOUNCE, ercode, "init_branches: replacing acl of >pdd for Initializer:");
304
305
306 rb (1), rb (2), rb (3) = 7;
307 call append$branchx (">", "dumps", A_ACCESS_BIN, rb, "*.*.*", 1, 0, 0, code);
308 if code ^= 0
309 then if code ^= error_table_$namedup
310 then call syserr$error_code (BEEP, code, "init_branches: unable to append dumps directory.");
311 else if pvt$rlv_needs_salv then call salvager$dir_salv_boot (">dumps");
312
313
314 return;
315 ^L
316
317
318
319 set_ml:
320 proc (entry_name);
321
322 dcl entry_name char (*);
323
324 call status_$long (">system_library_1", entry_name, 0, addr (branch), (null), ercode);
325 if ercode ^= 0 then call syserr$error_code (CRASH, ercode, "init_branches: From status_$long.");
326
327 call set$max_length_path (">system_library_1", entry_name, branch.current_length * 1024, ercode);
328 if ercode ^= 0 then call syserr$error_code (CRASH, ercode, "init_branches: From set$max_length: ");
329
330 end set_ml;
331 ^L
332
333 branch:
334 entry (a_dirp, a_namep, a_sltep, a_access, a_segp);
335
336 dcl (a_dirp, a_namep, a_sltep, a_segp) pointer;
337 dcl a_access bit (3);
338
339 call create_branch (a_dirp, a_namep, a_sltep, a_access, a_segp, (0));
340 return;
341
342
343
344
345
346
347
348
349
350
351
352
353 create_branch:
354 procedure (pp, a_np, slep, access, sp, ml_to_return);
355
356 dcl (pp, a_np, slep, sp) ptr,
357 access bit (3);
358 dcl rb (3) fixed bin (3);
359 dcl pname char (168);
360 dcl ename char (32);
361 dcl bc fixed bin (24);
362 dcl max_length fixed bin (19);
363 dcl ml_to_return fixed bin (9);
364
365 rb (1) = fixed (slep -> slte.ringbrack (1), 6);
366 rb (2) = fixed (slep -> slte.ringbrack (2), 6);
367 rb (3) = fixed (slep -> slte.ringbrack (3), 6);
368 pname = pp -> path.name;
369 ename = a_np -> segnam.names (1).name;
370 if slep -> slte.acl_provided
371 then aclp = addr (pp -> path.acls);
372 else aclp = null;
373 bc = fixed (slep -> slte.bit_count, 24);
374 call make_branches (pp, a_np, bc, aclp, rb, access, 0);
375
376
377
378
379
380
381
382
383 if aclp = null then do;
384 del_acl (1).access_name = "*.SysDaemon.*";
385 aclp = addr (del_acl);
386 call asd_$del_sentries (pname, ename, aclp, 1, ercode);
387 if ercode ^= 0 then call syserr$error_code (ANNOUNCE, ercode, "init_branches: $branch From asd_$del_sentries: ");
388 end;
389 call initiate (pname, ename, "", 0, 1, sp, ercode);
390 if sp = null then call syserr$error_code (CRASH, ercode, "init_branches: error from initiate. ");
391 max_length =
392 max (divide (divide (bc + 35, 36, 19, 0) + 1023, 1024, 9, 0), fixed (slep -> slte.cur_length, 9),
393 fixed (slep -> slte.max_length, 9));
394 if max_length = 0 then max_length = 4;
395 call set$max_length_path (pname, ename, max_length * 1024, ercode);
396
397 if ercode ^= 0 then call syserr$error_code (CRASH, ercode, "init_branches: error from set$max_length ");
398 ml_to_return = max_length;
399 return;
400 end create_branch;
401
402 %page;
403 %include acl_structures;
404 %page;
405 %include access_mode_values;
406 %page;
407 %include aste;
408 %page;
409 %include dc_find_dcls;
410 %page;
411 %include dir_entry;
412 %page;
413 %include dir_name;
414 %page;
415 %include dir_header;
416 %page;
417 %include fs_obj_access_codes;
418 %page;
419 %include sdw_info;
420 %page;
421 %include slt;
422 %page;
423 %include slte;
424 %page;
425 %include sst;
426 %page;
427 %include sstnt;
428 %page;
429 %include status_structures;
430 %page;
431 %include syserr_constants;
432 %page;
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732 end init_branches;