Article 155300 of comp.os.vms:
snadow@eisner.decus.org (Scott Snadow -GTE Directories- 972-453-7727) writes:

>Has anyone put together some code (that they're willing to share) to
>implement flipping the "NODELETE" bit in an arbitrary process control
>block on the system?  As an example, the AUDIT_SERVER process has
>NODELETE set, so that an attempt to do a $ STOP/ID on it fails with
>the message "%SYSTEM-F-NODELETE, object cannot be deleted".

hey, vaxman, i'm posting MACRO32 code . . . don't let ehud know . . .

	.title	NODELHACK
	.ident	"V1.0"

	; purpose:
	;     tests a process's NODELETE bit, or sets it, or clears it
	;
	; usage:
	;    $ mcr sys$disk:[]nodelhack pid
	;    sets $STATUS to 1 if the process can be deleted or 9 if it cannot
	;    $ mcr sys$disk:[]nodelhack +pid
	;    sets the process's NODELETE bit, sets $STATUS to 1
	;    $ mcr sys$disk:[]nodelhack -pid
	;    clears the process's NODELETE bit, sets $STATUS to 1
	;    any errors, such as nonexistant process, are returned in $STATUS
	;
	; build:
	;    $ macro nodelhack
	;    $ link nodelhack [/SYSEXE under alpha]

	.library	"sys$library:lib.mlb"
	.link		"sys$system:sys.stb"

	$ssdef
	$pcbdef

	.NTYPE	...ON_ALPHA...,R31
	.IIF EQ,<...ON_ALPHA...@-4&^XF>-5, __ALPHA=1

	.psect	$DATA	pic,usr,con,rel,lcl,noshr,noexe,rd,wrt,novec

thepid:	.blkl 1
pidlen:	.blkw 1
vset:	.blkb 1
vclear:	.blkb 1
buffer:	.blkb 16
pidstr:	.long 16
	.address buffer

	.psect	$CODE	pic,usr,con,rel,lcl,shr,exe,rd,nowrt,novec

	.entry	MAIN, ^M<>
	clrb	vset
	clrb	vclear
	pushl	#0
	pushaw	pidlen
	pushl	#0
	pushaq	pidstr
	calls	#4, G^LIB$GET_FOREIGN
	blbs	r0, PARSE
	ret
PARSE:
	cmpb	#^A/+/, buffer
	bneq	P1
	movb	#1, vset
	movb	#^A/ /, buffer
	brb	P2
P1:
	cmpb	#^A/-/, buffer
	bneq	P2
	movb	#1, vclear
	movb	#^A/ /, buffer
P2:
	movw	pidlen, pidstr
	pushal	thepid
	pushaq	pidstr
	calls	#2, G^OTS$CVT_TZ_L
	blbs	r0, HACK
	ret
HACK:
	$CMKRNL_S	routin=DOIT
	ret

	.entry DOIT, ^M<>
	movl	thepid, r0
	.if defined __ALPHA
	jsb	g^exe$cvt_epid_to_pcb
	.if_false
	jsb	g^exe$epid_to_pcb
	.endc
	tstl	r0
	beql	NOSUCH
	movl	r0, r1
	tstb	vset
	beql	$10
	bisl2	#PCB$M_NODELET, PCB$L_STS(R1)
	movl	#SS$_NORMAL, r0
	ret
$10:
	tstb	vclear
	beql	$20
	bicl2	#PCB$M_NODELET, PCB$L_STS(R1)
	movl	#SS$_NORMAL, r0
	ret
$20:
	movl	#SS$_WASCLR, r0
	bbc	#PCB$V_NODELET, PCB$L_STS(R1), NOTSET
	movl	#SS$_WASSET, r0
NOTSET:
	ret
NOSUCH:
	movl	#SS$_NONEXPR, r0
	ret

	.end	MAIN

ok
dpm
-- 
David P. Murphy             mailto:murphy@connor.datametrics.com     (work)
systems programmer          mailto:dpm@access.digex.net          (personal)
                            http://www.access.digex.net/~dpm
COGITO ERGO DISCLAIMUM       ftp://ftp.access.digex.net/pub/access/dpm


