.title TSX+ Job Monitoring ; DECUS C Calling Format ; ; jsr r5,csv$ ;save r2,r3, and r4 ; ;r5 is parameter base ; ;c$pmtr(r5) is first argument ; ;c$pmtr+2(r5) is second argument ; ;... ; ;return args in r0 ; ... ; user code ; ... ; ; jmp cret$ ;restore r2-r5 and return ; ; csv$ and cret$ need be used only if arguments are used ; .mcall .rsum .sbttl JOBMON and JBABRT routines ; JOBMON initializes the monitoring process ; ; JABORT returns the job number of any ; TSX+ job which terminates. ; ; jobmon(jobnum, level); /* jobnum = 0, all jobs */ ; ; jabort(); ; .psect c$code jobmon:: mov 2(sp),jbmnum ;set job to monitor mov 4(sp),abtlvl ;abort level mov #jbmemt,r0 ;enable job monitoring emt 375 rts pc jbabrt:: clr r0 cmp about,abin ;any terminations beq 1$ ;no - exit mov about,r1 bisb ablist(r1),r0 ;get terminating job inc r1 bic #^c<37>,r1 mov r1,about 1$: rts pc ;return aborting job killjob:: mov 2(sp),kljbnm ;job number to kill mov #kljemt,r0 emt 375 rts pc .psect c$data jbmemt: .byte 0,157 ;job monitor argument block jbmnum: .word 0 ;job to monitor .word jbcomp ;completion routine kljemt: .byte 2,132 ;kill a job kljbnm: .word 0 ;job number to kill .page .sbttl Job Monitoring Completion routine ; completion routine is entered with: ; ; r0 - low byte is job number ; high bit of word is set if ; the status came from a job or ; clear if the status came from ; the system ; ; r1 - contains the status code ; 1 - job has been initiated ; 2 - job has logged in using the LOGON program ; 3 - job has started running a job ; 4 - job has return control to the keyboard monitor ; 5 - job has logged off ; ; ; Terminations are checked for uniquenes ; .psect c$code jbcomp: cmp abtlvl,r1 ;check status level bhi 3$ ;not high enough mov about,r1 ;next abort to be read br 2$ 1$: cmpb r0,ablist(r1) ;match ? beq 3$ ;yes - exit inc r1 bic #^c<37>,r1 2$: cmp r1,abin ;end of list ? bne 1$ ;no - loop movb r0,ablist(r1) ;place job number in list inc r1 ;update pointer bic #^c<37>,r1 cmp r1,about ;room ? beq 3$ ;no - skip update mov r1,abin 3$: rts pc .sbttl Termination List .psect c$data abtlvl: .word 0 ;abort code level abin: .word 0 ;input pointer about: .word 0 ;readout pointer ablist: .blkb 32. ;list of aborts .end