1
0
mirror of https://github.com/PDP-10/its.git synced 2026-01-29 21:30:57 +00:00

VV - list jobs. VJ and DETREE links to VV.

This commit is contained in:
Lars Brinkhoff
2017-01-30 21:35:26 +01:00
parent 964bc3fe22
commit 22204bea67
3 changed files with 340 additions and 0 deletions

334
src/sysen2/vv.132 Executable file
View File

@@ -0,0 +1,334 @@
TITLE $$V Job Lister ;-*-MIDAS-*-
;;;THIS WILL RUN ONLY UNDER A HACTRN!!!!
a=1 ? b=2 ? c=3 ? i=4 ? u=5 ? t=6 ? tt=7 ? r=10 ? out=11 ? llin=12 ? p=17
ttyo==1 ? usri==2
call=pushj p,
ret=popj p,
jcall==jrst
save=push p,
rest=pop p,
define syscal op,args
.call [setz ? sixbit /op/ ? args ((setz))]
termin
go: .open ttyo,[1,,'TTY]
.lose %lsfil
move p,pdl
.rdtime a, ;how long the system has been up, in 30ths
movem a,time
call getun ;get uname from jcl or else our own
call itssym ;get ITS symbol values
call mapsys ;map in system pages
call findem ;find jobs to print
.break 16,124000 ;really silent kill
jrst go ;for debugging
findem: setzm nprint ;We have found no jobs yet
movei a,-1 ;first look for null superiors (i.e. top level)
setzm lev
call find
skipe nprint
ret
move out,[440700,,[asciz |No jobs.|]]
movei llin,8.
.call [setz ? sixbit |SIOT| ? 1000,,ttyo ? out ? setz llin]
jfcl
ret
find: push p,u ;find a job whose superior's index is in A
push p,i ;scan all job slots
setz u,
movn i,maxj
flp: skipn t,@uname ;get uname for this job, if nonzero
jrst flpnxt
skipe detp ;non-0 if we're looking for detachees
jrst flpdet
skipn un
jrst [move t,@jname
camn t,uj
jrst flp1
move t,@xjname
came t,uj
jrst flpnxt
jrst flp1]
camn t,un
jrst flp1
move t,@xuname
came t,un
jrst flpnxt
jrst flp1
flpdet: skipl @aprc ;skip if detached
jrst flpnxt ;nope, look for next
caie a,-1 ;skip if we are looking for toplevel guys
jrst flp1 ;claim we found a candidate if not
move t,u ;find his user index
idiv t,L
call hactrp ;is it a HACTRN? skip and fall thru if so
jrst flpnxt
flp1: hrrz t,@suppro ;get his superior pointer
caie t,-1 ;if not top level,
idiv t,L ;convert to index
skipn un
jrst [call inftyp
jrst flpnxt]
caie t,(a) ;is it what we want?
jrst flpnxt
call inftyp ;type this guy
aos lev ;note next level
call inf ;and get his inferiors
sos lev
flpnxt: add u,l ;index pointer to next job slot
aojl i,flp ;and if not done, go do next slot
pop p,i ;else unrecurse and return
pop p,u
ret
inf: push p,a ;save present superior index
move t,u ;convert this guy's pointer into index
idiv t,l
move a,t ;and look for his inferiors
call find
pop p,a
cret: ret
inftyp: call inilin ;initialize line and state
call tunam ;print uname
call indent ;print indentation for this level
call tjnam ;print jname
call tindx ;print user index
call tsnam ;print sname of job
call ttty ;print tty number if this job has tty
call tdet ;print if detached, and how long
call typlin ;print out the line
ret
inilin: move out,[440700,,line]
setz llin,
aos nprint
ret
tyostr: ildb tt,t
jumpe tt,cret
call tyoch
jrst tyostr
tyoch: idpb tt,out
aos llin
ret
typlin: movei tt,^M ? call tyoch
movei tt,^J ? call tyoch
move out,[440700,,line]
.call [setz ? sixbit \SIOT\ ? 1000,,ttyo ? out ? setz llin]
.lose 1000
ret
indent: move t,lev
addi t,(t)
addi t,7
jcall tabcol
tunam: move t,@uname
jcall 6typ
tjnam: move t,@jname
jcall 6typ
tindx: movei t,19. ? call tabcol
move t,u ;get pointer of this job
idiv t,L ;convert to index
jcall octyp ;type it out
tsnam: movei t,24. ? call tabcol
move t,@usysnm ;get sname of this job
call 6typ
movei tt,";
jcall tyoch
ttty: move t,@ttytbl
jumpl t,cret
push p,t
movei t,33. ? call tabcol
movei tt,"T ? call tyoch
pop p,t
jcall octyp2
tdet: skipl @aprc ;skip if he's detached
ret
movei t,33. ? call tabcol ;if detached, can't have tty
move t,[440700,,[asciz |Det +|]]
call tyostr
move t,time ;how long sys has been up
sub t,@lubtm ;less when he last ran (in 30ths)
idivi t,30. ;seconds
setzm tflg ;we haven't typed any time yet
idivi t,60. ;minutes in t, seconds in tt
save tt
idivi t,60. ;hours in t, minutes in tt
save tt
jumpe t,tdet1
call dectyp ;type hours in decimal
movei tt,":
call tyoch
setom tflg
tdet1: pop p,t ;minutes in t
skipn tflg
jumpe t,tdet2
call dectyp ;type minutes in decimal
movei tt,":
call tyoch
setom tflg
tdet2: pop p,t
jcall dectyp
tabcol: jumpe t,cret
movei tt,40
tabclp: call tyoch
caige llin,(t)
jrst tabclp
ret
6typ: move c,t
6ty1: setz b,
lshc b,6
movei tt,40(b)
call tyoch
jumpn c,6ty1
ret
octyp2: ldb tt,[030300,,t]
addi tt,"0
call tyoch
ldb tt,[000300,,t]
addi tt,"0
jcall tyoch
octyp: idivi t,10
hrlm tt,(p)
skipe t
call octyp
hlrz tt,(p)
addi tt,"0
jcall tyoch
ret
dectyp: idivi t,10. ;type 2 digits of decimal in T
addi tt,"0
skipn tflg
jumpe t,decty1
save tt
movei tt,"0(t)
call tyoch
rest tt
decty1: jcall tyoch
getun: .suset [-3,,[.rxuname,,un ? .rxjname,,a ? .ruind,,uind]]
camn a,[sixbit |DETREE|] ;are we a DETREE?
jrst getdet ;yup
camn a,[sixbit |VJ|]
skipa i,[440600,,uj]
move i,[440600,,un]
.break 12,[..rjcl,,jcl] ;grab jcl
skipn jcl
ret
move c,[440700,,jcl]
setzm un
movei b,6
unlp: ildb a,c
caie a,^c
cain a,^M
ret
cain a,40
jrst unlp
caig a,40
.value [asciz \: Use SIXBIT chars! KILL \]
caile a,137
subi a,40
subi a,40
idpb a,i
sojg b,unlp
ret
getdet: .call [setz ? sixbit |OPEN| ? [.uii,,usri] ;open our HACTRN
[sixbit |USR|] ? un ? setz [sixbit |HACTRN|]]
.lose %lsfil
.call [setz ? 'CORBLK ? 1000,,<%cbred+%cbndr> ;get readonly pages
1000,,%jself ? 1000,,2 ;our page 2
1000,,usri ? setzi 25.] ;HACTRN's page 25
.lose %lssys
.uclose usri,
setom detp
ret
hactrp: ;skip if the job with uind in T is a HACTRN
move tt,uind ;TT will hold our idx
movei b,2 ;and B the page#, maped to hactrn
hactlp: iori tt,400000 ;make a <job>
syscal cortyp,[tt ? b
repeat 2,%clout,,tt
%clout,,b]
.lose %lssys
jumpe tt,cpopj ;absolute page?? oops.
camn tt,[-1] ;unshared page?
ret ; yeah, oops.
camn tt,uind ;skip unless we found ourself again
ret ;nonskip return if so
came tt,t ;skip if we found who we're looking for
jrst hactlp ;else try again
popj1: aos (p) ;skip return
cpopj: ret
itssym: move b,[-nsyms,,uname]
itslp: move a,(b)
.eval a,
.lose
movem a,(b)
aobjn b,itslp
movsi a,u
irps x,y,[uname+jname+xuname+xjname+usysnm+suppro+maxj-usrstg-l-ttytbl+lubtm+aprc+]
ifse y,+, iorm a,x
termin
ret
irps x,y,[uname+jname+xuname+xjname+usysnm+suppro+maxj-usrstg-l-ttytbl+lubtm+aprc+]
x: squoze 0,x
termin
nsyms==.-uname
mapsys: move a,maxj
imul a,l
add a,usrstg
addi a,1777
lsh a,-12
move b,usrstg
lsh b,-12
sub a,b
movns a
hrlzs a
hrr a,b
.call [ setz ? 'CORBLK ? 1000,,<%CBRED+%CBNDR> ? 1000,,-1
a ? setzi 400000]
.lose %lssys
ret
nprint: 0
un: 0
uj: 0
detp: 0
uind: 0 ;our .uind variable
lev: 0
time: 0 ;time ITS has been up, in 30ths
tflg: 0 ;non0 if time printout has happened on line
line:: jcl: block 20.
pdlen==100
pdl: -pdlen,,.
block pdlen
end go