COMPILATION LISTING OF SEGMENT tty_tables_mgr 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 0935.4 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 tty_tables_mgr: proc; 14 15 /* A program to manage the addition and deletion of tables 16* to and from the tty_tables segment. This segment must be 17* locked before performing modifications. 18**/ 19 20 /* Coded by J. Stern 3/14/77 */ 21 22 23 /* parameters */ 24 25 dcl a_new_table_ptr ptr; /* ptr to table to be added (Input) */ 26 dcl a_new_table_size fixed bin; /* size (in chars) of table to be added (Input) */ 27 dcl a_type fixed bin; /* type of table to be added (Input) */ 28 dcl a_table_rel bit (18); /* rel ptr to stored table (Output) (Input) */ 29 dcl a_code fixed bin; /* standard error code (Output) */ 30 31 32 /* automatic */ 33 34 dcl new_table_ptr ptr; 35 dcl new_table_size fixed bin; 36 dcl type fixed bin; 37 dcl (next_tdp, prev_tdp) ptr; 38 dcl (td_rel, next_td_rel, prev_td_rel) bit (18); 39 dcl code fixed bin (35); 40 dcl saved_count fixed bin; 41 dcl saved_ref_count fixed bin; 42 dcl changing_threads bit (1) aligned; 43 44 45 /* based */ 46 47 dcl new_table (new_table_size) bit (36) aligned based (new_table_ptr); 48 49 50 /* conditions */ 51 52 dcl (cleanup, area) condition; 53 54 55 /* static */ 56 57 dcl (error_table_$bad_index, 58 error_table_$no_table, 59 error_table_$notalloc) fixed bin (35) ext static; 60 dcl pds$processid bit (36) aligned ext static; 61 dcl crash_system fixed bin int static options (constant) init (1); 62 63 64 /* builtins */ 65 66 dcl (addr, null, ptr, rel, bin, bit, unspec) builtin; 67 68 69 /* entries */ 70 71 dcl lock$lock_fast entry (ptr); 72 dcl lock$unlock_fast entry (ptr); 73 dcl syserr entry options (variable); 74 1 1 /* BEGIN INCLUDE FILE ... tty_tables.incl.pl1 */ 1 2 1 3 /* Created 3/14/77 by J. Stern */ 1 4 1 5 1 6 dcl tty_tables$ ext static; /* table storage segment */ 1 7 1 8 dcl 1 tty_tables_hdr aligned based (ttytp), /* header of tty_tables segment */ 1 9 2 lock bit (36) aligned, /* lock for modifications */ 1 10 2 event fixed bin (35), /* event to wait for if locked */ 1 11 2 notify_reqd bit (1) aligned, /* if ON, notify requested after unlocking */ 1 12 2 table_area_size fixed bin (18), /* size of table allocation area */ 1 13 2 per_type_data (6), /* data kept on per table type basis */ 1 14 3 first_table bit (18) aligned, /* rel ptr to first table in list */ 1 15 3 count fixed bin, /* count of tables in list */ 1 16 2 table_area area (tty_tables_hdr.table_area_size); /* table allocation area */ 1 17 1 18 dcl ttytp ptr; /* ptr to tty_tables_hdr */ 1 19 1 20 dcl 1 table_descriptor aligned based (tdp), /* entry in threaded list of tables */ 1 21 2 pattern bit (36) aligned, /* = (18) "10"b */ 1 22 2 type fixed bin, /* table type */ 1 23 2 next_table bit (18) aligned, /* rel ptr to next table in list */ 1 24 2 prev_table bit (18) aligned, /* rel ptr to previous table in list */ 1 25 2 ref_count fixed bin, /* reference count (times added minus times deleted) */ 1 26 2 len fixed bin, /* table length in bits */ 1 27 2 table_contents bit (table_alloc_len refer (table_descriptor.len)); 1 28 1 29 dcl tdp ptr; /* ptr to table_descriptor */ 1 30 dcl table_alloc_len fixed bin; /* table length used to allocate new table_descriptor */ 1 31 1 32 1 33 /* END INCLUDE FILE ... tty_tables.incl.pl1 */ 75 76 77 add: entry (a_new_table_ptr, a_new_table_size, a_type, a_table_rel, a_code); 78 79 ttytp = addr (tty_tables$); 80 new_table_ptr = a_new_table_ptr; 81 new_table_size = a_new_table_size; 82 type = a_type; 83 code = 0; 84 85 if type < 1 | type > 6 86 then do; 87 call syserr ((crash_system), "tty_tables_mgr$add: Invalid table type. ^d", type); 88 a_code = error_table_$bad_index; 89 return; 90 end; 91 92 tdp = null; 93 changing_threads = "0"b; 94 saved_count = tty_tables_hdr.count (type); 95 on cleanup begin; 96 if changing_threads 97 then do; 98 call unthread_td; 99 tty_tables_hdr.count (type) = saved_count; 100 end; 101 else if tdp ^= null 102 then call free_td; 103 if tty_tables_hdr.lock = pds$processid 104 then call lock$unlock_fast (ttytp); 105 end; 106 call lock$lock_fast (ttytp); 107 108 on area begin; 109 code = error_table_$notalloc; 110 go to add_unlock; 111 end; 112 113 table_alloc_len = new_table_size * 36; 114 allocate table_descriptor in (table_area) set (tdp); 115 revert area; 116 117 td_rel = rel (tdp); 118 addr (table_descriptor.table_contents) -> new_table = new_table; 119 120 prev_td_rel = ""b; 121 prev_tdp = null; 122 do next_td_rel = tty_tables_hdr.first_table (type) repeat next_tdp -> table_descriptor.next_table 123 while (next_td_rel ^= ""b); 124 next_tdp = ptr (ttytp, next_td_rel); 125 if table_descriptor.table_contents < next_tdp -> table_descriptor.table_contents 126 then go to insert_td; 127 if table_descriptor.table_contents = next_tdp -> table_descriptor.table_contents 128 then if table_descriptor.len = next_tdp -> table_descriptor.len 129 then do; 130 call free_td; 131 next_tdp -> table_descriptor.ref_count = next_tdp -> table_descriptor.ref_count + 1; 132 tdp = next_tdp; 133 go to add_unlock; 134 end; 135 else if table_descriptor.len < next_tdp -> table_descriptor.len 136 then go to insert_td; 137 138 prev_td_rel = next_td_rel; 139 prev_tdp = next_tdp; 140 end; 141 next_tdp = null; 142 143 insert_td: table_descriptor.pattern = (18) "10"b; 144 table_descriptor.type = type; 145 table_descriptor.next_table = next_td_rel; 146 table_descriptor.prev_table = prev_td_rel; 147 table_descriptor.ref_count = 1; 148 149 changing_threads = "1"b; 150 call thread_td; 151 152 tty_tables_hdr.count (type) = tty_tables_hdr.count (type) + 1; 153 add_unlock: call lock$unlock_fast (ttytp); 154 revert cleanup; 155 a_code = code; 156 if code = 0 157 then a_table_rel = rel (addr (table_descriptor.table_contents)); 158 return; 159 160 delete: entry (a_table_rel, a_code); 161 162 ttytp = addr (tty_tables$); 163 td_rel = bit (bin (bin (a_table_rel, 18) -6, 18), 18); /* table desc offset = table offset - 6 */ 164 tdp = ptr (ttytp, td_rel); 165 type = table_descriptor.type; 166 167 if table_descriptor.pattern ^= (18) "10"b 168 then do; 169 call syserr ((crash_system), "tty_tables_mgr$delete: Invalid table offset. ^6o", bin (td_rel, 18)); 170 a_code = error_table_$no_table; 171 return; 172 end; 173 changing_threads = "0"b; 174 saved_ref_count = table_descriptor.ref_count; 175 saved_count = tty_tables_hdr.count (type); 176 on cleanup begin; 177 if tdp = null /* if table already freed */ 178 then tty_tables_hdr.count (type) = saved_count -1; 179 else do; 180 if changing_threads 181 then call thread_td; 182 table_descriptor.ref_count = saved_ref_count; 183 end; 184 if tty_tables_hdr.lock = pds$processid 185 then call lock$unlock_fast (ttytp); 186 end; 187 call lock$lock_fast (ttytp); 188 189 table_descriptor.ref_count = table_descriptor.ref_count -1; 190 if table_descriptor.ref_count > 0 191 then go to del_unlock; 192 193 prev_td_rel = table_descriptor.prev_table; 194 if prev_td_rel = ""b 195 then prev_tdp = null; 196 else prev_tdp = ptr (ttytp, prev_td_rel); 197 next_td_rel = table_descriptor.next_table; 198 if next_td_rel = ""b 199 then next_tdp = null; 200 else next_tdp = ptr (ttytp, next_td_rel); 201 202 changing_threads = "1"b; 203 call unthread_td; 204 tty_tables_hdr.count (type) = tty_tables_hdr.count (type) -1; 205 del_unlock: call lock$unlock_fast (ttytp); 206 revert cleanup; 207 a_code = 0; 208 return; 209 210 unthread_td: proc; /* unthreads and deallocates a table descriptor */ 211 212 if prev_tdp = null 213 then tty_tables_hdr.first_table (type) = next_td_rel; 214 else prev_tdp -> table_descriptor.next_table = next_td_rel; 215 if next_tdp = null 216 then; 217 else next_tdp -> table_descriptor.prev_table = prev_td_rel; 218 219 220 free_td: entry; /* deallocates a table descriptor */ 221 222 free table_descriptor in (table_area); 223 tdp = null; 224 225 end unthread_td; 226 227 228 229 230 thread_td: proc; /* threads in a table descriptor */ 231 232 if prev_tdp = null 233 then tty_tables_hdr.first_table (type) = td_rel; 234 else prev_tdp -> table_descriptor.next_table = td_rel; 235 if next_tdp = null 236 then; 237 else next_tdp -> table_descriptor.prev_table = td_rel; 238 239 end thread_td; 240 241 /* BEGIN MESSAGE DOCUMENTATION 242* 243* Message: 244* tty_tables_mgr$add: Invalid table type. N 245* 246* S: $crash 247* 248* T: $run 249* 250* M: An attempt to add a table to the tty_tables segment has 251* failed due to an invalid table type of N. 252* 253* A: $inform 254* 255* 256* Message: 257* tty_tables_mgr$delete: Invalid table offset. N 258* 259* S: $crash 260* 261* T: $run 262* 263* M: An attempt to delete a table from the tty_tables segment 264* has failed due to an invalid table offset of N. 265* 266* A: $inform 267* 268* END MESSAGE DOCUMENTATION */ 269 270 271 272 273 end tty_tables_mgr; SOURCE FILES USED IN THIS COMPILATION. LINE NUMBER DATE MODIFIED NAME PATHNAME 0 11/11/89 0826.9 tty_tables_mgr.pl1 >spec>install>1112>tty_tables_mgr.pl1 75 1 02/23/79 1435.1 tty_tables.incl.pl1 >ldd>include>tty_tables.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. a_code parameter fixed bin(17,0) dcl 29 set ref 77 88* 155* 160 170* 207* a_new_table_ptr parameter pointer dcl 25 ref 77 80 a_new_table_size parameter fixed bin(17,0) dcl 26 ref 77 81 a_table_rel parameter bit(18) packed unaligned dcl 28 set ref 77 156* 160 163 a_type parameter fixed bin(17,0) dcl 27 ref 77 82 addr builtin function dcl 66 ref 79 118 156 162 area 000126 stack reference condition dcl 52 ref 108 115 bin builtin function dcl 66 ref 163 163 169 169 bit builtin function dcl 66 ref 163 changing_threads 000116 automatic bit(1) dcl 42 set ref 93* 96 149* 173* 180 202* cleanup 000120 stack reference condition dcl 52 ref 95 154 176 206 code 000113 automatic fixed bin(35,0) dcl 39 set ref 83* 109* 155 156 count 5 based fixed bin(17,0) array level 3 dcl 1-8 set ref 94 99* 152* 152 175 177* 204* 204 crash_system constant fixed bin(17,0) initial dcl 61 ref 87 169 error_table_$bad_index 000010 external static fixed bin(35,0) dcl 57 ref 88 error_table_$no_table 000012 external static fixed bin(35,0) dcl 57 ref 170 error_table_$notalloc 000014 external static fixed bin(35,0) dcl 57 ref 109 first_table 4 based bit(18) array level 3 dcl 1-8 set ref 122 212* 232* len 5 based fixed bin(17,0) level 2 dcl 1-20 set ref 114* 118 125 125 127 127 127 127 135 135 156 222 lock based bit(36) level 2 dcl 1-8 ref 103 184 lock$lock_fast 000020 constant entry external dcl 71 ref 106 187 lock$unlock_fast 000022 constant entry external dcl 72 ref 103 153 184 205 new_table based bit(36) array dcl 47 set ref 118* 118 new_table_ptr 000100 automatic pointer dcl 34 set ref 80* 118 new_table_size 000102 automatic fixed bin(17,0) dcl 35 set ref 81* 113 118 next_table 2 based bit(18) level 2 dcl 1-20 set ref 140 145* 197 214* 234* next_td_rel 000111 automatic bit(18) packed unaligned dcl 38 set ref 122* 122* 124 138* 145 197* 198 200 212 214 next_tdp 000104 automatic pointer dcl 37 set ref 124* 125 127 127 131 131 132 135 139 140 141* 198* 200* 215 217 235 237 null builtin function dcl 66 ref 92 101 121 141 177 194 198 212 215 223 232 235 pattern based bit(36) level 2 dcl 1-20 set ref 143* 167 pds$processid 000016 external static bit(36) dcl 60 ref 103 184 per_type_data 4 based structure array level 2 dcl 1-8 prev_table 3 based bit(18) level 2 dcl 1-20 set ref 146* 193 217* 237* prev_td_rel 000112 automatic bit(18) packed unaligned dcl 38 set ref 120* 138* 146 193* 194 196 217 prev_tdp 000106 automatic pointer dcl 37 set ref 121* 139* 194* 196* 212 214 232 234 ptr builtin function dcl 66 ref 124 164 196 200 ref_count 4 based fixed bin(17,0) level 2 dcl 1-20 set ref 131* 131 147* 174 182* 189* 189 190 rel builtin function dcl 66 ref 117 156 saved_count 000114 automatic fixed bin(17,0) dcl 40 set ref 94* 99 175* 177 saved_ref_count 000115 automatic fixed bin(17,0) dcl 41 set ref 174* 182 syserr 000024 constant entry external dcl 73 ref 87 169 table_alloc_len 000140 automatic fixed bin(17,0) dcl 1-30 set ref 113* 114 114 table_area 20 based area level 2 dcl 1-8 ref 114 222 table_contents 6 based bit level 2 dcl 1-20 set ref 118 125 125 127 127 156 table_descriptor based structure level 1 dcl 1-20 set ref 114 222 td_rel 000110 automatic bit(18) packed unaligned dcl 38 set ref 117* 163* 164 169 169 232 234 237 tdp 000136 automatic pointer dcl 1-29 set ref 92* 101 114* 117 118 125 127 127 132* 135 143 144 145 146 147 156 164* 165 167 174 177 182 189 189 190 193 197 222 223* tty_tables$ 000026 external static fixed bin(17,0) dcl 1-6 set ref 79 162 tty_tables_hdr based structure level 1 dcl 1-8 ttytp 000134 automatic pointer dcl 1-18 set ref 79* 94 99 103 103* 106* 114 122 124 152 152 153* 162* 164 175 177 184 184* 187* 196 200 204 204 205* 212 222 232 type 000103 automatic fixed bin(17,0) dcl 36 in procedure "tty_tables_mgr" set ref 82* 85 85 87* 94 99 122 144 152 152 165* 175 177 204 204 212 232 type 1 based fixed bin(17,0) level 2 in structure "table_descriptor" dcl 1-20 in procedure "tty_tables_mgr" set ref 144* 165 NAME DECLARED BY DECLARE STATEMENT AND NEVER REFERENCED. unspec builtin function dcl 66 NAMES DECLARED BY EXPLICIT CONTEXT. add 000060 constant entry external dcl 77 add_unlock 000407 constant label dcl 153 ref 110 133 del_unlock 000675 constant label dcl 205 ref 190 delete 000440 constant entry external dcl 160 free_td 000745 constant entry internal dcl 220 ref 101 130 insert_td 000362 constant label dcl 143 ref 125 135 thread_td 000767 constant entry internal dcl 230 ref 150 180 tty_tables_mgr 000045 constant entry external dcl 13 unthread_td 000710 constant entry internal dcl 210 ref 98 203 THERE WERE NO NAMES DECLARED BY CONTEXT OR IMPLICATION. STORAGE REQUIREMENTS FOR THIS PROGRAM. Object Text Link Symbol Defs Static Start 0 0 1212 1242 1023 1222 Length 1454 1023 30 175 166 0 BLOCK NAME STACK SIZE TYPE WHY NONQUICK/WHO SHARES STACK FRAME tty_tables_mgr 146 external procedure is an external procedure. on unit on line 95 70 on unit on unit on line 108 64 on unit on unit on line 176 70 on unit unthread_td 64 internal procedure is called by several nonquick procedures. thread_td 64 internal procedure is called by several nonquick procedures. STORAGE FOR AUTOMATIC VARIABLES. STACK FRAME LOC IDENTIFIER BLOCK NAME tty_tables_mgr 000100 new_table_ptr tty_tables_mgr 000102 new_table_size tty_tables_mgr 000103 type tty_tables_mgr 000104 next_tdp tty_tables_mgr 000106 prev_tdp tty_tables_mgr 000110 td_rel tty_tables_mgr 000111 next_td_rel tty_tables_mgr 000112 prev_td_rel tty_tables_mgr 000113 code tty_tables_mgr 000114 saved_count tty_tables_mgr 000115 saved_ref_count tty_tables_mgr 000116 changing_threads tty_tables_mgr 000134 ttytp tty_tables_mgr 000136 tdp tty_tables_mgr 000140 table_alloc_len tty_tables_mgr THE FOLLOWING EXTERNAL OPERATORS ARE USED BY THIS PROGRAM. call_ext_out_desc call_ext_out call_int_this call_int_other return_mac tra_ext_1 enable_op ext_entry int_entry op_alloc_ op_freen_ THE FOLLOWING EXTERNAL ENTRIES ARE CALLED BY THIS PROGRAM. lock$lock_fast lock$unlock_fast syserr THE FOLLOWING EXTERNAL VARIABLES ARE USED BY THIS PROGRAM. error_table_$bad_index error_table_$no_table error_table_$notalloc pds$processid tty_tables$ LINE LOC LINE LOC LINE LOC LINE LOC LINE LOC LINE LOC LINE LOC 13 000044 77 000052 79 000072 80 000074 81 000100 82 000102 83 000104 85 000105 87 000111 88 000135 89 000140 92 000141 93 000143 94 000144 95 000150 96 000164 98 000167 99 000174 100 000203 101 000204 103 000215 105 000230 106 000231 108 000240 109 000254 110 000257 113 000262 114 000265 115 000300 117 000301 118 000303 120 000311 121 000312 122 000314 124 000324 125 000327 127 000336 130 000342 131 000346 132 000350 133 000351 135 000352 138 000353 139 000354 140 000355 141 000360 143 000362 144 000364 145 000367 146 000371 147 000373 149 000375 150 000377 152 000403 153 000407 154 000416 155 000417 156 000421 158 000433 160 000434 162 000452 163 000455 164 000471 165 000474 167 000476 169 000501 170 000531 171 000534 173 000535 174 000536 175 000540 176 000544 177 000560 180 000575 182 000604 184 000610 186 000622 187 000623 189 000632 190 000635 193 000637 194 000641 196 000645 197 000650 198 000652 200 000656 202 000661 203 000663 204 000667 205 000675 206 000704 207 000705 208 000706 210 000707 212 000715 214 000730 215 000733 217 000740 220 000743 222 000752 223 000762 225 000765 230 000766 232 000774 234 001007 235 001012 237 001017 239 001022 ----------------------------------------------------------- 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