Unofficial patches to sps for DEC/MIPS + Ultrix 4.x

Michel Fingerhut fingerhu at ircam.fr
Wed Dec 12 19:30:23 AEST 1990


My original post of the patches I made to sps to allow it to run on DEC/MIPS +
Ultrix 4.x did not make it very far (16 kms, to my reckoning), so here is
another attempt to release it to the world.

Thanks to Alan Rollow from Dec for his tip.

------------------------------------------------------------------------------------

diff -c /old/sps/Makefile.dec3100 sps/Makefile.dec3100
*** /old/sps/Makefile.dec3100	Sun Nov 25 23:52:57 1990
--- sps/Makefile.dec3100	Sun Nov 25 23:42:34 1990
***************
*** 9,17 ****
  		selectproc.o selecttty.o termwidth.o ttystatus.o waitingfor.o
  INCS    =       sps.h
  CC      =       cc
! CFLAGS  =       -DBSD42 -DULTRIX20 -DULTRIX30 -DVPRINTF -DDEC3100 -I/sys
  LIBS    =       -ltermlib
! DIRINSTALL =	/bin
  
  all:		    $(PROG)
  .c.o:
--- 9,18 ----
  		selectproc.o selecttty.o termwidth.o ttystatus.o waitingfor.o
  INCS    =       sps.h
  CC      =       cc
! CFLAGS  =       -DBSD42 -DULTRIX20 -DULTRIX30 -DULTRIX40 -DVPRINTF -DDEC3100 -I/sys
  LIBS    =       -ltermlib
! DIRINSTALL =	/usr/local/bin
! DIRMAN  =       /usr/local/man/man1
  
  all:		    $(PROG)
  .c.o:
***************
*** 26,36 ****
  		$(CC) -o $@ $(OBJS) $(LIBS)
  
  install:		$(PROG)
! 		strip $(PROG)
! 		mv $(PROG) $(DIRINSTALL)/$(PROG)
! 		/etc/chown root $(DIRINSTALL)/$(PROG)
! 		chgrp kmem $(DIRINSTALL)/$(PROG)
! 		chmod 2755 $(DIRINSTALL)/$(PROG)
  
  lint:
  		lint -x -b $(CFLAGS) *.c
--- 27,34 ----
  		$(CC) -o $@ $(OBJS) $(LIBS)
  
  install:		$(PROG)
! 		install -s -c -o root -g kmem -m 2755 $(PROG) $(DIRINSTALL)/$(PROG)
! 		install -c -o root -g wheel -m 644 sps.l $(DIRMAN)/sps.1
  
  lint:
  		lint -x -b $(CFLAGS) *.c
Common subdirectories: /old/sps/SCCS and sps/SCCS
diff -c /old/sps/getcmd.c sps/getcmd.c
*** /old/sps/getcmd.c	Sun Nov 25 23:52:56 1990
--- sps/getcmd.c	Wed Nov 21 18:31:52 1990
***************
*** 54,60 ****
--- 54,64 ----
  	p->pr_upag = 0 ;
  	if ( p->pr_p.p_stat == SZOMB )
  		return ( "** Exit **" ) ;
+ # ifdef ULTRIX40
+ 	if ( !(p->pr_p.p_sched & SLOAD) && Flg.flg_o )
+ # else
  	if ( !(p->pr_p.p_flag & SLOAD) && Flg.flg_o )
+ # endif
  		return ( "** Swapped out **" ) ;
  	/* Find the process' upage */
  # ifdef KVM
***************
*** 65,71 ****
--- 69,79 ----
  		return ( "** No upage **" ) ;
  	p->pr_upag = 1 ;
  	/* Is this a system process ? */
+ # ifdef ULTRIX40
+ 	if ( p->pr_p.p_type & SSYS )            
+ # else
  	if ( p->pr_p.p_flag & SSYS )            
+ # endif	
  		switch ( p->pr_p.p_pid )
  		{
  			case 0 :
***************
*** 142,148 ****
--- 150,160 ----
  	/* Look at the top of the upage to locate the command arguments.
  	   The page is loaded if the process itself is loaded and the pte
  	   contains is marked as valid. */
+ # ifdef ULTRIX40
+ 	if ( (p->pr_p.p_sched & SLOAD)
+ # else
  	if ( (p->pr_p.p_flag & SLOAD)
+ # endif
  	&& !ptetbl[0].pg_fod && ptetbl[0].pg_pfnum )
  	{       /* If the page is loaded, read the arguments from
  		   physical memory. */
***************
*** 152,158 ****
--- 164,174 ----
  	}
  	else                            
  	{       /* Otherwise the page is on the swap device */
+ # ifdef ULTRIX40
+ 		vstodb( 0, ctod( CLSIZE ), &User.u_us.u_procp->p_smap, &db, 1) ;
+ # else
  		vstodb( 0, ctod( CLSIZE ), &User.u_us.u_smap, &db, 1 ) ;
+ # endif
  #  ifdef BSD42
  		swseek( (long)dtob( db.db_base ) ) ;
  #  else
diff -c /old/sps/getupage.c sps/getupage.c
*** /old/sps/getupage.c	Sun Nov 25 23:52:57 1990
--- sps/getupage.c	Sun Nov 25 21:04:36 1990
***************
*** 40,52 ****
--- 40,67 ----
  	extern int              Flmem, Flkmem, Flswap ;
  
  	/* If the process is not loaded, look for the upage on the swap device*/
+ # ifdef ULTRIX40
+ 	if ( !(p->pr_p.p_sched & SLOAD) )
+ # else
  	if ( !(p->pr_p.p_flag & SLOAD) )
+ # endif
  	{                               
+ # ifdef ULTRIX40
+                 struct dmap l_dmap;
+ 		int ublkno;
+ 
+ 	        memseek( Flkmem, (long)p->pr_p.p_smap );
+ 	        read( Flkmem, (char*)&l_dmap, sizeof( struct dmap ));
+ 		memseek( Flkmem, l_dmap.dm_ptdaddr );
+ 		read( Flkmem, (char *)&ublkno, sizeof(int));
+ 		swseek( (long)dtob(ublkno) );
+ # else ULTRIX40
  # ifdef BSD42
  		swseek( (long)dtob( p->pr_p.p_swaddr ) ) ;
  # else BSD42
  		swseek( (long)ctob( p->pr_p.p_swaddr ) ) ;
  # endif BSD42
+ # endif ULTRIX40
  # ifdef SUN
  		if ( read( Flswap, (char*)&User.u_us, sizeof( union userstate ))
  		!= sizeof( union userstate ) )
diff -c /old/sps/needed.c sps/needed.c
*** /old/sps/needed.c	Sun Nov 25 23:52:57 1990
--- sps/needed.c	Sun Nov 25 23:38:17 1990
***************
*** 78,84 ****
--- 78,89 ----
  	uid = getuid() ;
  	for ( p = process ; p < lastp ; p++ )
  	{                               
+ # ifdef ULTRIX40
+ 		if ( !p->pr_p.p_stat 
+ 			|| p->pr_p.p_pid==0 && p->pr_p.p_stat == SIDL)
+ # else
  		if ( !p->pr_p.p_stat )
+ # endif
  			continue ;
  		/* Count processes and sizes */
  		summarise( p ) ;
***************
*** 150,156 ****
--- 155,165 ----
  # endif
  	Summary.sm_kloaded += p->pr_p.p_rssize ;
  	Summary.sm_kswapped += p->pr_p.p_swrss ;
+ # ifdef ULTRIX40
+ 	if ( p->pr_p.p_sched & SLOAD )
+ # else
  	if ( p->pr_p.p_flag & SLOAD )
+ # endif
  		Summary.sm_nloaded++ ;
  	else
  		Summary.sm_nswapped++ ;
diff -c /old/sps/percentmem.c sps/percentmem.c
*** /old/sps/percentmem.c	Sun Nov 25 23:52:57 1990
--- sps/percentmem.c	Thu Nov 22 08:31:59 1990
***************
*** 34,40 ****
--- 34,44 ----
  	fracmem = ( (double)p->pr_p.p_rssize + szptudot ) ;
  # else
  	tp = p->pr_p.p_textp ;
+ # ifdef ULTRIX40
+ 	if ( !(p->pr_p.p_sched & SLOAD) || !tp )
+ # else
  	if ( !(p->pr_p.p_flag & SLOAD) || !tp )
+ # endif
  		return ( 0.0 ) ;
  	szptudot = UPAGES + clrnd( ctopt( p->pr_p.p_dsize + p->pr_p.p_ssize ) );
  	fracmem = ( (double)p->pr_p.p_rssize + szptudot ) / CLSIZE ;
diff -c /old/sps/printproc.c sps/printproc.c
*** /old/sps/printproc.c	Sun Nov 25 23:52:57 1990
--- sps/printproc.c	Thu Nov 22 08:38:06 1990
***************
*** 138,146 ****
--- 138,158 ----
  			break ;
  	}
  	/* If the process is loaded, list the status information in capitals */
+ # ifdef ULTRIX40
+ 	printf( "%-6.6s ", p->pr_p.p_sched & SLOAD ?
+ # else
  	printf( "%-6.6s ", p->pr_p.p_flag & SLOAD ?
+ # endif
  		(capitals( chp, chbuf ), chbuf) : chp ) ;
  	/* List process flags */
+ # ifdef ULTRIX40
+ 	printf( "%c%c%c", p->pr_p.p_type & SSYS ? 'U' :
+ 		p->pr_p.p_trace & STRC ? 'T' : ' ',
+ 		p->pr_p.p_vm & SVFORK ? 'V' :
+ 		p->pr_p.p_vm & SPHYSIO ? 'I' : ' ',
+ 		p->pr_p.p_vm & SUANOM ? 'A' :
+ 		p->pr_p.p_vm & SSEQL ? 'S' : ' ' ) ;
+ # else
  	printf( "%c%c%c", p->pr_p.p_flag & SSYS ? 'U' :
  		p->pr_p.p_flag & STRC ? 'T' : ' ',
  		p->pr_p.p_flag & SVFORK ? 'V' :
***************
*** 147,152 ****
--- 159,165 ----
  		p->pr_p.p_flag & SPHYSIO ? 'I' : ' ',
  		p->pr_p.p_flag & SUANOM ? 'A' :
  		p->pr_p.p_flag & SSEQL ? 'S' : ' ' ) ;
+ # endif
  	/* List process niceness */
  	if ( p->pr_p.p_nice != NZERO )          
  		printf( "%3d ", p->pr_p.p_nice - NZERO ) ;
diff -c /old/sps/waitingfor.c sps/waitingfor.c
*** /old/sps/waitingfor.c	Sun Nov 25 23:52:57 1990
--- sps/waitingfor.c	Thu Nov 22 08:41:47 1990
***************
*** 79,85 ****
--- 79,89 ----
  		return ( "null" ) ;
  	/* Waiting for a child process, alternatively in a vfork() ? */
  	if ( INRANGE( w, Info.i_proc0, &Info.i_proc0[ Info.i_nproc ] ) )
+ # ifdef ULTRIX40
+ 		return ( p->pr_p.p_vm & SNOVM ? "vfork" : "child" ) ;
+ # else
  		return ( p->pr_p.p_flag & SNOVM ? "vfork" : "child" ) ;
+ # endif
  # ifndef SUNOS40
  	/* Waiting for a page to be brought in ? */
  	if ( INRANGE( w, Info.i_swbuf0, &Info.i_swbuf0[ Info.i_nswbuf ] ) )
-- 
Michael Fingerhut	email: mf at ircam.fr	voice: 	+33 1 42770105
IRCAM, 31 rue St Merri, 75004 Paris, France	fax: 	+33 1 42772947	



More information about the Alt.sources mailing list