Google
 

Trailing-Edge - PDP-10 Archives - SRI_NIC_PERM_SRC_3_19910112 - sources/sndsta.mac
There are 3 other files named sndsta.mac in the archive. Click here to see a list.
	TITLE SNDSTAT - Ask the SNDSRV daemon for statistics
	SUBTTL David Eppstein / Stanford University / 16 April 1982

	SEARCH MONSYM,MACSYM,SNDDEF
	.TEXT "SNDSTA/SAVE"	;Save as SNDSTAT.EXE
	ASUPPRESS

; Accumulators

A=:1				;Scratch
B=:2
C=:3
D=:4
; Storage

OURPID:	BLOCK 1			;PID for ourself
SRVPID:	BLOCK 1			;PID for SNDSRV
SNDARG:	BLOCK 4			;IPCF block for INFO

	PACLEN==7		;Length of IPCF block
PACKET:	BLOCK PACLEN		;IPCF block

	SNDPAG==100		;Where to build IPCF page for SNDSRV
SNDADR==SNDPAG*1000		;Address of page
; Main program

START:	RESET%			;Clean up the world
	MOVX A,IP%CPD		;Get create pid flag into place
	MOVEM A,.IPCFL+PACKET	;Set up flag word
	SETZM .IPCFS+PACKET	;We are sender, no PID yet
	SETZM .IPCFR+PACKET	;INFO is the receiver
	MOVEI A,SNDARG
	HRLI A,4
	MOVEM A,.IPCFP+PACKET	;Set up pointer to argument block
	MOVX A,.IPCIW
	MOVEM A,.IPCI0+SNDARG	;Get pid for this name
	SETZM .IPCI1+SNDARG	;No duplicate
	DMOVE A,[ASCIZ/SNDSRV/]	;Point to string for SNDSRV's PID name
	DMOVEM A,.IPCI2+SNDARG	;Stash the id
	MOVEI A,PACLEN
	MOVEI B,PACKET
	MSEND%			;Ask info for server PID, maybe create our PID
	 ERJMP IPCERR
	MOVE A,.IPCFS+PACKET	;Fetch our PID
	MOVEM A,OURPID		;Save it in case it was just created
	SETZM .IPCFL+PACKET
	MOVE A,OURPID		;We are receiver this time
	MOVEM A,.IPCFR+PACKET
	MOVEI A,PACLEN
	MOVEI B,PACKET
	MRECV%			;Receive reply from INFO
	 ERJMP IPCERR
	LDB A,[POINT 6,.IPCFL+PACKET,29] ;Get INFO error code field
	IFN. A
	  CAIE A,76		;Couldn't find it?
	   JRST IPCERR
	  TMSG <Server not running>
	  HALTF%
	  JRST START
	ENDIF.
	MOVE A,.IPCI1+SNDARG
	MOVEM A,SRVPID		;Store server's PID
	MOVX A,IP%CFV
	MOVEM A,.IPCFL+PACKET	;Sending a page of data
	MOVE A,OURPID
	MOVEM A,.IPCFS+PACKET	;We are the sender
	MOVE A,SRVPID
	MOVEM A,.IPCFR+PACKET	;The server is the receiver
	MOVEI A,SNDPAG		;From the data page
	HRLI A,1000		;A whole page full
	MOVEM A,.IPCFP+PACKET
	MOVE A,['SNDSTA']	;SIXBIT function code
	MOVEM A,SNDADR+SN$HDR	;Set up in IPCF page
	SETZM SNDADR+SN$FLG	;No format flags
	MOVEI A,PACLEN
	MOVEI B,PACKET
	MSEND%			;Send off the request
	 ERJMP IPCERR
	MOVX A,IP%CFV
	MOVEM A,.IPCFL+PACKET	;Receiving a page of data
	MOVE A,SRVPID
	MOVEM A,.IPCFS+PACKET	;From the server
	MOVE A,OURPID
	MOVEM A,.IPCFR+PACKET	;To our own PID
	MOVEI A,SNDPAG		;Back to the same data page
	HRLI A,1000
	MOVEM A,.IPCFP+PACKET
	MOVEI A,PACLEN
	MOVEI B,PACKET
	MRECV%			;Receive a reply
	 ERJMP IPCERR
	SKIPN SNDADR+SN$HDR	;Error?
	IFSKP.
	  HRROI A,SNDADR+SN$STR	;Yes, point to error string
	  PSOUT%		;And type it
	ENDIF.
	HALTF%
	JRST START

IPCERR:	TMSG <Unexpected IPCF error>
	HALTF%
	JRST START

	END START