1
0
mirror of https://github.com/PDP-10/its.git synced 2026-03-09 12:30:45 +00:00

Addd support for REATTA.

This commit is contained in:
Eric Swenson
2016-12-03 15:10:48 -08:00
parent 947d786951
commit 07568ea0b7
5 changed files with 526 additions and 0 deletions

View File

@@ -108,6 +108,7 @@ from scratch.
- SEND, REPLY, replacements for DDT :SEND
- INQUPD, processes INQUIR change requests
- LOOKUP, looks up user info in INQUIR database
- REATTA, reattaches disowned jobs to terminal
6. A brand new host table is built from the host table source and
installed into SYSBIN; HOSTS3 > using H3MAKE.

View File

@@ -632,6 +632,9 @@ respond "*" ":link sys1;ts s,sys;ts send\r"
respond "*" ":link sys3;ts snd,sys;ts send\r"
respond "*" ":link sys3;ts sned,sys;ts send\r"
respond "*" ":midas sys1;ts reatta_sysen2;reatta\r"
expect ":KILL"
# ndskdmp tape
respond "*" ":link kshack;good ram,.;ram ram\r"

33
doc/_info_/reatta.order Executable file
View File

@@ -0,0 +1,33 @@
This is the file .INFO.;REATTA ORDER, the brief description of
the REATTACH program. :REATTA ? prints this file.
REATTACH is a program for connecting job-trees to terminals.
It can be used to "move" a user from one terminal to another,
or to exchange terminals with another user.
These are the common ways to use REATTACH:
To connect once again to your own detached tree, killing the tree
you now have, because you forgot to attach it when you logged in:
:REATTACH
To bring your tree, named FOOBAR, which may be at some other terminal
or may be detached, to the terminal you are now typing on,
:REATTACH FOOBAR
To exchange terminals with FOOBAR, so that his tree moves to the
terminal you are now typing on, and your tree moves from that
terminal to FOOBAR's old terminal, type
:REATTA FOOBAR/X
To move yourself to another terminal (TTY 69), if you are at your
old one, do
:REATTACH T69
In this case, if T69 is in use, you must specify /F.
For complete documentation of REATTA, do :INFO REATTA

141
doc/info/reatta.3 Executable file
View File

@@ -0,0 +1,141 @@
-*-Text-*-

File: REATTA, Node: Top, Up: (DIR), Next: Function
The REATTACH Program:
REATTACH is a program for connecting job-trees to terminals.
It can be used to "move" a user from one terminal to another,
or to exchange terminals with another user.
* Menu:
* Function:: Exactly what REATTACH's function is
* Args:: Argument syntax for REATTACH
* Switches:: Switches for REATTACH
* Recovery:: Recovering after a tree has been moved
to a different type of terminal
These are the common ways to use REATTACH:
To reconnect to your own detached tree, killing your current tree.
This is the thing to do if you forgot to type a space when DDT offered
to do the attaching for you. (Note: this case, of no arguments, is
handled specially and its behavior cannot be deduced from the general
rules).
:REATTACH
To bring your tree, named FOOBAR, which may be at some other terminal
or may be detached, to the terminal you are now typing on,
:REATTACH FOOBAR
To exchange terminals with FOOBAR, so that his tree moves to the
terminal you are now typing on, and your tree moves from that
terminal to FOOBAR's old terminal, type
:REATTA FOOBAR/X
To move yourself to another terminal (TTY 69), if you are at your
old one, do
:REATTACH T69
In this case, if T69 is in use, you must specify /F.

File: REATTA, Node: Function, Up: Top, Previous: Top, Next: Args
REATTA's capabilities:
REATTA's basic function is to attach a specified job-tree to a
specified terminal. While your own tree and your own terminal
are the defaults, any tree and any terminal can be specified.
In some cases, the basic function may require or suggest
auxiliary functions. For example, if there is a tree attached
to the specified terminal, various things can be done to it.
It could simply be detached; it could be killed; it could be
put in place of the specified tree, so that the two trees
exchange terminals.

File: REATTA, Node: Args, Up: Top, Previous: Function, Next: Switches
REATTA's arguments:
When REATTACH runs, it has to know the following things:
1) which job to attach, determined by uname and jname, and
2) which TTY to attach it to, determined by the TTY number.
The arguments to REATTACH allow you to specify those things,
as well as set switches.
Arguments are normally separated by spaces or commas. "*"
does not need to be separated; it is a "single character object".
An argument that consists of digits alone, with optionally a
"T" in front or a ":" afterward, is a TTY number, and says that
the specified TTY is the one to attach to. If no TTY number is
specified, the TTY REATTACH is running under will be used (this
requires detaching the tree that REATTACH is in; REATTACH
will do that automatically). It does not work to specify a TV
TTY explicitly if it is free, since the pdp-11 will not know to
connect the TTY to any keyboard.
Any other argument is one of the names of the job to be attached.
The first name given specifies the uname; the second, the jname.
If the uname is not specified, or is "*", then REATTACH's uname
(ie, your own) will be used. If the jname is not specified,
REATTACH will try both "HACTRO" and "HACTRN", in that order,
and use whichever exists. In order to be attached, a job must
be top-level, but it need not be disowned - REATTACH will make
it disowned by detaching it if necessary. To specify a name
that looks like a TTY number, quoting one of the characters in it
with ^Q will make it be taken as a name. The characters " ", ",",
"/", and "*" can be put in names with ^Q.

File: REATTA, Node: Switches, Up: Top, Previous: Args, Next: Recovery
REATTA's switches:
Switches consist of single letters preceded by a slash ("/").
They separate arguments just like spaces. Right now, the
meaningful switches are "/F", "/K", and "/X".
"/F" tells REATTACH to go ahead even if the specified TTY is in
use. REATTACH will detach the tree that is using it to free it
up (if the TTY is in use as a device, there is no way to free it
up, so REATTACH will fail even with "/F"). "/F" is not necessary
when your own TTY is being attached to.
"/K" tells REATTACH that when it detaches a tree, whether because
of "/F" or because you are reattaching to your own TTY, the tree
that is detached should be gunned down. /K is automatic when you
are attaching another tree to your own TTY and you are not logged
in. Please be careful not to use /K except on yourself.
"/X" tells REATTACH that, if a tree has to be detached from the
specified TTY, that tree should not be left disowned or killed,
but should be attached to the TTY which the specified job was
taken away from. Thus, the two trees exchange TTYs.

File: REATTA, Node: Recovery, Up: Top, Previous: Switches
Recovering from a REATTA.
Because REATTA moves jobs to a different terminal, which may not
be the same type as the previous one, jobs which pay attention
to such things as the terminal size will need to be told to take
note of the new terminal's differences.
DDT can be told to notice a change of TTY with the :NEWTTY command.
REATTA valrets a :NEWTTY automatically if it moves its own tree,
but it has no way of informing any other tree of the move.
TECO can be told about a change in terminal by restarting it (G).
This never causes any harm to the information in the TECO.
SUPDUP is hopeless to inform of a change in the terminal, since
it has passed a complete description of its old one to the
remote machine and has no way of correcting it.
You should simply kill the SUPDUP, thus detaching the tree at
the other end of it, and start a new SUPDUP to pick that tree up
again. TECOs in that tree will need to be G'd, etc.

348
src/sysen2/reatta.18 Executable file
View File

@@ -0,0 +1,348 @@
;-*-MIDAS-*-
TITLE REATTACH
.INSRT RMS;MACROS >
TYIC==1
TYOC==2
USRI==3
DSKIC==4
BUSRC==100000 ;USER-CONTROLLED BIT IN .USTP WORD.
IFNDEF LPDL,LPDL==40
IFNDEF JCLBSZ,JCLBSZ==10
BEG: MOVE P,[-LPDL,,PDL]
MOVEI A,ITEMTB ;INIT ALL VARIABLES
MOVEM A,ITEMTP
.SUSET [.RUNAM,,UNAME]
SETZM JNAME
SETOM TTYNUM
.SUSET [.ROPTIO,,A]
TLNN A,OPTCMD ;NO COMMAND STRING => REATTACH OUR OWN DETACHED TREE.
JRST OLDTREE
SETZM JCLBUF ;NOW GET THE COMMAND STRING
MOVE A,[JCLBUF,,JCLBUF+1]
BLT A,JCLBUF+JCLBSZ-1
.BREAK 12,[5,,JCLBUF]
SKIPN JCLBUF
JRST OLDTREE
MOVE D,[440700,,JCLBUF] ;NOW PROCESS THE COMMAND STRING.
ITEMLP: SAVE D
CALL RNUMO ;TRY TO READ A TTY NUMBER.
JRST ITEMWD ;FAILED; READ A WORD INSTEAD.
SUB P,[1,,1]
MOVEM A,TTYNUM ;GOT A TTY NUMBER; LOOK FOR NEXT THING.
JRST ITEMX
ITEMWD: REST D ;START OVER (MAYBE RNUMO SKIPPED SOME CHARS)
CALL RDSIX ;READ A WORD.
JUMPE B,ITEMW1
XCT @ITEMTP ;STORE IT AS UNAME OR JNAME.
AOS ITEMTP
ITEMW1: CAIN C,"* ;"*" MEANS "DON'T SPECIFY THIS ITEM".
AOS ITEMTP
ITEMX: CAIE C,^C ;^C AND ^M END THE COMMAND STRING.
CAIN C,^M
JRST CHECK
CAIE C,"/ ;SLASH STARTS A SWITCH.
JRST ITEMLP
ILDB C,D
CAIL C,140 ;CONVER THE SWITCH NAME TO UPPER CASE
SUBI C,40
SETZ B,
CAIN C,"F ;/F => IF TTY IS IN USE, FREE IT BY DETACH.
SETOB B,FORCE
CAIN C,"K ;/K => KILL THE TREE DETACHED FROM THE SPEC'D TTY,
SETOB B,KILL ;IF THERE WAS ONE.
CAIN C,"X ;/X => EXCHANGE SPECIFIED JOB WITH THAT ON SPECIFIED TTY.
SETOB B,EXCHNG
JUMPN B,ITEMLP
JRST NOSWIT ;ANYTHING ELSE AFTER SLASH IS ILLEGAL.
ITEMTB: MOVEM B,UNAME
MOVEM B,JNAME
SOS ITEMTP
;READ AN OCTAL NUMBER, OPTIONALLY PRECEDED BY "T", INTO A.
;THE "T" MAKES NO DIFFERENCE. A COLON MAY ALSO APPEAR AS A NOISE CHARACTER
;AT THE END.
;CLOBBERS B,C. SKIPS IF SUCCESSFUL (NUMBER IS NON-NULL AND
;HAS A PROPER TERMINATING CHARACTER).
RNUMO: SETZB A,B ;A ACCUMULATES NUMBER, B COUNTS DIGITS.
ILDB C,D
CAIE C,"T
CAIN C,"T+40
RNUMO1: ILDB C,D
CAIL C,"0
CAILE C,"9
JRST RNUMOX ;NON-DIGIT => IS THIS A LEGITIMATE TERMINATOR?
LSH A,3
ADDI A,-"0(C) ;DIGIT => MERGE IT IN.
AOJA B,RNUMO1
RNUMOX: JUMPE B,CPOPJ ;FAIL IF # OF DIGITS IS 0.
CAIN C,":
ILDB C,D
RDTEST: CAIE C,", ;SKIP IF CHAR IN C IS A LEGITIMATE TERMINATOR.
CAIG C,40
JRST POPJ1
CAIE C,"*
CAIN C,"/
JRST POPJ1
CAIN C,"?
JRST HELP
CPOPJ: RET
POPJ1: AOS (P)
RET
;READ A WORD, AS A SIXBIT WORD IN B. CLOBBERS A, C.
;ENDS WITH FIRST LEGITIMATE TERMINATOR (BUT ^Q CAN QUOTE).
RDSIX: SETZ B,
MOVE A,[440600,,B]
RDSIXL: ILDB C,D
CALL RDTEST ;IS CHAR A TERMINATOR?
JRST RDSIX1 ;NO.
CAIE C,^Q ;YES, BUT ^Q ISN'T LIKE OTHER TERMINATORS.
RET
ILDB C,D
CAIGE C,40
RET ;DON'T LET ^M, ^C BE QUOTED AT ALL.
RDSIX1: CAIL C,140
SUBI C,40 ;CONVERT CHAR TO UPPER CASE.
SUBI C,40
TLNE A,770000
IDPB C,A
JRST RDSIXL
;ASK THE USER FOR CONFIRMATION ON REATTACHING HIS DETACHED TREE.
CONFRM:.OPEN TYOC,TTYOF
.LOSE %LSSYS
.OPEN TYIC,TTYIF
.LOSE %LSSYS
MOVEI A,[ASCIZ /This will kill any jobs you have in this tree.
/]
CALL NO3
CONFR1: MOVEI A,[ASCIZ /Should I go ahead (Y or N)? /]
CALL NO3
.IOT TYIC,C
CAIL C,140
SUBI C,40
MOVEI A,[ASCIZ /
/]
CALL NO3
CAIN C,"N
JRST NO2
CAIE C,"Y
JRST CONFR1
SETOM KILL ;KILL THE USER'S NEW TREE.
POPJ P,
;HERE IF NO ARGUMENTS. ATTACH OUR OWN OLD DETACHED TREE, ASKING FOR CONFIRMATION.
OLDTREE:SETOM SELF
;COME HERE AFTER PROCESSING THE COMMAND STRING.
;DEFAULT THE JNAME IF NECESSARY, AND CHECK ARGS FOR LEGALITY.
CHECK: SKIPE A,JNAME ;IF JNAME IS UNSPECIFIED, TRY DETACHED TREES, THEN HACTRN.
JRST CHECK1
MOVE B,[SIXBIT/HELP/]
CAMN B,UNAME ;IF UNAME IS "HELP" AND NO JNAME, COMMAND STRING WAS
JRST HELP ;JUST "HELP", SO GIVE USER HELP.
MOVE A,['HACTRR] ;USE HACTRR IF IT EXISTS,
.CALL TRYOPN
SKIPA A,['HACTRQ] ;ELSE USE HACTRQ IF IT EXISTS,
JRST CHECK1
.CALL TRYOPN
SKIPA A,['HACTRP] ;ELSE USE HACTRP IF IT EXISTS,
JRST CHECK1
.CALL TRYOPN
SKIPA A,['HACTRO] ;ELSE USE HACTRO IF IT EXISTS,
JRST CHECK1
.CALL TRYOPN
SKIPA A,['HACTRN] ;IT DOESN'T; TRY HACTRN.
JRST CHECK1
SKIPE SELF ;DON'T TRY HACTRN IN CASE OF :REATTA<CR>
JRST NODET
CHECK1: .CALL TRYOPN ;DOES SPEC'D JOB EXIST?
JRST NOJOB ;NO; ERROR.
.USET USRI,[.RUSTP,,B]
TLNE B,BUSRC ;IT IS AN ERROR TO TRY TO ATTACH A STOPPED JOB.
JRST NORUN
SKIPE SELF ;IF :REATTA<CR>, ASK USER FOR CONFIRMATION.
CALL CONFRM
MOVEM A,JNAME
MOVE B,TTYNUM
JUMPGE B,CHECK2 ;IF USING OUR OWN TTY,
.SUSET [.RCNSL,,B] ;FIND OUT ITS NUMBER.
.SUSET [.RUNAME,,C] ;ALSO, IF WE ARE NOT LOGGED IN YET, ASSUME /K
HLLES C ;SO THAT SOMEONE DOING :REATTA <SELF> WITHOUT
AOJN C,CHECK2 ;LOGGING IN DOESN'T LEAVE A NON-LOGGED-IN DETACHED TREE.
SETOM KILL
SKIPE EXCHNG ;/X ISN'T ALLOWED IF YOU AREN'T LOGGED IN.
JRST NOLOGX
CHECK2: SKIPE KILL
SKIPN EXCHNG ;/X AND /K ARE INCONSISTENT.
CAIA
JRST NOXK
TRO B,400000 ;MAKE A TTY SPEC OUT OF THE TTY NUMBER.
MOVEM B,RTTYNM
SYSCAL STYGET,[B ? MOVEM C ? MOVEM A ? MOVEM C]
.LOSE %LSFIL
HRRES C ;C HAS -1, OR IDX OF TOP OF TREE OF SPEC'D TTY.
.USET USRI,[.RUIND,,D]
CAIN D,(C) ;SPEC'D TREE IS ALREADY ON THAT TTY =>
JRST NOOP ;WE HAVE NOTHING TO DO.
.USET USRI,[.RSUPPR,,D]
JUMPGE D,NOTTOP ;SPEC'D JOB MUST BE TOP LEVEL
JUMPL C,CHECK3 ;NOW, IF TTY IS IN USE,
SKIPE EXCHNG
SETOM FORCE
SKIPL TTYNUM ;AND IT'S OUR OWN, DETACH US.
SKIPE FORCE ;ELSE GIVE UP UNLESS /F OR /X WAS SPEC'D.
SYSCAL DETACH,[%CLIMM,,400000(C) ? %CLBIT,,30]
JRST NOTFREE ;THIS DETACH OMITS CNSL FREE MSG, AND MAKES JOB
JRST ACT ;DIE AFTER AN HOUR IF NOT ATTACHED.
CHECK3: HRRES A
JUMPGE A,NOTFREE ;CAN'T DO ANYTHING WITH TTY IN USE AS DEVICE.
;NOW THAT ALL IS CHECKED, DO THE DIRTY WORK.
ACT: .USET USRI,[.RCNSL,,A] ;REMEMBER TTY THAT SPEC'D JOB CAME FROM IN A.
.USET USRI,[.RAPRC,,D]
JUMPL D,ACT1 ;IF SPEC'D TREE IS DISOWNED, ALL IS WELL.
JUMPL A,ACT2 ;ELSE IF THE SPEC'D TREE HAD A TTY AND THE SPEC'D TTY
JUMPL C,ACT2 ;HAD A TREE, MAYBE (IF /X, "EXCHANGE", SPECIFIED)
SKIPN EXCHNG
JRST ACT2
SYSCAL DETACH,[1000,,USRI ? 5000,,30] ;KILL IN 1 HOUR, NO CONSOLE FREE MESSAGE.
.LOSE %LSSYS ;FREE THE SPEC'D TREE FROM ITS TTY
SYSCAL ATTACH,[%CLIMM,,400000(C) ? %CLIMM,,400000(A) ? %CLBIT,,400000]
.LOSE %LSSYS ;AND PUT THE SPEC'D TTY'S TREE THERE INSTEAD.
JRST ACT1
;HERE TO DETACH SPECIFIED TREE IF WE ARE NOT EXCHANGING IT. IN THAT CASE,
;WE SHOULD ALLOW A CONSOLE-FREE MESSAGE ON ITS TERMINAL.
ACT2: DPAUSE
SYSCAL DETACH,[1000,,USRI ? 5000,,10] ;CTL BIT 10 INHIBITS CNSL FREE MSG
.LOSE %LSSYS
ACT1: DPAUSE
SYSCAL ATTACH,[%CLIMM,,USRI ? RTTYNM ? %CLBIT,,400000]
.LOSE %LSSYS
SKIPN KILL ;AND MAYBE KILL THE TREE WE DETACHED FROM THE TTY.
JRST RETURN
SKIPL C
.GUN C,
RETURN: DPAUSE
.LOGOUT
.SUSET [.RTTY,,A]
ANDI A,-1
SKIPL TTYNUM
CAMN A,TTYNUM ;IF WE JUST REATTACHED OUR OWN TREE TO NEW TTY,
.VALUE [ASCIZ /:KILL :NEWTTY :VERSIO /] ;TELL DDT TO LOOK AGAIN AT TTY CHARACTERISTICS
.BREAK 16,340000
;ERROR MESSAGE HANDLERS.
NOTFREE:JSP A,NO
ASCIZ /Specified TTY not free/
NOTTOP: JSP A,NO
ASCIZ /Specified job not top level/
NOLOGX: JSP A,NO
ASCIZ */X is not allowed unless you are logged in*
NOXK: JSP A,NO
ASCIZ */X and /K together make no sense*
NOJOB: JSP A,NO
ASCIZ /No such job/
NORUN: JSP A,NO
ASCIZ /Specified job not running/
NOOP: JSP A,NO
ASCIZ /Specified job and TTY already connected/
NODET: JSP A,NO
ASCIZ /You have no detached tree/
NOSWIT: JSP A,NO
ASCIZ /Unrecognized switch. Legal ones are K, F, and X/
NO: .OPEN TYOC,TTYOF
.VALUE
CALL NO3 ;PRINT THE STRING A POINTS TO,
MOVEI A,[ASCIZ /.
For help, do :REATTA ?<cr> or print .INFO.;REATTA ORDER./]
CALL NO3 ;AND SOME GENERAL ADVICE.
NO2: DPAUSE ;.VALUE IF DEBUGGING.
.LOGOUT
.BREAK 16,140000
NO3: HRLI A,440700
NO1: ILDB B,A
JUMPE B,CPOPJ
.IOT TYOC,B
JRST NO1
;COME HERE IF COMMAND STRING IS "HELP" OR CONTAINS A "?".
HELP: .OPEN TYOC,TTYOF
.LOSE %LSSYS
SYSCAL OPEN,[1000,,DSKIC ;OPEN THE HELP FILE.
['DSK,,] ? ['REATTA] ? [SIXBIT/ORDER/] ? ['.INFO.]]
.LOSE %LSFIL
SETOM TTYNUM ;PREVENT VALRETTING :NEWTTY AT RETURN:.
HELP1: .IOT DSKIC,A
ANDI A,-1
CAIE A,^L
CAIN A,^C
JRST RETURN
.IOT TYOC,A
JRST HELP1
;CONSTANTS
TRYOPN: SETZ ? SIXBIT/OPEN/
[10,,USRI]
['USR,,]
UNAME
SETZ A
TTYIF: 'TTY
0
TTYOF: 1,,'TTY
0
;VARIABLES
FORCE: 0 ;-1 => EVEN IF SPEC'D TTY IS IN USE AND NOT OURS,
;GO AHEAD BY DETACHING WHOEVER IS ON IT.
KILL: 0 ;-1 => IF MUST DETACH A TREE FROM THE TTY TO FREE IT,
;GUN THE TREE AFTER ATTACHING THE TTY.
EXCHNG: 0 ;-1 => TAKE THE TREE WE DETACH FROM THE SPECIFIED TTY
;AND ATTACH IT TO THE TTY THE SPECIFIED JOB CAME FROM,
;THUS EXCHANGING THE TWO TREES.
SELF: 0 ;-1 => :REATTA<CR>, ATTACH OWN DETACHED TREE.
;IN THIS CASE, WE LOOK ONLY FOR DETACHED TREES, NOT FOR HACTRN.
UNAME: 0 ;UNAME OF JOB TO ATTACH
JNAME: 0 ;JNAME OF JOB TO ATTACH
;0 => TRY HACTRO, THEN TRY HACTRN IF HACTRO DOESN'T EXIST.
TTYNUM: -1 ;-1 => USE OUR TTY; ELSE, # OF TTY TO USE.
RTTYNM: 0 ;A TTY SPEC, GOOD FOR SPECIFYING THE TTY TO BE USED.
ITEMTP: ITEMTB ;FILENAME-READER COUNTER FOR SELECTING UNAME OR JNAME.
PDL: BLOCK LPDL
JCLBUF: BLOCK JCLBSZ
-1
DEBUG: 0 ;-1 => DEBUGGING.
PAT:
PATCH: BLOCK 100
-1
END BEG