Google
 

Trailing-Edge - PDP-10 Archives - BB-R598A-RM_1983 - swskit-v3/pmr/main.mac
There are no other files named main.mac in the archive.
	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==^d30		; Maximum number of server sub processes
	NPDL==40		; Size of pushdown list

FORKS:	BLOCK MAXFRK
REALF:	Z ^D10			; Number to do this instance

	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
	MOVE T1,REALF		; Number to do
	CAILE T1,MAXFRK		; Reasonable?
	MOVEI T1,MAXFRK		; No, make it so
	MOVNI T1,0(T1)		; Get neg of count
	HRLZM T1,REALF		; Store AOBJN index
	MOVE T4,REALF		; Get index
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!GJ%OLD
	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:	MOVE T4,REALF		; 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