.title RECON - connect to disconnected session ; ; RECON.MAR - Reconnect processes in different UICs ; ; Don Stokes 31-Aug-1990 ; ; ; Macro libraries/link setup ; .link "SYS$SYSTEM:SYS.STB" .library "SYS$LIBRARY:LIB" .library "MACROS" setup $PCBDEF .psect $DATA, long,noshr,noexe,wrt ; ; Device name and channel to our terminal. ; p_term: .ascid "TT:" p_chan: .blkw ; ; VTA device paraphenalia. ; v_prompt: .ascid "Virtual terminal: " v_term: descriptor ,,,D ; ; $GETJPI & $GETDVI itemlists to get UICs ; getjpi_itmlst: item JPI$_UIC, 4, jpi_uic item 0,0,0 getdvi_itmlst: item DVI$_PID, 4, dvi_pid item 0,0,0 getjpi_itmlst1: item JPI$_UIC, 4, dvi_uic item 0,0,0 jpi_uic: .blkw jpi_grp: .blkw dvi_pid: .blkl dvi_uic: .blkw dvi_grp: .blkw uic: .blkl pid: .long 0 iosb: .blkw 4 ; ; Exit handler destination block. ; desblk: .blkl .long exit_handler .long 1 .long exitstatus exitstatus: .blkl .psect $CODE, nowrt,exe,shr .entry recon, ^M<> ; ; Get name of virtual terminal to reconnect to ; call LIB$GET_FOREIGN, v_term, v_prompt status R0 ; ; Get our UIC, so we can restore it later. ; $GETJPIW_S itmlst=getjpi_itmlst, iosb=iosb, pidadr=pid status R0 status iosb ; ; Get owner-uic of terminal -- to do this, we need to get the PID of the owner, ; and then get the UIC using GETJPI. ; $GETDVIW_S devnam=v_term, itmlst=getdvi_itmlst, iosb=iosb status R0 status iosb $GETJPIW_S itmlst=getjpi_itmlst1, iosb=iosb, pidadr=dvi_pid status R0 status iosb ; ; Assign a channel to the terminal. We might as well do this before resorting ; to kernel code to change the UIC. ; $ASSIGN_S, devnam=p_term, chan=p_chan status R0 ; ; Change UIC to the that of the owner of the virtual terminal ; movl dvi_uic, uic $CMKRNL_S routin=set_uic status R0 ; ; Declare an exit handler, so if anything goes wrong, we can make the necessary ; course corrections. ; $DCLEXH_S desblk=desblk status R0 ; ; Do the dirty work. CONNECT, deassign channel and exit. ; The CONNECT operation leaves us disconnected. The exit handler makes sure we ; are back in the right UIC by the time the user comes to pick us up again. ; $QIOW_S chan=p_chan, iosb=iosb, p1=v_term, - func=#IO$_SETMODE!IO$M_TT_CONNECT status R0 status iosb $DASSGN_S chan=p_chan status R0 $EXIT_S #SS$_NORMAL ; ; Exit handler. Put UIC back the way it wuz, and exit. ; .entry exit_handler, ^M<> movl jpi_uic, uic $CMKRNL_S routin=set_uic status R0 $EXIT_S exitstatus ; ; Kernel mode routine to change UIC ; .entry set_uic, ^M<> movl ctl$gl_pcb, R0 movl uic, pcb$l_uic(R0) movl #1, R0 ret .end recon