$ $ type mnowait.mar ;************************************************************************** ; ; Program: MNOWAIT - Kills some MWAITing processes ; Author: Bruce Ellis ; The VASTEK Company, Incorporated ; Date Written: Sometime in 1982. ; Notes: ; Accepts a PID and kills the target process after setting ; the SSRWAIT bit and clearing the delete pending bit ; in the status longword of the PCB. ; Will not kill all flavors of MWAITing procsses. ; Could (though we have not seen it) crash the system. ; ; Required privileges: CMKRNL and WORLD ;************************************************************************** ;* include files. .library /sys$library:lib.mlb/ .link /sys$system:sys.stb/ ;* Macro to check status of system service calls. .macro check ?l blbs r0,l $exit_s r0 l: .endm check ;* Include process control block definitions. $pcbdef ;* Constants PID_SIZE = 8 .psect data wrt,noexe,shr ;************************************************************************** ; Start of data area. ;************************************************************************** lock_start: ;Lock down all of program out simplicity ; It is only necessary to lock down code ; and data acessed at ipl >2 ;* Prompt string prompt_for_pid: .ascid /Please enter PID: / ;* String descriptor to hold ascii representation of process id pid_desc: .long PID_SIZE .address 10$ 10$: .blkb PID_SIZE ;* storage for binary representation of pid. pid: .long 0 ;************************************* ;* Argument list for the SYS$CMKRNL call ;* Note: This order is important for the ;* exe$nampid call performed in the kernel mode routine. ;************************************* kargs: .long 1 .address pid .long 0 ;* Argument list for the SYS$LKWSET call. lock_addr: .address lock_start .address lock_end ;*************************************************** ;* Start of code area. ;*************************************************** .psect code exe,nowrt,shr .entry mnowait,^m<> ;************************************************* ;* Prompt for and read the pid ;************************************************* pushal pid_desc pushal prompt_for_pid pushal pid_desc calls #3,g^lib$get_input check ;************************************************* ;* Convert the pid to binary ;************************************************* pushal pid pushal pid_desc calls #2,g^ots$cvt_tz_l check ;************************************************* ;* Lock down code accessed at high ipl ;************************************************* $lkwset_s inadr=lock_addr check ;************************************************* ;* Get into kernel mode and blast the bits ;************************************************* $cmkrnl_s routin=blast_bits,arglst=kargs check ;************************************************* ;* Now blow away the target process. ;************************************************* $delprc_s pidadr=pid ret ;********************************************************* ;* ;* Start of kernel mode subroutine, blast_bits ;* Inputs: 4(ap) contains a pid address ;* 8(ap) contains a process name descriptor address or 0 ;* ;* Outputs: ;* SSRWAIT bit of target process is set ;* DELPEN bit is cleared ;* ;********************************************************* .entry blast_bits,^m jsb g^exe$nampid blbc r0,outta_here ;Locate the PCB address of ; the target process. bisl #pcb$m_ssrwait,pcb$l_sts(r4) ;Set the no resource wait bit. bicl #pcb$m_delpen,pcb$l_sts(r4) ;Clear the delete pending bit unlock lockname=SCHED,newipl=#0 ;Release the spinlock acquired ; by exe$nampid movl #ss$_normal,r0 outta_here: ret lock_end: .end mnowait $ $ macro force_tmo $ link force_tmo $ $ $ type force_tmo.mar ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ; Program: FORCE_TMO ; Author: Billy Bitsenbites (Bruce Ellis) ; Synopsis: Changes the expected time out interval ; of a device to 15 seconds from now. ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ;* Include files .library /sys$library:lib.mlb/ .link /sys$system:sys.stb/ ;* Constants $ucbdef ;* Unit control block offsets $ipldef DEVNAME_MAX = 15 TIME_TIL_TMO = 15 .psect data noshr,noexe,wrt ;* Storage for the device name descriptor devnam: .long DEVNAME_MAX .address 10$ 10$: .blkb DEVNAME_MAX ;* Prompt for device name dev_prompt: .ascid /Enter device to be timed out:/ .psect code nowrt,exe,shr .entry force_tmo,^m<> ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ; Get device name to unload monitor for ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pushal devnam pushal dev_prompt pushal devnam calls #3,g^lib$get_input blbs r0,lab $exit_s r0 ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ; Change the time out interval of the device. ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lab: $cmkrnl_s routin=kernel_setup ret ;*********************************************************************** ; Kernel mode setup code to search I/O data base ; and update the time out interval of the selected device. ;*********************************************************************** .entry kernel_setup,^m ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ; Grab a write mutex on the i/o database ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ moval g^ioc$gl_mutex,r0 jsb g^sch$lockw ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ; Search for ucb address of this device ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ moval devnam,r1 jsb g^ioc$searchdev blbs r0,no_dev_error ;If error scram pushl r0 brb dev_error no_dev_error: LOCK lockname=TIMER addl3 #TIME_TIL_TMO,g^exe$gl_abstim,ucb$l_duetim(r1) ;get the the current up time and ; add 15 seconds to it and store it in ; the time out value of the UCB UNLOCK lockname=TIMER,newipl=#ipl$_astdel pushl #ss$_normal ;Note success dev_error: moval g^ioc$gl_mutex,r0 ;Free up the mutex on the io database movl g^ctl$gl_pcb,r4 jsb g^sch$unlock popl r0 ret .end force_tmo $ $ show dev mu Device Device Error Volume Free Trans Mnt Name Status Count Label Blocks Count Cnt LABDOG$MUA0: Online 0 LABDOG$MUA255: Online 0 $ set process/privileges=CMKRNL $ $ ! NOTE: You should confirm that a process is waiting for a timeout $ ! on the appropriate device before running this program. $ run force_tmo Enter device to be timed out:MUA0: $ $