;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; This routine sets the termination mailbox unit number of the current ; process to a given unit number by writing it to the PCB$x_TMBU field ; of our Process Control Block. Then whenever the process terminates a ; VMS accounting record will automatically be written to this mailbox. ; ; Any process must have write-access to its accounting mailbox device! ; ; Calling sequence: ; Argument 1 - 4(AP) - unit number of a MBA device passed by value ; ; Environment: This is a kernel-mode subroutine so a program must be ; INSTALLed with CMKRNL privilege for use by any non-privileged user. ; No special synchronization is needed below; if the process is being ; deleted at the same time this code is executing nothing can happen. ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; .DISABLE GLOBAL ;So we get assembler error on typos (IMPLICIT NONE) .LIBRARY "SYS$LIBRARY:LIB.MLB" $PCBDEF ;Define Process Control Block offsets .PSECT $CODE PIC,SHR,NOWRT,LONG .ENTRY SET_TMBU_KRNL, ^M<> ;CMKRNL loads R4 with our PCB address .IF DEFINED PCB$L_TMBU ;TMBU field offset on Alpha or IA64. TSTL PCB$L_TMBU(R4) ;Was termination mailbox unit # set? BNEQ RETURN ;If already set then leave it alone! MOVL 4(AP), PCB$L_TMBU(R4) ;Set the termination mailbox unit #. .ENDC .IF DEFINED PCB$W_TMBU ;TMBU field only 16-bit wide on VAX. TSTW PCB$W_TMBU(R4) ;Was termination mailbox unit # set? BNEQ RETURN ;If already set then leave it alone! MOVW 4(AP), PCB$W_TMBU(R4) ;Set the termination mailbox unit #. .ENDC RETURN: MOVL #1, R0 ;We always succeed (in a sense) RET .END