User Tools

Site Tools


cdc:nos2.source:nam5871:xchkpcr

XCHKPCR

Table Of Contents

  • [00022] PRGM XCHKPCR
  • [00097] PROC ABORT
  • [00098] PROC BLINK
  • [00099] PROC HCSTTP
  • [00100] PROC LOCLLCB
  • [00101] PROC OTIME
  • [00102] PROC OVLCALL
  • [00103] PROC MGETS
  • [00104] PROC MREDUCE
  • [00105] PROC OSCHAPP
  • [00106] PROC MRELS
  • [00107] PROC OMSG
  • [00108] PROC XTRACE

Source Code

XCHKPCR.txt
  1. *DECK XCHKPCR
  2. USETEXT NIPDEF
  3. USETEXT ACNB
  4. USETEXT ACNT
  5. USETEXT AT
  6. USETEXT DRHDR
  7. USETEXT ACB
  8. USETEXT PRUBUFF
  9. USETEXT FREETAB
  10. USETEXT KDIS
  11. USETEXT PT
  12. USETEXT MSGIDX
  13. USETEXT RELFILE
  14. USETEXT STATTAB
  15. USETEXT SYSTIME
  16. USETEXT LLCB
  17. USETEXT NBT
  18. USETEXT TNT
  19. USETEXT PARAMS
  20. USETEXT PIT
  21. USETEXT OVERLAY
  22. PRGM XCHKPCR; # CHECK FOR TIME-OUT ON A CONNECTION #
  23.  
  24. STARTIMS;
  25. #
  26. *1DC XCHKPCR
  27. *
  28. * 1. PROC NAME AUTHOR DATE
  29. * XCHKPCR PETER TAM 18/03/25
  30. *
  31. * 2. FUNCTIONAL DESCRIPTION.
  32. * LOOK FOR ACNT TABLE TO SHRINK,
  33. * CHECK EVERY NETWORK CONNECTION FOR LACK OF ACTIVITY.
  34. *
  35. * 3. METHOD USED.
  36. * IF PP-CALL-RING EXISTS AND COMPLETION BIT IS SET IN THE
  37. * CIO OR DSP REQUEST PARAMETER BLOCK, DELINK BLOCK FROM THE PCR
  38. * AND RELEASE IT.
  39. * FOR EVERY ACNT TABLE, CHECK IF THERE IS POSSIBILITY
  40. * OF SHRINKING. CALL SDELQTB TO SHRINK THE TABLE.
  41. * FOR EACH ACNB
  42. * CHECK TIMER FOR INACTIVITY
  43. * SEND *INACT* MSG TO APPLICATION
  44. * CALL PIP
  45. *
  46. * 4. ENTRY PARAMETERS. NONE
  47. *
  48. * 5. EXIT PARAMETERS. NONE
  49. *
  50. * 6. COMDECKS CALLED AND SYMPL TEXTS USED.
  51. * ACB APPLICATION CONTROL BLOCK TEMPLATE
  52. * ACNB APPLICATION CONNECTION CONTROL BLK TEMPLATE
  53. * ACNT APPLICATION CONNECTION TABLE TEMPLATE
  54. * AT APPLICATION TABLE TEMPLATE
  55. * DRHDR DATA RING HEADER WORD TEMPLATE
  56. * FREETAB FREE CHAIN TABLE
  57. * LLCB LOGICAL LINK CONTROL BLOCK TEMPLATE
  58. * MSGIDX DAYFILE MESSAGE TABLE
  59. * NIPDEF CONSTANT DEFINITIONS
  60. * OVERLAY OVERLAY TABLE
  61. * PARAMS PARAMETERS FOR PASSING TO SECONDARY OVERLAY
  62. * PIT PIP INTERFACE TABLE
  63. * PRUBUFF PRU BUFFER TEMPLATE
  64. * PT POINTER TABLE
  65. * RELFILE FET FOR RETURNING FILES TEMPLATE
  66. * STATTAB STATISTICS TABLE
  67. * SYSTIME SYSTEM TIME TABLE
  68. * TNT TERMINAL NODE TABLE TEMPLATE
  69. *
  70. * 7. ROUTINES CALLED.
  71. * ABORT ABORT NIP
  72. * BLINK LINK DATA BLOCK INTO DATA RING
  73. * MGETS ALLOCATE BUFFER SPACE
  74. * OSCHAPP SCHEDULE AN APPLICATION
  75. * OTIME GET SYSTEM RTIME
  76. * XTRACE TRACES CALLS
  77. *
  78. * 8. DAYFILE MESSAGES. NONE
  79. *
  80. * WHEN EXECUTION HAS COMPLETED, A JUMP TO LABEL
  81. * RJMAIN IS MADE TO RETURN TO CALLING PROGRAM.
  82. *
  83. * W A R N I N G - THE SUM OF PROGRAM LENGTH OF XCHKPCR,
  84. * MREDUCE SHOULD NOT EXCEED THE PRIMARY
  85. *CALL OPSIZE
  86. *
  87. * THIS OVERLAY IS CALLED BY XEXEC.
  88. *
  89.  #
  90. STOPIMS;
  91. #
  92.  PARAMETERS. NONE
  93.  
  94.   EXTERNAL VARIABLES
  95. #
  96. XREF BEGIN
  97. PROC ABORT; # ABORT NIP #
  98. PROC BLINK; # LINK DATA BLOCK INTO DATA RING #
  99. PROC HCSTTP ; # HOST SIDE CONNECTION STATE TABLE #
  100. PROC LOCLLCB; # LOCATE LLCB #
  101. PROC OTIME; # GET SYSTEM RTIME #
  102. PROC OVLCALL; # LOAD AND EXECUTE OVERLAY #
  103. PROC MGETS; # ALLOCATE BUFFER SPACE #
  104. PROC MREDUCE ;
  105. PROC OSCHAPP; # SCHEDULE THE APPLICATION #
  106. PROC MRELS; # RELEASE BUFFER SPACE #
  107. PROC OMSG; # DAYFILE MESSAGE #
  108. PROC XTRACE; # TRACE CALLS #
  109. LABEL RJMAIN; # RETURN ADDRESS #
  110. END
  111. #
  112.   INTERNAL VARIABLES
  113. #
  114. ARRAY QFERRMSG S(4);
  115. BEGIN
  116. ITEM QFERRTEXT C(0,0,30) = [" XXX ERROR NNB, LFN = XXXXXXX."];
  117. ITEM QFPPNAME U(0,6,18); # DSP OR CIO #
  118. ITEM QFERRNN U(1,6,12); # OCTAL ERROR CODE #
  119. ITEM QFERRLFN C(2,12,NC); # QUEUE FILE LFN #
  120. ITEM QFENDTEXT U(3,0,60) = [0];
  121. END
  122. ITEM NXTACNB, LASTAN, TMP;
  123. ITEM NEXTBLK; # NEXT PP-CALL-RING BLOCK #
  124. ITEM LASTBLK; # LAST PP-CALL-RING BLOCK #
  125. ITEM INDEX; # FOR LOOP INDEX #
  126. ITEM TMP1; # TEMPORARY VARIABLE #
  127. ITEM TN; # TERMINAL NODE #
  128. ITEM HN; # HOST NODE #
  129. ITEM CURR; # CURRENT BUFFER TO RELEASE #
  130. ITEM NEXT; # SCRATCH VARIABLE #
  131.  
  132. BASED ARRAY PRUNIPWD S(1); # TEMPLATE FOR NIP WORD IN PIT #
  133. BEGIN
  134. ITEM PRUNIPMFB U(0,00,06); # MINIMUM NO OF PRU BUFS #
  135. ITEM PRUNIPMAB U(0,06,06); # MAXIMUM NO OF PRU BUFS #
  136. ITEM PRUNIPNCA U(0,12,12); # CURRENT NO OF BUFFERS ASSIGNED#
  137. ITEM PRUNIPNC U(0,24,12); # CURRENT NO OF PRU CONNECTIONS #
  138. ITEM PRUNIPFPB U(0,42,18); # ADR OF FIRST BUF IN FREE CHAIN#
  139. END
  140.  
  141. BASED ARRAY PRUPIPWD S(1); # TEMPLATE FOR PIP WORD IN PIT #
  142. BEGIN
  143. ITEM PRUPIPNFB U(0,00,12); # NO OF BUFS IN FREE CHAIN #
  144. ITEM PRUPIPNRA U(0,12,12); # NO OF BUS NEEDED BY PIP #
  145. ITEM PRUPIPRPB U(0,42,18); # ADDR OF BUF TO RELEASE #
  146. END
  147.  
  148. CONTROL IFEQ STAT,1;
  149. ARRAY STIME P(1); # RTIME BUFFER FOR STARTING TIME #
  150. BEGIN
  151. ITEM SMILS U(0,24,36); # STARTING TIME IN MILLESECONDS #
  152. END
  153. ARRAY ETIME P(1); # RTIME BUFFER FOR ENDING TIME #
  154. BEGIN
  155. ITEM EMILS U(0,24,36); # ENDING TIME IN MILLESECONDS #
  156. END
  157.  
  158. ITEM STTEMP; # TEMPORARY STATISTICS VARIABLE #
  159. CONTROL FI;
  160.  
  161.  
  162. #**********************************************************************#
  163. BEGIN
  164. CONTROL IFEQ DEBUG,1 ;
  165. XTRACE("XCHPC") ;
  166. CONTROL FI;
  167.  
  168.  
  169. IF HRL EQ HRLV0
  170. THEN # NAM IN MAX FL REACHED CONDITION #
  171. GOTO RJMAIN;
  172.  
  173. CONTROL IFEQ STAT,1;
  174. OTIME(STIME); # GET SYSTEM TIME AT BEGINNING OF PROC #
  175. CONTROL FI;
  176.  
  177. #
  178.   CHECK NAM K DISPLAY ACTIVITY
  179. #
  180. FOR NBTIDX = 0 STEP NBTFETNO WHILE NBTIDX LQ NBTMAXID
  181. DO
  182. BEGIN
  183. IF NBTREL[NBTIDX + 5] # BUFFER RELEASE FLAG SET #
  184. THEN
  185. BEGIN
  186. IF NBTFIRST[NBTIDX + 5] NQ 0
  187. THEN
  188. BEGIN
  189. MRELS(NBTFIRST[NBTIDX + 5]- BLKHSIZE);# RELEASE BUFFER #
  190. END
  191. NBTWD1[NBTIDX + 5] = 0; # CLEAR ALL FOUR WORDS IN TRACE FET#
  192. NBTWD2[NBTIDX + 5] = 0;
  193. NBTWD3[NBTIDX + 5] = 0;
  194. NBTWD4[NBTIDX + 5] = 0;
  195. END
  196. END
  197.  
  198. TMP1 = RTSECS[0];
  199. IF KDVW[0]
  200. THEN # K DISPLAY BEING VIEWED #
  201. BEGIN
  202. IF KDTIMER[0] LQ TMP1
  203. THEN # K DISPLAY VIEW TIMER TIMEOUT #
  204. BEGIN
  205. IF KDLCOMP[0] OR KDRCOMP[0]
  206. THEN # K DISPLAY IS ON #
  207. BEGIN
  208. KDTIMER[0] = TMP1 + TKDVW; # RESTART TIMER #
  209. KDLCOMP[0] = FALSE;
  210. KDRCOMP[0] = FALSE;
  211. END
  212. ELSE # K DISPLAY IS NOT ON #
  213. BEGIN
  214. KDVW[0] = FALSE;
  215. OVLNAME = KPCLNUPP; # CLEAN UP K DISPLAY DATA #
  216. OVLCALL;
  217. END
  218. END
  219. END
  220.  
  221. IF KDST[0]
  222. THEN # STATUS DISPLAY IS ON #
  223. BEGIN
  224. IF NOT KFAST[0]
  225. AND KSLOWTM[0] LQ TMP1
  226. THEN # SLOW MODE AND TIMER EXPIRED #
  227. BEGIN
  228. KDIS$STAT = STM"STM$UPDATE"; # UPDATE STATUS DISPLAY #
  229. KSLOWTM[0] = TMP1 + TSLOW; # RESTART TIMER #
  230. END
  231.  
  232. CONTROL IFEQ STAT,1;
  233. IF KSTATIM[0] LQ TMP1
  234. THEN # UPDATE STATISTICS IN K DISPLAY #
  235. BEGIN
  236. OVLNAME = KSTTUPDP;
  237. OVLCALL;
  238. KSTATIM[0] = TMP1 + TSTAT; # RESTART TIMER #
  239. END
  240. CONTROL FI;
  241.  
  242. END
  243.  
  244. P<FREEBUF> = 0;
  245. IF (FREFBBP+FRBBS[FREFBBP]) EQ CTLSLWA
  246. AND FRBBS[FREFBBP] GQ 2*RSBUF
  247. THEN
  248. REDUCEFL = 1; # CALL MGBGCLT TO REDUCE FL #
  249. #
  250.   IF PP-CALL-RING EXISTS AND COMPLETION BIT IS SET IN A REQUEST
  251.   PARAMETER BLOCK, DELINK BLOCK FROM THE PCR AND RELEASE IT.
  252. #
  253. NEXTBLK = PCRHEAD[0]; # INITIALIZE NEXT PCR BLOCK #
  254. FOR INDEX=INDEX WHILE NEXTBLK NQ 0
  255. AND NEXTBLK NQ LOC(PCRHEAD[0])
  256. DO
  257. BEGIN # SCAN PP-CALL-RING #
  258. P<PARAMB> = NEXTBLK + BLKHSIZE;# PARAMETER BLOCK ADDRESS #
  259. P<DRHDRWD> = NEXTBLK; # CURRENT PCR BLOCK #
  260. NEXTBLK = NEXTPTR[0]; # NEXT BLOCK IN PCR #
  261. LASTBLK = BACKPTR[0]; # PREVIOUS BLOCK IN PCR #
  262.  
  263. IF FET$CB[0]
  264. THEN # IF COMPLETION BIT IS SET #
  265. BEGIN
  266.  
  267. IF BLKID[0] EQ DPCRIDVALUE
  268. THEN # A DSP CALL #
  269. BEGIN
  270. TMP = FET$DSPERR[0]; # DSP ERROR CODE #
  271. TMP1 = PP$DSP;
  272. END
  273. ELSE # A CIO CALL #
  274. BEGIN
  275. TMP = FET$CIOERR[0]; # CIO ERROR CODE #
  276. TMP1 = PP$CIO;
  277. END
  278.  
  279. IF TMP NQ 0
  280. THEN # DSP OR CIO CALL ERROR #
  281. BEGIN
  282. QFPPNAME[0] = TMP1;
  283. TMP1 = TMP/8;
  284. QFERRNN[0] = TMP1*O"100" + TMP - TMP1*8 + O"3333";
  285. QFERRLFN[0] = FET$LFN[0];
  286. OMSG(QFERRMSG,0); # DAYFILE MESSAGE #
  287. END
  288.  
  289. MRELS(P<DRHDRWD>); # RELEASE PCR BLOCK #
  290.  
  291. IF PCRHEAD[0] EQ PCRTAIL[0]
  292. THEN
  293. BEGIN # ONLY PCR BLOCK REMAINS #
  294. PCRHEAD[0] = 0; # ZERO PCR POINTERS #
  295. PCRTAIL[0] = 0;
  296. END
  297.  
  298. ELSE # MORE THAN ONE PCR BLOCK EXIST #
  299. BEGIN # UPDATE RING POINTERS #
  300. P<DRHDRWD> = 0;
  301. NEXTPTR[LASTBLK] = NEXTBLK;
  302. BACKPTR[NEXTBLK] = LASTBLK;
  303. END
  304. END
  305. END
  306. #
  307.   CHECK EVERY CONNECTION OF EVERY APPLICATION FOR ELIGIBLE CAND
  308.   TO SEND FC/INACT TO
  309. #
  310. IF INACTVAL NQ 0
  311. OR SETTIMER # APP SET INACTIVITY TIMER #
  312. THEN
  313. BEGIN # CHECK FOR INACTIVE TERMINALS #
  314. SETTIMER = FALSE; # REINITIALIZE APP SET TIMER FLAG #
  315.  
  316. FOR LASTAN = 1 STEP 1 UNTIL ATHAN[0]
  317. DO
  318. BEGIN
  319. P<ACB> = ATACBA[LASTAN];# NEXT ACB IN AT #
  320. IF P<ACB> NQ 0 AND NOT ATNVFN[LASTAN] AND NOT ATNVFF[LASTAN]
  321. THEN
  322. BEGIN # APP CONTROL BLOCK EXISTS #
  323.  
  324. # TIME TO LOOK FOR ACNT TO SHRINK #
  325.  
  326. P<ACNT> = ACBACNT[0];# APP CONNECTION TABLE ADDRESS #
  327.  
  328. # CHECK CONNECTIONS ACTIVITIES #
  329.  
  330. IF ACBNCN[0] NQ 0
  331. THEN
  332. BEGIN # CONNECTIONS EXIST #
  333. FOR NXTACNB = ACNTHSIZE STEP 1 # ENTRY SIZE OF ACNT #
  334. UNTIL ACNTHCN[0]-ACNTMINACN[0]+ACNTHSIZE
  335. DO
  336. BEGIN
  337. P<ACNB> = ACNTACNB[NXTACNB];
  338. IF P<ACNB> NQ 0
  339. THEN
  340. BEGIN # THERE IS A CONNECTION #
  341. IF ( ACNBINACT[0] LQ RTSECS[0] ) AND
  342. ( ( (NOT ACNBTIMERF[0]) AND
  343. (INACTVAL NQ 0 ) ) OR
  344. ( (ACNBTIMERF[0] ) AND
  345. (ACNBTIMER[0] NQ 0) ) )
  346. THEN
  347. BEGIN
  348. RCBRK = RCCB"I" ; # REASON CODE 9 TO BREAK THE#
  349. # CONNECTION IF IT NEEDS TO BE TER#
  350. # ONLY WHEN CONNECTION STILL IN NV#
  351. HCSTTP(P<ACB>,ACNBACN[0],HCTMOUT,0) ; # SEND FC/INA#
  352. ACNBTIMERF[0] = ACNBTIMERP[0]; # RESET APP TIMER FL#
  353. IF ACNBTIMERF[0]
  354. THEN # APP TIMER STILL IN EFFECT #
  355. BEGIN
  356. ACNBINACT[0] = RTSECS[0] + ACNBTIMER[0]; # NEW TI#
  357. END
  358. ELSE # NAM INACTIVITY TIMER IN EFFECT #
  359. BEGIN
  360. ACNBINACT[0] = RTSECS[0] + INACTVAL;
  361. END
  362. END
  363. IF ACNBTIMERF[0]
  364. THEN # APP TIMER STILL IN EFFECT #
  365. BEGIN
  366. SETTIMER = TRUE; # APP SET INACTIVITY TIMER #
  367. END
  368. END
  369. END
  370. END
  371. END
  372. END
  373. END # CHECK FOR INACTIVE TERMINAL #
  374.  
  375.  
  376. P<LLCB> = TNTLLAD[0];
  377. IF P<LLCB> NQ 0 AND LLCBNC[0] EQ 0
  378. THEN
  379. BEGIN # NO CONNECTIONS ON INTRA HOST LLK #
  380. FOR TN=0 STEP 1 WHILE (TN LQ 1)
  381. DO
  382. BEGIN
  383. IF TN EQ 0
  384. THEN
  385. HN = 1;
  386. ELSE
  387. HN = 0;
  388. LOCLLCB(HN,TN,P<LLCB>); # FIND LLCB #
  389. IF LLCBNC[0] EQ 0
  390. THEN
  391. BEGIN # RELEASE DATA QUEUED ON FAKE LLK #
  392. P<DRHDRWD> = 0;
  393. CURR = LLCBSHFP[0];
  394. FOR CURR = CURR WHILE CURR NQ 0
  395. DO
  396. BEGIN
  397. NEXT = NEXTPTR[CURR];
  398. MRELS(CURR);
  399. CURR = NEXT;
  400. END
  401. END
  402. # RELEASE INTRA HOST LOGICAL LINKS #
  403. PARAMS2 = P<LLCB>;
  404. OVLNAME = RELLLCBP; # OVERLAY NAME #
  405. OVLCALL;
  406. END
  407. END
  408. #
  409.   SCAN THROUGH PIT TABLE LOOKING FOR PRU BUFFERS THAT ARE TO BE
  410.   RELEASED.
  411. #
  412. FOR INDEX = 1 STEP 1 UNTIL MAXPIP
  413. DO # CHECK ALL PIT ENTRIES #
  414. BEGIN
  415. IF PITPUF[INDEX]
  416. THEN # THIS PIT ENTRY IS IN USE #
  417. BEGIN
  418. P<PRUNIPWD> = LOC(PITW5[INDEX]); # ADDR OF 1ST NIP WORD #
  419. P<PRUPIPWD> = LOC(PITW8[INDEX]); # ADDR OF 1ST PIP WORD #
  420. FOR NEXT = 0 STEP 1 UNTIL MAXPRU-1
  421. DO # CHECK EACH PRU BUFFER SIZE #
  422. BEGIN
  423. TMP = PRUNIPNCA[NEXT] - PRUPIPNRA[NEXT]; # NO OF BUF TO REL#
  424. IF TMP GR 0
  425. THEN # PIP HAS PRU BUFS FOR RELEASE #
  426. BEGIN
  427. P<PRUBUFF> = PRUPIPRPB[NEXT]; # ADDR OF BUF TO RELEASE #
  428. IF (TMP EQ 1 ) AND # PIP ONLY RELEASES 1 AT A TIME#
  429. (P<PRUBUFF> NQ 0) # ADDR OF BUF TO RELEASE EXISTS #
  430. THEN # RELEASE PRU BUFFER #
  431. BEGIN
  432. MRELS(P<PRUBUFF>); # RELEASE BUFFER #
  433. PRUNIPNCA[NEXT] = PRUNIPNCA[NEXT] - 1;
  434. IF PRUNIPNCA[NEXT] EQ 0
  435. THEN # RELEASED LAST PRU BUFFER #
  436. BEGIN
  437. PRUNIPFPB[NEXT] = 0; # ZERO 1ST BUFFER POINTER #
  438. END
  439. END
  440. ELSE # PIP MAY HAVE RELEASED ALL BUFS#
  441. BEGIN
  442. IF P<PRUBUFF> NQ 0
  443. THEN # PIP HAS NOT DROPPED OUT #
  444. BEGIN
  445. D27M2[0] = "XCHKPCR";
  446. OMSG(DFMSG27,0); # NIP INTERNAL ERROR #
  447. ABORT(0,0); # ABORT NIP #
  448. END
  449. END
  450. END
  451. END
  452. END
  453. END
  454.  
  455. CONTROL IFEQ STAT,1;
  456. OTIME(ETIME); # GET SYSTEM TIME AT END OF PROC #
  457. ST$NXP = ST$NXP + 1; # INCREMENT NUMBER OF TIMES XCHKPCR CALLED#
  458. STTEMP = EMILS[0] - SMILS[0]; # TIME SPENT IN THIS ROUTINE #
  459. ST$TXP = ST$TXP + STTEMP; # TOTAL TIME SPENT IN THIS ROUTINE #
  460. IF ST$LXP LS STTEMP
  461. THEN # FOUND LARGER TIME INTERVAL IN ROUTINE #
  462. BEGIN
  463. ST$LXP = STTEMP; # NEW LARGEST TIME INTERVAL #
  464. END
  465. CONTROL FI;
  466.  
  467.  
  468. GOTO RJMAIN;
  469. END
  470. TERM
cdc/nos2.source/nam5871/xchkpcr.txt ยท Last modified: 2023/08/05 17:23 by Site Administrator