COMPILATION LISTING OF SEGMENT try_to_unlock_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 0938.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* *********************************************************** */ 8 9 /* ****************************************************** 10* * * 11* * * 12* * Copyright (c) 1972 by Massachusetts Institute of * 13* * Technology and Honeywell Information Systems, Inc. * 14* * * 15* * * 16* ****************************************************** */ 17 18 /* The following entry is called in order to allow non-hardcore procedures 19* to unlock a lock if it was originally locked by a process that no longer 20* exists. If the process associated with the lock id in the lock no longer 21* exists the lock is set to the lock id of the calling process. 22* 23* Originally coded by R. J. Feiertag on March 9, 1971 24* Modified by P. M. Haber on June 15,1971 25* Modified by R. J. Feiertag on November 3, 1971 to set a bad lock to caller lock id 26* Modified by S.Webber June, 1973 to change locking strategy to use stacq function */ 27 28 try_to_unlock_lock: proc (a_lock_ptr, a_code); 29 30 dcl a_lock_ptr ptr, /* pointer to lock that is to be unlocked */ 31 a_code fixed bin, /* returned status code */ 32 lock_ptr ptr, /* internal copy of lock pointer */ 33 entrysw fixed bin, /* indicates which entry has been invoked */ 34 lock bit (36) aligned based (lock_ptr), /* lock to be unlocked */ 35 test_lock bit (36) aligned, /* copy to make sure lock id is not changed while search is on */ 36 i fixed bin; /* misc. index */ 37 38 dcl (addr, addrel) builtin; 39 40 dcl tc_data$apt_entry_size ext fixed bin, /* length of an APT entry */ 41 tc_data$apt_size ext fixed bin, /* number of entries in APT */ 42 tc_data$apt ext, /* the APT */ 43 pds$process_id ext bit (36) aligned, /* this process's id */ 44 pds$apt_ptr ptr ext; /* points to process's APT entry */ 45 46 dcl stacq entry (ptr, bit (36) aligned, bit (36) aligned) returns (bit (1) aligned); 47 1 1 /* BEGIN INCLUDE FILE ... apte.incl.pl1 */ 1 2 1 3 /* Modified 1984-11-11 by E. Swenson for IPC event channel validation. */ 1 4 1 5 dcl aptep pointer; 1 6 1 7 dcl 1 apte based (aptep) aligned, /* APT entry declaration for an active (known) process */ 1 8 2 thread unaligned, /* List thread */ 1 9 3 fp bit (18), /* Forward pointer */ 1 10 3 bp bit (18), /* Backward pointer */ 1 11 2 flags unaligned, /* Flags and miscellaneous */ 1 12 3 mbz bit (1), /* This bit must be zero (sentinel bit) */ 1 13 3 wakeup_waiting bit (1), /* ON if process has received wakeup */ 1 14 3 stop_pending bit (1), /* ON if process has received stop connect */ 1 15 3 pre_empted bit (1), /* ON if process is being pre-empted by get_processor */ 1 16 3 hproc bit (1), /* ON if process is hardcore process */ 1 17 3 loaded bit (1), /* ON if required per-process pages are in memory and wired */ 1 18 3 eligible bit (1), /* ON if process is eligible */ 1 19 3 idle bit (1), /* ON if this is an idle process */ 1 20 3 interaction bit (1), /* ON if process has interacted recently */ 1 21 3 pre_empt_pending bit (1), /* ON if process has received pre-empt connect */ 1 22 3 default_procs_required bit (1), /* ON if apte.procs_required is system default */ 1 23 3 realtime_burst bit (1), /* ON if next eligibility is realtime */ 1 24 3 always_loaded bit (1), /* ON if process is not to be unloaded */ 1 25 3 dbr_loaded bit (1), /* ON if DBR is loaded on some CPU */ 1 26 3 being_loaded bit (1), /* ON if somebody loading this process */ 1 27 3 shared_stack_0 bit (1), /* ON if a shared stack_0 is assigned */ 1 28 3 page_wait_flag bit (1), /* flag ON if waiting for page */ 1 29 3 firstsw bit (1), /* OFF until process is intialized */ 1 30 3 state bit (18), /* execution state */ 1 31 2 page_faults fixed bin (35), /* total page faults for the process */ 1 32 2 processid bit (36), /* bit 0-17: offset of ATPE */ 1 33 /* bit 18-35: sequential number */ 1 34 2 te fixed bin (35), /* virtual time since eligibility award */ 1 35 2 ts fixed bin (35), /* virtual time since scheduling */ 1 36 2 ti fixed bin (35), /* virtual time since interaction */ 1 37 2 timax fixed bin (35), /* maximum value allowed for apte.ti */ 1 38 1 39 /* * * * * * * * */ 1 40 1 41 2 ipc_pointers unaligned, 1 42 3 event_thread bit (18), /* relative pointer to ITT list */ 1 43 3 pad3 bit (18), 1 44 2 ips_message bit (36), /* IPS signals pending */ 1 45 2 asteps unaligned, /* relative ASTE pointers */ 1 46 3 pds bit (18), /* PDS (per-process) */ 1 47 3 dseg bit (18), /* DSEG (per-process) */ 1 48 3 prds bit (18), /* PRDS (per-processor) */ 1 49 2 savex7 bit (18) unaligned, /* x7 at call to getwork (return point in pxss) */ 1 50 2 term_processid bit (36), /* process to send wakeup at temination */ 1 51 2 lock_id bit (36), /* File System unqieu ID associated with process */ 1 52 2 time_used_clock fixed bin (71), /* Total CPU time when process last lost CPU */ 1 53 1 54 /* * * * * * * * */ 1 55 1 56 2 wait_event bit (36) aligned, /* Event ID process awaiting */ 1 57 2 wct_index bit (18) unaligned, /* rel offset of WCTE */ 1 58 2 flags2 unaligned, 1 59 3 priority_scheduling bit (1), /* ON if guaranteed eligibility */ 1 60 3 special_wakeups bit (6), /* Special wakeup channels */ 1 61 3 pad7 bit (7), 1 62 3 batch bit (1), /* ON if absentee */ 1 63 3 pr_tag bit (3), /* CPU tag running or last run */ 1 64 2 state_change_time fixed bin (71), /* Time apte.state last changed */ 1 65 2 alarm_event fixed bin (71), /* wakeup event for alarm clock manager */ 1 66 2 alarm_time_thread bit (18) unaligned, /* thread of processes with pending alarms */ 1 67 2 alarm_time bit (54) unaligned, /* wakeup time for alarm */ 1 68 1 69 /* * * * * * */ 1 70 1 71 2 term_channel fixed bin (71), /* wakeup event for account overflow */ 1 72 2 ws_size fixed bin, /* working set estimate for the process */ 1 73 2 temax fixed bin (35), /* maximum eligibility slice (vcpu) */ 1 74 2 deadline fixed bin (71), /* time of next run */ 1 75 2 lock bit (18) unaligned, /* 0 => APTE locked, unlocked => return point of last unlock */ 1 76 2 unusable bit (18) unaligned, /* locking routines destroy */ 1 77 2 cpu_monitor fixed bin (35), /* if not 0, send wakeup to term_processid when virtual cpu 1 78* /* reaches this (units = 1/1024 sec) */ 1 79 2 paging_measure fixed bin (71), /* cumulative memory units */ 1 80 2 access_authorization bit (72), /* authorization of this process */ 1 81 2 dbr fixed bin (71), /* DBR value (constant since DSEG entry-held) */ 1 82 1 83 2 virtual_cpu_time fixed bin (71), /* cumulative virtual CPU time for the process */ 1 84 2 ittes_sent fixed bin (18), /* Unprocessed ITTs sent by this process */ 1 85 2 ittes_got fixed bin (18), /* Unprocessed ITTs received by this process */ 1 86 1 87 /* Cells used to drive and instrument finite-state model for response time 1 88* measurement. Maintained by meter_response_time */ 1 89 1 90 2 current_response_state fixed bin (17) unaligned, /* Process state in modle */ 1 91 2 pad18 bit (18) unaligned, 1 92 2 number_processing fixed bin (35), /* Number interactions */ 1 93 2 last_response_state_time fixed bin (71), /* Clock time at last response state change */ 1 94 2 total_processing_time fixed bin (71), /* Total interaction processing time */ 1 95 1 96 /* * * * * * */ 1 97 1 98 2 begin_interaction_vcpu fixed bin (71), /* Virtual cpu at beginning of last interaction */ 1 99 1 100 /* End of cells for finite-state model */ 1 101 1 102 2 saved_temax fixed bin (35), /* temax at eligibility award */ 1 103 2 procs_required bit (8) unaligned, /* bit mask of CPUs this process can run */ 1 104 2 pad4 bit (28) unaligned, 1 105 2 ipc_r_offset fixed bin (18) unsigned, 1 106 2 ipc_r_factor fixed bin (35) unsigned, 1 107 2 apad (10) fixed bin (35); 1 108 1 109 /* END INCLUDE FILE ... apte.incl.pl1 */ 48 49 /* */ 50 lock_ptr = a_lock_ptr; /* copy pointer to lock into ring 0 */ 51 entrysw = 0; /* this is unlocking entry */ 52 goto check; /* join common code */ 53 54 /* The following entry is called in order to verify that a lock is locked by an existing 55* process. No attempt is made to unlock the lock. The status codes returned are: 56* 57* 1 - the lock was validly locked 58* 2 - the lock was not locked 59* 3 - the lock was not validly locked 60* */ 61 62 check_lock: entry (a_lock_ptr, a_code); 63 64 lock_ptr = a_lock_ptr; /* copy the lock pointer into ring 0 */ 65 entrysw = 1; /* this is check only entry */ 66 67 check: /* common code */ 68 test_lock = lock; /* make copy of lock id */ 69 if test_lock = ""b then do; /* lock is not locked */ 70 a_code = 2; /* return proper status code */ 71 return; /* we are done */ 72 end; 73 aptep = addr (tc_data$apt); /* get pointer to first APT entry */ 74 do i = 1 to tc_data$apt_size; /* look at all APT entries */ 75 if (aptep -> apte.lock_id = test_lock) & /* we have found entry for this process, lock is valid */ 76 (bin(aptep ->apte.flags.state,18) ^= 5) 77 then do; 78 a_code = 1; /* return proper code */ 79 return; /* we are done */ 80 end; 81 aptep = addrel (aptep, tc_data$apt_entry_size); /* goto next APT entry */ 82 end; 83 if ^stacq (lock_ptr, test_lock, pds$apt_ptr -> apte.lock_id) then do; 84 a_code = 1; /* if not the same as test_lock then lock is valid */ 85 return; 86 end; 87 a_code = 3; /* lock didn't change and is still bad ... the stacq set it to caller */ 88 return; 89 90 end try_to_unlock_lock; SOURCE FILES USED IN THIS COMPILATION. LINE NUMBER DATE MODIFIED NAME PATHNAME 0 11/11/89 0826.9 try_to_unlock_lock.pl1 >spec>install>1112>try_to_unlock_lock.pl1 48 1 01/06/85 1422.2 apte.incl.pl1 >ldd>include>apte.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 30 set ref 28 62 70* 78* 84* 87* a_lock_ptr parameter pointer dcl 30 ref 28 50 62 64 addr builtin function dcl 38 ref 73 addrel builtin function dcl 38 ref 81 apte based structure level 1 dcl 1-7 aptep 000106 automatic pointer dcl 1-5 set ref 73* 75 75 81* 81 entrysw 000102 automatic fixed bin(17,0) dcl 30 set ref 51* 65* flags 1 based structure level 2 packed packed unaligned dcl 1-7 i 000104 automatic fixed bin(17,0) dcl 30 set ref 74* lock based bit(36) dcl 30 ref 67 lock_id 15 based bit(36) level 2 dcl 1-7 set ref 75 83* lock_ptr 000100 automatic pointer dcl 30 set ref 50* 64* 67 83* pds$apt_ptr 000016 external static pointer dcl 40 ref 83 stacq 000020 constant entry external dcl 46 ref 83 state 1(18) based bit(18) level 3 packed packed unaligned dcl 1-7 ref 75 tc_data$apt 000014 external static fixed bin(17,0) dcl 40 set ref 73 tc_data$apt_entry_size 000010 external static fixed bin(17,0) dcl 40 ref 81 tc_data$apt_size 000012 external static fixed bin(17,0) dcl 40 ref 74 test_lock 000103 automatic bit(36) dcl 30 set ref 67* 69 75 83* NAME DECLARED BY DECLARE STATEMENT AND NEVER REFERENCED. pds$process_id external static bit(36) dcl 40 NAMES DECLARED BY EXPLICIT CONTEXT. check 000037 constant label dcl 67 ref 52 check_lock 000024 constant entry external dcl 62 try_to_unlock_lock 000007 constant entry external dcl 28 NAME DECLARED BY CONTEXT OR IMPLICATION. bin builtin function ref 75 STORAGE REQUIREMENTS FOR THIS PROGRAM. Object Text Link Symbol Defs Static Start 0 0 226 250 133 236 Length 440 133 22 154 72 0 BLOCK NAME STACK SIZE TYPE WHY NONQUICK/WHO SHARES STACK FRAME try_to_unlock_lock 84 external procedure is an external procedure. STORAGE FOR AUTOMATIC VARIABLES. STACK FRAME LOC IDENTIFIER BLOCK NAME try_to_unlock_lock 000100 lock_ptr try_to_unlock_lock 000102 entrysw try_to_unlock_lock 000103 test_lock try_to_unlock_lock 000104 i try_to_unlock_lock 000106 aptep try_to_unlock_lock THE FOLLOWING EXTERNAL OPERATORS ARE USED BY THIS PROGRAM. call_ext_out return_mac ext_entry THE FOLLOWING EXTERNAL ENTRIES ARE CALLED BY THIS PROGRAM. stacq THE FOLLOWING EXTERNAL VARIABLES ARE USED BY THIS PROGRAM. pds$apt_ptr tc_data$apt tc_data$apt_entry_size tc_data$apt_size LINE LOC LINE LOC LINE LOC LINE LOC LINE LOC LINE LOC LINE LOC 28 000003 50 000014 51 000020 52 000021 62 000022 64 000031 65 000035 67 000037 69 000041 70 000042 71 000044 73 000045 74 000050 75 000057 78 000067 79 000072 81 000073 82 000077 83 000101 84 000123 85 000126 87 000127 88 000132 ----------------------------------------------------------- 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