.title CLRNODELETE ; Clear PCB process-nodelete bit .ident 'V05-000' ; VMS V5 release number .link /sys$system:sys.stb/ ; Link against system symbol table .library /sys$library:lib.mlb/ ; Use LIB macro library $pcbdef ; process control block offsets $ipldef ; IPL values $prvdef ; privilege masks definitions $ssdef ; system service stati values target_pid: .long ; PID of target process .entry clrnodelete,^m<> ; clrnodelete code -- uses no registers bbs #prv$v_cmkrnl,ctl$gq_procpriv,10$ ; if priv sufficient, branch movl #ss$_nocmkrnl,r0 ; return a nopriv error ret 10$: movl 4(ap),target_pid ; copy PID to local variable $cmkrnl_s routin=clearit ; call kernel mode to do it ret ; end of main code .entry clearit,^m ; start of kernel-mode code tstl target_pid ; check out the target PID bnequ 10$ ; not defaulted to current movl ctl$gl_pcb,r8 ; get current PCB bicl #pcb$m_nodelet,pcb$l_sts(r8) ; clear nodelete bit brb 50$ ; return success 10$: lock lockname=sched ; pause scheduling ; Find the target process if it exists movl target_pid,r6 ; use PID to search for movzwl sch$gl_maxpix,r7 ; start index search 20$: movl @sch$gl_pcbvec[r7],r8 ; fetch a PCB address cmpl pcb$l_epid(r8),r6 ; is this the correct PCB? beqlu 40$ ; if so, go clear it 30$: sobgtr r7,20$ ; continue search unlock lockname=sched ; restart scheduling movl #ss$_nonexpr,r0 ; process was not found ret ; and return 40$: bicl #pcb$m_nodelet,pcb$l_sts(r8) ; clear nodelete bit unlock lockname=sched ; restart scheduling 50$: movl #ss$_normal,r0 ; normal success ret ; return .end