Google
 

Trailing-Edge - PDP-10 Archives - BB-H348C-RM_1982 - swskit-v21/pmr/psthru.mac
There are 5 other files named psthru.mac in the archive. Click here to see a list.
	SALL			; Keep listing uncluttered, no macro expansion
	SEARCH	MONSYM,MACSYM	; Universals to search
	.REQUIRE SYS:MACREL	; Make LINK load these automatically


	T1==1			; AC definitions
	T2==2
	T3==3
	T4==4
	CX==16
	P==17

	MAXFRK==4		; Maximum number of server sub processes
	NPDL==40		; Size of pushdown list

FORKS:	BLOCK MAXFRK

	RELOC 1000-140		; Start on page boundary



BEGIN:	RESET			; Initialize ourselves
	HRROI T1,[ASCIZ /SRV/]	; See if network exists
	STDEV			; By checking for SRV device
	 HALTF
	MOVEI T1,.FHSLF		; This process
	RPCAP			; Get our capabilities
	MOVE T3,T2		; Copy them
	EPCAP			; Enable all capabilities we have
	MOVSI T4,-MAXFRK	; Maximum processes to create
FRKDO:	MOVX T1,CR%CAP		; Give them the same capabilities we have
	SETZM T2		; No AC's
	CFORK			; Create a process
	 ERJMP WTFRK			; If no more, done
	MOVEM T1,FORKS(T4)	; Save process handle
	MOVE T2,T3		; get caps again
	EPCAP
	MOVX T1,GJ%SHT
	HRROI T2,[ASCIZ /SYSTEM:-PTS-.EXE/]
	GTJFN			; get a JFN
	 ERJMP	[SETZM FORKS(T4) ; none here
		 JRST WTFRK]	; and give up
	HRL T1,FORKS(T4)
	GET			; get code
	HLRZS T1		; fork handle
	SETZM T2
	SFRKV			; start up the fork
FRKLOP:	AOBJN T4,FRKDO		; Do all of them
WTFRK:	MOVEI T1,.FHINF		; Our process
	WFORK			; Wait for any inferior to halt
	; ..
	SUBTTL	RSPROC - Restart inferior process after it halted

RSPROC:	MOVSI T4,-MAXFRK	; Scan process table
DEDLOP:	SKIPN T1,FORKS(T4)	; This one exist?
	JRST DEDLO1		; No, go on
	RFSTS			; Yes, get its status
	LOAD T1,RF%STS,T1	; Get its status
	CAIE T1,.RFHLT		; Halted?
	CAIN T1,.RFFPT		; Or error?
	JRST [	MOVE T1,FORKS(T4) 	; Yes, get process handle again
		SETZM FORKS(T4)		; Clear entry
		KFORK			; Kill the process
		HRRZS T4		; Create one more process
		MOVEI T1,.FHSLF		; Our process
		RPCAP			; Get our capabilities
		MOVE T3,T2		; Copy them
		JRST FRKDO]		; Go back and create another process
DEDLO1:	AOBJN T4,DEDLOP		; Look at them all
	JRST WTFRK		; Wait some more
	END BEGIN