From:	SMTP%"MACRO32@WKUVX1.BITNET"  3-MAY-1993 17:48:33.42
To:	EVERHART
CC:	
Subj:	Removing RWASTed processes from SHOW SYSTEM

X-ListName: "VMS Internals, MACRO, & BLISS Discussions" <MACRO32@WKUVX1.BITNET>
Warnings-To: <>
Errors-To: MacroMan@WKUVX1.BITNET
Sender: MacroMan@WKUVX1.BITNET
Date: Mon, 03 May 1993 13:49:05 -0700 (MST)
From: Ehud Gavron <GAVRON@ACES.COM>
Reply-To: MACRO32@WKUVX1.BITNET
Subject: Removing RWASTed processes from SHOW SYSTEM
Resent-To: macro32 <macro32@WKUVX1.BITNET>
To: macro32@ACES.COM
CC: info-vax@kl.sri.com, Ehud Gavron <GAVRON@ACES.COM>
Resent-Message-ID: <01GXQOMIE4MQ0001CN@ACES.COM>
Message-ID: <01GXQOLCBQW40000PL@ACES.COM>
Organization: ACES Research Inc.
X-VMS-To: IN%"macro32@ACES.COM"
X-VMS-Cc: IN%"info-vax@kl.sri.com", IN%"GAVRON@ACES.COM"  "Ehud Gavron"
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
Content-Transfer-Encoding: 7BIT


Date Sent:  3-MAY-1993 13:49:11

Some guy on Info-vax wrote "Help! My system now has two processes
stuck in the dreaded RWAST!"

Well, I have no idea why any set of bits is any more dreaded than
any other, but if it's that big a deal...

Extract DELRWAST.MAR
$ MAC DELRWAST
$ LINK DELRWAST
$ RUN DELRWAST
Pid: 2400003B   (or whatever)
$

Ehud

--
Ehud Gavron     (EG76)
gavron@Spades.ACES.COM

For information on ACES SLIP and Dialup services in Tucson, send mail to
info@aces.com.

        .TITLE  DELRWAST -      Delete RWASTed Processes
        .IDENT  /001-1/

;++
;
; DELRWAST.MAR          03-May-1993             Ehud Gavron
; So some process out there is in RWAST state and it makes SHOW SYSTEM look ugly
; because not all the states are three letters long.  Well, if you're sure that
; pending event will never complete, use this program to remove the process from
; the SHOW SYSTEM display.  Be vewy vewy caweful.  We'we huntin' wabbits.
;
; NOTE: all risk is yours
; NOTE: this is shareware.  If you use it and it works, and it gets a boss,
;       manager, colleague, or user off your back send me a beer or money to
;       buy one.  Sierra Nevada Pale Ale, Porter, Anchor Steam, Anchor Porter,
;       Samuel Adams Ale, and Telluride Pale Ale all will work nicely.
;
;       Ehud Gavron             gavron@Spades.ACES.COM
;                               PO Box 14546, Tucson AZ, 85711 USA
;
;--
; V1.0.0        Created because I'm not getting enough interesting
;               kernel-coding to do in my regular job.
;
; Definitions
;
        .library        "sys$Library:lib.mlb"                   ; find $xxxdefs
        .link           "sys$system:sys.stb"/selective_search   ; find xxx$x_xs

        $ssdef          ; System Service status values (for normal status)
;
; Macros
;
        .macro  check ?l1
        blbs    r0,l1
        ret
l1:
        .endm   check

;
; Variables
;
epid_ad:        .ascid  "00000000"      ; Process ID as an ASCII descriptor
epid:           .blkl   1               ; Process ID as a longword
ipid:           .blkl   1               ; Internal Process ID
prompt:         .ascid "PID: "          ; Prompt for unentered data

;
; Start of user-mode code
;
        .entry  delrwast,^m<>
;
; Get the process ID from the command line
;
        pushl   #0                      ; flags
        pushal  epid_ad                 ; resultant-length
        pushal  prompt                  ; prompt-string
        pushal  epid_ad                 ; resultant-string
        calls   #4,g^lib$get_foreign
        check
;
; Convert from an ASCII hexadecimal string to a binary longword
;
        pushal  epid                    ; output-value
        pushal  epid_ad                 ; input-string
        calls   #2,g^ots$cvt_tz_l
        check
;
; Go to kernel-mode to do it all
;
        $cmkrnl_s       routin = delrwast_k
;
; Exit gracefully
;
        ret

;
; The kernel-mode code
;
        .entry  delrwast_k,^m<>
;
; Acquire scheduling spinlock
;
        lock    lockname = SCHED
;
; Get the address of the PCB pointer in the vector table and replace it with tha
t
; of the null process, thereby freeing the slot
;
        movl    epid,r0
        jsb     g^exe$epid_to_ipid
        bneq    10$
        movl    #ss$_nonexpr,r0
        ret
10$:
        movl    r0,ipid                 ; save IPID
        movzwl  r0,r1                   ; extract PIX
        movl    g^sch$ar_nullpcb,@sch$gl_pcbvec[r1]
;
; Exit gracefully
;
        unlock  lockname = SCHED, -
                newipl   = #0
        movl    #ss$_normal,r0
        ret
        .end    delrwast

