[comp.sources.bugs] v23i047: SPS, a PS replacement, Part01/04

das@eplunix.UUCP (David Steffens) (11/29/90)

Here are four minor fixes for the latest release of sps for SunOS4.X.
I've had fixes #3 and #4 for about 18 months now --
sorry I didn't think to post them earlier.
__________
Fix #1: There is a file missing from the makefile for SunOS4.1 --
*** Make.sun.4.10	Tue Nov 27 15:35:50 1990
--- Make.sun.4.1	Tue Nov 27 18:32:04 1990
***************
*** 7,13 ****
  		needed.o openfiles.o percentmem.o prcmd.o prcpu.o \
  		prheader.o printall.o printproc.o prsummary.o readstatus.o \
  		selectproc.o selecttty.o stream.o termwidth.o ttystatus.o \
! 		waitingfor.o
  INCS    =       sps.h
  CC      =       cc
  # You'll need both "-DSUNOS40" and "-DSUNOS41" for SunOS 4.1
--- 7,13 ----
  		needed.o openfiles.o percentmem.o prcmd.o prcpu.o \
  		prheader.o printall.o printproc.o prsummary.o readstatus.o \
  		selectproc.o selecttty.o stream.o termwidth.o ttystatus.o \
! 		vmstat.o waitingfor.o
  INCS    =       sps.h
  CC      =       cc
  # You'll need both "-DSUNOS40" and "-DSUNOS41" for SunOS 4.1
__________
Fix #2: Uid's greater than 32767 are not handled properly for SunOS4.1.
This fix may also be needed for other systems which use uid_t == u_short --
*** sps.h0	Tue Nov 27 15:35:11 1990
--- sps.h	Wed Nov 28 10:44:55 1990
***************
*** 83,89 ****
--- 83,95 ----
  /* Structure holding a single hash table entry ... */
  struct hashtab
  {
+ # ifdef SUNOS41
+ 	/* For correct handling of uid's greater than 32767,
+ 	   e.g. "nobody" == 65534 in SunOS4.1, DAS NOV-90. */
+ 	uid_t			h_uid ;		/* Uid of user entry */
+ # else
  	short			h_uid ;		/* Uid of user entry */
+ # endif
  	char			h_uname[ UNAMELEN ] ; /* Corresponding name */
  } ;
  
__________
Fix #3: The console tty needs special handling under SunOS4.X --
*** sps.h0	Tue Nov 27 15:35:11 1990
--- sps.h	Wed Nov 28 10:44:55 1990
***************
*** 154,159 ****
--- 160,166 ----
  	struct stdata		*i_streamsNSTREAMS ;
  #  endif SUNOS41
  	caddr_t			i_sysbase ;
+ 	dev_t			i_rconsdev ;	/* Added, DAS NOV-90. */
  # endif SUNOS40
  } ;

*** globals2.c0	Tue Nov 27 15:34:38 1990
--- globals2.c	Tue Nov 27 17:58:30 1990
***************
*** 88,93 ****
--- 88,95 ----
  	{ "_streamsNSTREAMS", 1, (caddr_t*)&Info.i_streamsNSTREAMS ,(char*)0 },
  #  endif SUNOS41
  	{ "_Sysbase",	1,  (caddr_t*)&Info.i_sysbase,	(char*)0	},
+ 	/* Added, DAS NOV-90. */
+ 	{ "_rconsdev",	1,  (caddr_t*)&Info.i_rconsdev,	(char*)0	},
  # endif SUNOS40
  
  	/* Kernel addresses associated with process wait states.
*** findtty.c0	Tue Nov 27 15:36:04 1990
--- findtty.c	Tue Nov 27 17:57:40 1990
***************
*** 50,55 ****
--- 50,60 ----
  	if ( !p->pr_p.p_pgrp || !User.u_us.u_ttyp )
  #  endif
  		return ( &Notty ) ;
+ #ifdef SUNOS40
+ 	/* Console tty under SunOS4.0 requires special handling, DAS NOV-90. */
+ 	if ( User.u_us.u_ttyd == Info.i_rconsdev )
+ 		User.u_us.u_ttyd = makedev(0, 0);
+ #endif
  	for ( lp = Info.i_ttyline ; lp->l_name[0] ; lp++ )
  		if ( lp->l_dev == User.u_us.u_ttyd )
  			return ( lp ) ;
__________
Fix #4: Terminals with single-character names, e.g. "ttya" and "ttyb",
cannot be specified via the "-t" flag for SunOS4.X --
*** flagsetup.c0	Tue Nov 27 15:36:07 1990
--- flagsetup.c	Tue Nov 27 17:58:15 1990
***************
*** 67,77 ****
--- 67,82 ----
  	if ( !Flg.flg_Tlist->f_chp )
  		prexit( "sps - Tty name was expected after -t flag\n" ) ;
  	for ( fp = Flg.flg_Tlist ; chp = fp->f_chp ; fp++ )
+ #ifdef SUNOS40
+ 	{	/* Under SunOS4.0, _some_ ttys have _one_ character names
+ 		   which shouldn't be expanded automagically, DAS NOV-90. */
+ #else
  	{       /* Under VMUNIX, all ttys have two character names.
  		   Thus, a flag of the form `t 8' should be expanded to
  		   become `t 08'. */
  		if ( !chp[1] )
  			chp[1] = chp[0], chp[0] = '0' ;
+ #endif
  		found = 0 ;
  		for ( lp = Info.i_ttyline ; lp->l_name[0] ; lp++ )
  			if ( !strncmp( chp, lp->l_name, 2 ) )
-- 
David Allan Steffens       | I believe in learning from past mistakes...
Eaton-Peabody Laboratory   | ...but does a good education require so many?
Mass. Eye & Ear Infirmary, 243 Charles Street, Boston, MA 02114
{harvard,mit-eddie,think}!eplunix!das      (617) 573-3748 (1400-1900h EST)