COMPILATION LISTING OF SEGMENT mdc_lock_ Compiled by: Multics PL/I Compiler, Release 32f, of October 9, 1989 Compiled at: Bull HN, Phoenix AZ, System-M Compiled on: 11/11/89 1021.1 mst Sat Options: optimize map 1 /****^ *********************************************************** 2* * * 3* * Copyright, (C) Honeywell Bull Inc., 1987 * 4* * * 5* * Copyright, (C) Honeywell Information Systems Inc., 1982 * 6* * * 7* * Copyright (c) 1972 by Massachusetts Institute of * 8* * Technology and Honeywell Information Systems, Inc. * 9* * * 10* *********************************************************** */ 11 12 13 /* MDC_LOCK_: Entries which handle the master directory control lock */ 14 15 /* Written April 1976 by Larry Johnson */ 16 /* Bug fixed September 1977 by Larry Johnson */ 17 18 mdc_lock_: proc; 19 20 /* Parameters */ 21 22 dcl arg_code fixed bin (35); 23 24 /* Automatic */ 25 26 dcl code fixed bin (35); 27 dcl vl fixed bin; /* Validation level */ 28 dcl mdc_data_rings (3) fixed bin (3); 29 30 /* Static */ 31 32 dcl saved_data_ptr ptr int static init (null); 33 dcl test_mode bit (1) int static init ("0"b); /* For debugging */ 34 35 /* Constants */ 36 37 dcl mdc_data_dir char (32) int static options (constant) init (">system_library_1"); 38 dcl mdc_data_ename char (32) int static options (constant) init ("mdc_data"); 39 40 1 1 /* Begin include file ..... mdc_data.incl.pl1 */ 1 2 1 3 /* Declaration of mdc_data segment, containing mdc lock */ 1 4 1 5 dcl mdc_datap ptr; 1 6 1 7 dcl 1 mdc_data aligned based (mdc_datap), 1 8 2 lock bit (36), /* The actual lock */ 1 9 2 lock_cnt fixed bin (35), /* Meter of times locked */ 1 10 2 unlock_cnt fixed bin (35), /* Meter of times unlocked */ 1 11 2 fill fixed bin (35), 1 12 2 time_locked fixed bin (71), /* Time last locked */ 1 13 2 time_spent_locked fixed bin (71), /* Total time lock was locked */ 1 14 2 locker_name char (32); /* Name of process locking lock */ 1 15 1 16 /* End include file ..... mdc_data.incl.pl1 */ 41 42 43 44 /* External stuff */ 45 46 dcl admin_gate_$syserr_error_code entry options (variable); 47 dcl clock_ entry returns (fixed bin (52)); 48 dcl cu_$level_get entry (fixed bin); 49 dcl cu_$level_set entry (fixed bin); 50 dcl get_group_id_ entry returns (char (32)); 51 dcl get_lock_id_ entry returns (bit (36)); 52 dcl get_ring_ entry returns (fixed bin); 53 dcl hcs_$initiate entry (char (*), char (*), char (*), fixed bin (1), fixed bin (2), ptr, fixed bin (35)); 54 dcl hcs_$truncate_file entry (char (*), char (*), fixed bin (19), fixed bin (35)); 55 dcl hcs_$append_branchx entry (char (*), char (*), fixed bin (5), dim (3) fixed bin (3), char (*), fixed bin (1), 56 fixed bin (1), fixed bin (24), fixed bin (35)); 57 dcl admin_gate_$reclassify_sys_seg entry (char (*), char (*), bit (72) aligned, fixed bin (35)); 58 dcl get_max_authorization_ entry returns (bit (72) aligned); 59 dcl set_lock_$lock entry (bit (36) aligned, fixed bin, fixed bin (35)); 60 dcl set_lock_$unlock entry (bit (36) aligned, fixed bin (35)); 61 62 dcl error_table_$invalid_lock_reset ext fixed bin (35); 63 dcl error_table_$namedup ext fixed bin (35); 64 65 dcl (null) builtin; 66 67 /* Entries to handle the mdcs lock */ 68 69 set: entry (arg_code); 70 71 if test_mode then do; 72 arg_code = 0; 73 return; 74 end; 75 call find_mdc_data; /* Get pointer */ 76 call set_lock_$lock (mdc_data.lock, 30, code); 77 if code = 0 then go to locked; /* Locked ok */ 78 if code = error_table_$invalid_lock_reset then do; /* Recoverable error */ 79 call admin_gate_$syserr_error_code (4, code, "mdcs_util_$lock:"); 80 code = 0; 81 go to locked; 82 end; 83 84 arg_code = code; 85 86 return; /* Lock failed */ 87 88 locked: mdc_data.lock_cnt = mdc_data.lock_cnt + 1; /* Do some meters */ 89 mdc_data.time_locked = clock_ (); 90 mdc_data.locker_name = get_group_id_ (); 91 arg_code = code; 92 return; 93 94 95 reset: entry; 96 97 if test_mode then return; 98 call find_mdc_data; 99 unlock_common: 100 mdc_data.unlock_cnt = mdc_data.unlock_cnt + 1; 101 mdc_data.time_spent_locked = mdc_data.time_spent_locked + clock_ () - mdc_data.time_locked; 102 call set_lock_$unlock (mdc_data.lock, code); 103 if code ^= 0 then call admin_gate_$syserr_error_code (4, code, "mdcs_util_$unlock:"); 104 return; 105 106 107 /* Entry called by cleanup handlers on crawl-out. It is not certain that the lock is locked */ 108 109 cleanup: entry; 110 111 if test_mode then return; 112 if saved_data_ptr = null then return; /* Never called lock */ 113 mdc_datap = saved_data_ptr; 114 115 if mdc_data.lock ^= get_lock_id_ () then return; /* Not locked by me */ 116 go to unlock_common; /* Join std path */ 117 118 /* Entry to set test mode */ 119 120 set_test_mode: entry; 121 122 test_mode = "1"b; 123 return; 124 125 /* Internal procedure to get a pointer to the mdc_data segment */ 126 127 find_mdc_data: proc; 128 129 dcl mdc_data_err condition; 130 131 if saved_data_ptr ^= null then do; /* Pointer already knwon */ 132 mdc_datap = saved_data_ptr; 133 return; 134 end; 135 136 call cu_$level_get (vl); 137 call cu_$level_set (get_ring_ ()); 138 call hcs_$initiate (mdc_data_dir, mdc_data_ename, "", 0, 0, saved_data_ptr, code); 139 call cu_$level_set (vl); 140 141 if saved_data_ptr ^= null then do; /* It worked */ 142 mdc_datap = saved_data_ptr; 143 return; 144 end; 145 146 call admin_gate_$syserr_error_code (4, code, 147 "mdc_lock_: Unable to initiate ^a>^a.", mdc_data_dir, mdc_data_ename); 148 149 signal mdc_data_err; /* I don't know what else to do now */ 150 151 return; 152 153 end find_mdc_data; 154 155 /* Initialization entry to create the mdc_data segment which contains the lock */ 156 157 mdc_data_init: entry; 158 159 if test_mode then return; 160 161 mdc_data_rings = get_ring_ (); 162 call hcs_$append_branchx (mdc_data_dir, mdc_data_ename, 01010b, mdc_data_rings, "*.*.*", 0, 0, 0, code); 163 if (code ^= 0) & (code ^= error_table_$namedup) then do; 164 call admin_gate_$syserr_error_code (0, code, "mdc_lock_$mdc_data_init: Unable to create ^a>^a.", 165 mdc_data_dir, mdc_data_ename); 166 return; 167 end; 168 169 if code = error_table_$namedup then do; 170 call hcs_$truncate_file (mdc_data_dir, mdc_data_ename, 0, code); 171 if code ^= 0 then do; 172 call admin_gate_$syserr_error_code (0, code, "mdc_lock_$mdc_data_init: Unable to truncate ^a>^a.", 173 mdc_data_dir, mdc_data_ename); 174 return; 175 end; 176 end; 177 178 call admin_gate_$reclassify_sys_seg (mdc_data_dir, mdc_data_ename, get_max_authorization_ (), code); 179 if code ^= 0 then 180 call admin_gate_$syserr_error_code (0, code, "mdc_lock_$mdc_data_init: Unable to reclassify ^a>^a.", 181 mdc_data_dir, mdc_data_ename); 182 return; 183 184 /* BEGIN MESSAGE DOCUMENTATION 185* 186* Message: 187* mdc_lock_$lock: LOCK ERROR MESSAGE. 188* 189* S: $log 190* 191* T: $run 192* 193* M: A master directory operation failed because of a problem with the 194* master directory control lock. 195* 196* A: $ignore 197* 198* Message: 199* mdc_lock_$unlock: LOCK ERROR MESSAGE. 200* 201* S: $log 202* 203* T: $run 204* 205* M: At the completion of a master directory control operation, some 206* error occured unlocking the master directory control lock. 207* 208* A: $ignore 209* 210* Message: 211* mdc_lock_: Unable to initiate PATHNAME. REASON. 212* 213* S: $log 214* 215* T: $run 216* 217* M: Master directory control was unable to initiate PATHNAME, which 218* contains the master directory control lock, because of REASON. 219* The master directory control operation requested was not performed. 220* 221* A: $ignore 222* 223* Message: 224* mdc_lock_$mdc_data_init: Unable to create PATHNAME. REASON. 225* 226* S: $info 227* 228* T: $init 229* 230* M: Master directory control was unable to create the segment PATHNAME, to 231* be used for the master directory control lock, for the REASON given. 232* Subsequent master directory control operations may fail. 233* 234* A: ignore 235* 236* Message: 237* mdc_lock_$mdc_data_init: Unable to truncate PATHNAME. REASON. 238* 239* S: $info 240* 241* T: $init 242* 243* M: Master directory control was unable to truncate the segment PATHNAME 244* for the REASON given. This segment is to be used for the 245* master directory control lock. Subsequent master directory control 246* operations may fail. 247* 248* A: $ignore 249* 250* Message: 251* mdc_lock_$mdc_data_init: Unable to reclassify PATHNAME. REASON. 252* 253* S: $info 254* 255* T: $init 256* 257* M: Master directory control was unable to reclassify the segment PATHNAME 258* to its proper access class for the REASON given. 259* This segment is to be used for the master directory control lock. 260* Subsequent master directory control operations may fail. 261* 262* END MESSAGE DOCUMENTATION */ 263 264 265 end mdc_lock_; SOURCE FILES USED IN THIS COMPILATION. LINE NUMBER DATE MODIFIED NAME PATHNAME 0 11/11/89 0802.5 mdc_lock_.pl1 >spec>install>1111>mdc_lock_.pl1 41 1 04/29/76 1105.1 mdc_data.incl.pl1 >ldd>include>mdc_data.incl.pl1 NAMES DECLARED IN THIS COMPILATION. IDENTIFIER OFFSET LOC STORAGE CLASS DATA TYPE ATTRIBUTES AND REFERENCES (* indicates a set context) NAMES DECLARED BY DECLARE STATEMENT. admin_gate_$reclassify_sys_seg 000040 constant entry external dcl 57 ref 178 admin_gate_$syserr_error_code 000014 constant entry external dcl 46 ref 79 103 146 164 172 179 arg_code parameter fixed bin(35,0) dcl 22 set ref 69 72* 84* 91* clock_ 000016 constant entry external dcl 47 ref 89 101 code 000100 automatic fixed bin(35,0) dcl 26 set ref 76* 77 78 79* 80* 84 91 102* 103 103* 138* 146* 162* 163 163 164* 169 170* 171 172* 178* 179 179* cu_$level_get 000020 constant entry external dcl 48 ref 136 cu_$level_set 000022 constant entry external dcl 49 ref 137 139 error_table_$invalid_lock_reset 000050 external static fixed bin(35,0) dcl 62 ref 78 error_table_$namedup 000052 external static fixed bin(35,0) dcl 63 ref 163 169 get_group_id_ 000024 constant entry external dcl 50 ref 90 get_lock_id_ 000026 constant entry external dcl 51 ref 115 get_max_authorization_ 000042 constant entry external dcl 58 ref 178 178 get_ring_ 000030 constant entry external dcl 52 ref 137 137 161 hcs_$append_branchx 000036 constant entry external dcl 55 ref 162 hcs_$initiate 000032 constant entry external dcl 53 ref 138 hcs_$truncate_file 000034 constant entry external dcl 54 ref 170 lock based bit(36) level 2 dcl 1-7 set ref 76* 102* 115 lock_cnt 1 based fixed bin(35,0) level 2 dcl 1-7 set ref 88* 88 locker_name 10 based char(32) level 2 dcl 1-7 set ref 90* mdc_data based structure level 1 dcl 1-7 mdc_data_dir 000010 constant char(32) initial packed unaligned dcl 37 set ref 138* 146* 162* 164* 170* 172* 178* 179* mdc_data_ename 000000 constant char(32) initial packed unaligned dcl 38 set ref 138* 146* 162* 164* 170* 172* 178* 179* mdc_data_err 000120 stack reference condition dcl 129 ref 149 mdc_data_rings 000102 automatic fixed bin(3,0) array dcl 28 set ref 161* 162* mdc_datap 000106 automatic pointer dcl 1-5 set ref 76 88 88 89 90 99 99 101 101 101 102 113* 115 132* 142* null builtin function dcl 65 ref 112 131 141 saved_data_ptr 000010 internal static pointer initial dcl 32 set ref 112 113 131 132 138* 141 142 set_lock_$lock 000044 constant entry external dcl 59 ref 76 set_lock_$unlock 000046 constant entry external dcl 60 ref 102 test_mode 000012 internal static bit(1) initial packed unaligned dcl 33 set ref 71 97 111 122* 159 time_locked 4 based fixed bin(71,0) level 2 dcl 1-7 set ref 89* 101 time_spent_locked 6 based fixed bin(71,0) level 2 dcl 1-7 set ref 101* 101 unlock_cnt 2 based fixed bin(35,0) level 2 dcl 1-7 set ref 99* 99 vl 000101 automatic fixed bin(17,0) dcl 27 set ref 136* 139* NAMES DECLARED BY EXPLICIT CONTEXT. cleanup 000407 constant entry external dcl 109 find_mdc_data 001000 constant entry internal dcl 127 ref 75 98 locked 000253 constant label dcl 88 ref 77 81 mdc_data_init 000452 constant entry external dcl 157 mdc_lock_ 000150 constant entry external dcl 18 reset 000312 constant entry external dcl 95 set 000161 constant entry external dcl 69 set_test_mode 000440 constant entry external dcl 120 unlock_common 000323 constant label dcl 99 ref 116 THERE WERE NO NAMES DECLARED BY CONTEXT OR IMPLICATION. STORAGE REQUIREMENTS FOR THIS PROGRAM. Object Text Link Symbol Defs Static Start 0 0 1424 1500 1156 1434 Length 1724 1156 54 207 246 4 BLOCK NAME STACK SIZE TYPE WHY NONQUICK/WHO SHARES STACK FRAME mdc_lock_ 212 external procedure is an external procedure. find_mdc_data internal procedure shares stack frame of external procedure mdc_lock_. STORAGE FOR INTERNAL STATIC VARIABLES. LOC IDENTIFIER BLOCK NAME 000010 saved_data_ptr mdc_lock_ 000012 test_mode mdc_lock_ STORAGE FOR AUTOMATIC VARIABLES. STACK FRAME LOC IDENTIFIER BLOCK NAME mdc_lock_ 000100 code mdc_lock_ 000101 vl mdc_lock_ 000102 mdc_data_rings mdc_lock_ 000106 mdc_datap mdc_lock_ THE FOLLOWING EXTERNAL OPERATORS ARE USED BY THIS PROGRAM. call_ext_out_desc call_ext_out return_mac signal_op ext_entry THE FOLLOWING EXTERNAL ENTRIES ARE CALLED BY THIS PROGRAM. admin_gate_$reclassify_sys_seg admin_gate_$syserr_error_code clock_ cu_$level_get cu_$level_set get_group_id_ get_lock_id_ get_max_authorization_ get_ring_ hcs_$append_branchx hcs_$initiate hcs_$truncate_file set_lock_$lock set_lock_$unlock THE FOLLOWING EXTERNAL VARIABLES ARE USED BY THIS PROGRAM. error_table_$invalid_lock_reset error_table_$namedup LINE LOC LINE LOC LINE LOC LINE LOC LINE LOC LINE LOC LINE LOC 18 000147 69 000155 71 000166 72 000170 73 000172 75 000173 76 000174 77 000211 78 000213 79 000216 80 000246 81 000247 84 000250 86 000252 88 000253 89 000260 90 000272 91 000305 92 000310 95 000311 97 000317 98 000322 99 000323 101 000330 102 000344 103 000355 104 000405 109 000406 111 000414 112 000417 113 000423 115 000425 116 000436 120 000437 122 000445 123 000450 157 000451 159 000457 161 000462 162 000501 163 000557 164 000564 166 000617 169 000620 170 000623 171 000647 172 000651 174 000705 178 000706 179 000741 182 000777 127 001000 131 001001 132 001006 133 001010 136 001011 137 001017 138 001035 139 001077 141 001106 142 001113 143 001115 146 001116 149 001152 151 001155 ----------------------------------------------------------- Historical Background This edition of the Multics software materials and documentation is provided and donated to Massachusetts Institute of Technology by Group BULL including BULL HN Information Systems Inc. as a contribution to computer science knowledge. This donation is made also to give evidence of the common contributions of Massachusetts Institute of Technology, Bell Laboratories, General Electric, Honeywell Information Systems Inc., Honeywell BULL Inc., Groupe BULL and BULL HN Information Systems Inc. to the development of this operating system. Multics development was initiated by Massachusetts Institute of Technology Project MAC (1963-1970), renamed the MIT Laboratory for Computer Science and Artificial Intelligence in the mid 1970s, under the leadership of Professor Fernando Jose Corbato. Users consider that Multics provided the best software architecture for managing computer hardware properly and for executing programs. Many subsequent operating systems incorporated Multics principles. Multics was distributed in 1975 to 2000 by Group Bull in Europe , and in the U.S. by Bull HN Information Systems Inc., as successor in interest by change in name only to Honeywell Bull Inc. and Honeywell Information Systems Inc. . ----------------------------------------------------------- Permission to use, copy, modify, and distribute these programs and their documentation for any purpose and without fee is hereby granted,provided that the below copyright notice and historical background appear in all copies and that both the copyright notice and historical background and this permission notice appear in supporting documentation, and that the names of MIT, HIS, BULL or BULL HN not be used in advertising or publicity pertaining to distribution of the programs without specific prior written permission. Copyright 1972 by Massachusetts Institute of Technology and Honeywell Information Systems Inc. Copyright 2006 by BULL HN Information Systems Inc. Copyright 2006 by Bull SAS All Rights Reserved