;++ ; This little hack forces the target process to set itself in NO RESOURCE WAIT MODE. ; ; Author : Alain PANNETIER TIBET - PARIS - (1) 40 41 70 34. ;-- .TITLE FORCE_NO_RESOURCE_WAIT_MODE .LIBRARY 'SYS$SHARE:LIB.MLB' .LINK 'SYS$SYSTEM:SYS.STB' /SELECTIVE_SEARCH .DISABLE GLOBAL ; Treat mispelling errors at assembly time $DSCDEF ; Descriptors structures and constants $IPLDEF ; Interrupt priority levels $PCBDEF ; Process Control Block $SSDEF ; System services condition values ;+ ; LOCAL STORAGE ;- .PSECT DATA, WRT, NOEXE, LONG ; Pid_str : .WORD 0 ; Empty Dynamic string descriptor .BYTE DSC$K_DTYPE_T ; .BYTE DSC$K_CLASS_D ; .LONG 0 ; Pid: .BLKL 1 ; External pid Prompt: .ASCID 'Target Process PID : ' ; Prompt .EXTERNAL EXE$epid_to_pcb ; Gets the PCB address from an extended pid .EXTERNAL LIB$get_foreign ; Get/prompt for argument .EXTERNAL OTS$cvt_tz_l ; Converts hexadecimal text to binary ;+ ; MAIN PROGRAM ;- .PSECT CODE,WRT,EXE,LONG .ENTRY FORCE_NO_RESOURCE_WAIT_MODE ,^m<> PUSHAQ Prompt ; PUSHAQ Pid_str ; CALLS # 2, G^lIB$get_foreign ; Get the pid if not specified on command line BLBC R0,1$ PUSHAL Pid ; Convert to binary ( assumes hexa input ) PUSHAQ Pid_str ; CALLS #2,G^OTS$cvt_tz_l ; BLBC R0,1$ $CMKRNL_S routin = Set_norswm ; Kick into kernel mode 1$: $EXIT_S R0 ; Let DCL signal returned status ;+ ; KERNEL MODE MAIN TREATMENT ;- .ENTRY SET_NORSWM,^M ; Save all GPRs ;+ ; This routine is executed in Kernel mode ; It addresses the status field of the target processe's PCB ;- LOCK lockname = SCHED, - ; This macro from LIB.MLB lockipl = #IPL$_SYNCH, - ; Lock sheduler database savipl = R2 ; Remember current IPL MOVL Pid, R0 ; input of EXE$epid_to_pcb in R0, output in R0 as well JSB G^EXE$epid_to_pcb ; Get corresponding PCB address TSTL R0 ; If the PCB address returned is null, assume process disapeared BNEQ 1$ ; Else continue. UNLOCK lockname = SCHED, - ; Unlock and newipl = R2 ; restore original IPL before returning MOVL #SS$_NONEXPR, R0 ; with appropriate status. RET 1$: BBSSI #PCB$V_SSRWAIT, PCB$L_STS(R0), 2$ ; Set the no resource wait mode bit in target PCB's status 2$: UNLOCK lockname = SCHED, - ; Unlock and newipl = R2 ; restore original IPL before returning MOVL #SS$_NORMAL, R0 ; with success status. RET ; .END FORCE_NO_RESOURCE_WAIT_MODE