C+ C #.# C C C C Program Install/Remove Task (INSREM) C C C FUNCTION: C This program processes all program activation requests C that have been queued for flying installs. C C C PROGRAM EXECUTION REQUIREMENTS: C INSREM is activated initially by a 'run' command. C Thereafter, INSREM fetches data from the 'INSREM' pipe C via the variable send data driver for parameter passing C (XX:). C C SUBROUTINES REFERENCED: C WTQIO BUGMSG SYSMSG GTLUN C GETADR TINFO ADDINS CHKINS C INST C C DESCRIPTION: C This program is used to dequeue packets from the flying install C pipe ('INSREM') and process the request accordingly. INSREM checks C if the task is installed by scanning the TCB's in the system. C If the task is currently not installed, the request is passed C to 'INSREM' which handles flying installs. C C INSREM will create the programs queue if not present, queue the C packet (if parameters are passed), then activate the task. C C C C SPECIAL CONSIDERATIONS: C C 1. INSREM is a privleged program since it scans the TCB's C in executive pool space. C C 2. INSREM must be run at priority above all tasks it activates C (150. default) C C 3. INSREM requires two logical devices: C XX0: = pipe device (variable send data driver) C (VX or VS) C 4. Parameter 'MAXTSK' must be changed if more than 256 C unique tasks are to be activated. C C 5. Parameter 'MAXPRM' must be changed if more than 100 C parameters are to be passed. C C- program insrem implicit integer(a-z) parameter MAXTSK = 256 parameter QUELUN = 2 parameter MAXPRM = 100 parameter IBUFSZ = MAXPRM + 4 parameter remevt = 51 parameter insevt = 52 integer*4 inslst(MAXTSK) dimension ibuf(IBUFSZ), tbuf(4) dimension rcvnam(2), quenam(2) dimension isb(2), prl(6), iofnc(5) dimension insmsg(13), tname(3) equivalence (tname(1), insmsg(10)) equivalence (rcvnam(1), ibuf(3)) equivalence (iocrq, iofnc(1)) equivalence (iowlb, iofnc(2)) equivalence (iorlb, iofnc(3)) equivalence (ioraw, iofnc(4)) equivalence (iokil, iofnc(5)) data quenam /3rINS, 3rREM/ data insmsg /'Co','ul','d ','no','t ','in','st','al','l ' * ,' ',' ',' ',0/ data iofnc / 1280, 256, 512, 640 ,10/ c c initialize and create INSREM queue. c 1 continue call ASNLUN (QUELUN, 'XX', 0) prl(3) = quenam(1) prl(4) = quenam(2) call GETADR (prl, ibuf) call WTQIO ( iocrq, QUELUN, 1, pri, isb, prl, ids) if (isb(1) .eq. 1 .or. isb(1) .eq. -102) go to 90 error = isb(1) 40 continue call SYSMSG ('Cannot create task queue. error = ', error) call EXIT 90 continue call CLREF (remevt) 100 continue call GETADR (prl, ibuf) prl(2) = IBUFSZ * 2 prl(3) = quenam(1) prl(4) = quenam(2) call QIO ( ioraw, QUELUN, insevt, pri, isb, prl, ids) 101 continue call WFLOR (insevt, remevt) call BUGMSG ('woke up from wflor') call READEF (remevt, eds) call BUGMSG ('remove event = ',eds) if (eds .eq. 2)go to 500 102 continue call READEF (insevt, eds) call BUGMSG ('install event = ',eds) if (eds .ne. 2) go to 101 if (isb(1) .eq. 1)go to 110 error = IOR (isb(1), "177400) call SYSMSG ('Error from vx: device = ', error) go to 100 C C Something in receive queue; C process it. C 110 continue size = isb(2) - 4 if (size .lt. 4) then call BUGMSG ('invalid bytecount = ',isb(2)) go to 100 endif call BUGMSG ('install request.') tsksts = TINFO (rcvnam, tbuf, 0) call BUGMSG ('task status = ', tsksts) if (tsksts .eq. -1)call WTEXIT (rcvnam, tsksts) if (tsksts .ne. 0)go to 130 call INST (rcvnam, sts) if (sts .eq. 1) go to 125 call R50ASC (6, rcvnam, tname) call SYSMSG (insmsg) go to 100 125 continue tsksts = 1 index = ADDINS (rcvnam, inslst, maxtsk) if (index .eq. 0)call SYSMSG ('Task list is full') go to 140 130 continue insflg = CHKINS (rcvnam, inslst, maxtsk) 140 continue if (size .eq. 4)go to 180 prl(2) = size - 2 prl(3) = rcvnam(1) prl(4) = rcvnam(2) ibuf(4) = remevt call GETADR (prl, ibuf(4)) 150 continue do 175,i=1,3 call WTQIO ( iowlb, QUELUN, 1, pri, isb, prl, ids) if (isb(1) .eq. 1)go to 180 if (isb(1) .ne. -101)go to 170 call BUGMSG ('Creating a task queue.') call WTQIO ( iocrq, QUELUN, 2, pri, isb, prl, ids) if (isb(1) .eq. 1) go to 150 170 continue error = IOR (isb(1), "177400) if (error .ne. -103) go to 176 call mark (1, 5, 2) call stopfr(1) 175 continue 176 continue call SYSMSG ('Error from vp device writing to receiver = ', error) go to 200 180 continue if (tsksts .ne. 1) go to 200 call REQUES (prl(3), opt, ids) if (ids .ne. 1)call SYSMSG('REQUES error = ',ids) 200 continue go to 100 C C Find all dormant tasks that I installed C and remove them. C 500 continue call CLREF (remevt) call BUGMSG ('remove request.') do 600 i = 1,maxtsk if (inslst(i) .eq. 0) go to 600 if (TINFO (inslst(i), tbuf, 0) .ne. 1) go to 600 call REMOVE (inslst(i), sts) inslst(i) = 0 600 continue go to 102 end