v02i034: diffs for tahoe systat for SunOS 4.0

Charles Mcgrew mcgrew at aramis.rutgers.edu
Thu Nov 29 03:46:50 AEST 1990


Submitted-by: budd at bu-it.bu.edu (Phil Budne)
Posting-number: Volume 2, Issue 34
Archive-name: tahoe-systat




Here are diffs to the BSD 4.3 Tahoe "systat" program for SunOS 4.0.3

[ I've tried this, and it works just fine.  NOTE: you need the
 tahoe 4.3 sources to use this. -CWM]



#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  README Makefile.diff cmdtab.c.diff disks.c.diff
#   fetch.c.diff iostat.c.diff keyboard.c.diff main.c.diff pigs.c.diff
#   swap.c.diff systat.h.diff vmstat.c.diff
# Wrapped by budd at bu-it on Fri Jun 15 12:14:54 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f README -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"README\"
else
echo shar: Extracting \"README\" \(699 characters\)
sed "s/^X//" >README <<'END_OF_README'
XDiffs to BSD 4.3 Tahoe "systat" for SunOS 4.0.3
X
XThis is a "naive" port.  I have not gone to great lengths to remove
Xitems not valid on the Sun (ie; "Soft" interrupt count, VM counters
Xnot reported by new VM system), except for removing the "swap" display
Xand the inode cache information from the "vmstat" display.  I have not
XADDED any new information displays.  I have run it on Sun-3's and 4's.
X386i's will need the _'s removed from the nlist names.
X
XThe information displayed is to be considered suspect, and as the man
Xpage says "The whole thing is pretty hokey and was included in the
Xdistribution under serious duress."
X
XPhil Budne, Boston University
X(budd at bu-it.bu.edu)
XFriday June 15, 1990
END_OF_README
if test 699 -ne `wc -c <README`; then
    echo shar: \"README\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f Makefile.diff -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"Makefile.diff\"
else
echo shar: Extracting \"Makefile.diff\" \(757 characters\)
sed "s/^X//" >Makefile.diff <<'END_OF_Makefile.diff'
X*** Makefile.orig	Mon Jun 11 15:32:58 1990
X--- Makefile	Tue Jun 12 19:03:17 1990
X***************
X*** 5,13 ****
X  #
X  #	@(#)Makefile	5.4	(Berkeley)	6/16/87
X  #
X! CFLAGS=	-O
X  LIBC=	/lib/libc.a
X! LIBS=	-lcurses -ltermlib -lm
X  SRCS=	cmds.c cmdtab.c disks.c fetch.c iostat.c keyboard.c vmstat.c main.c \
X  	mbufs.c netcmds.c netstat.c pigs.c swap.c
X  OBJS=	cmds.o cmdtab.o disks.o fetch.o iostat.o keyboard.o vmstat.o main.o \
X--- 5,13 ----
X  #
X  #	@(#)Makefile	5.4	(Berkeley)	6/16/87
X  #
X! CFLAGS=	-g
X  LIBC=	/lib/libc.a
X! LIBS=	-lcurses -ltermlib -lm -lkvm
X  SRCS=	cmds.c cmdtab.c disks.c fetch.c iostat.c keyboard.c vmstat.c main.c \
X  	mbufs.c netcmds.c netstat.c pigs.c swap.c
X  OBJS=	cmds.o cmdtab.o disks.o fetch.o iostat.o keyboard.o vmstat.o main.o \
END_OF_Makefile.diff
if test 757 -ne `wc -c <Makefile.diff`; then
    echo shar: \"Makefile.diff\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f cmdtab.c.diff -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"cmdtab.c.diff\"
else
echo shar: Extracting \"cmdtab.c.diff\" \(858 characters\)
sed "s/^X//" >cmdtab.c.diff <<'END_OF_cmdtab.c.diff'
X*** cmdtab.c.orig	Mon Jun 11 15:32:59 1990
X--- cmdtab.c	Mon Jun 11 15:35:26 1990
X***************
X*** 13,21 ****
X--- 13,23 ----
X  int     showpigs(), fetchpigs(), labelpigs();
X  int	initpigs(), closepigs();
X  WINDOW	*openpigs();
X+ #ifndef sun
X  int     showswap(), fetchswap(), labelswap();
X  int	initswap(), closeswap();
X  WINDOW	*openswap();
X+ #endif
X  int	showmbufs(), fetchmbufs(), labelmbufs();
X  int	initmbufs(), closembufs();
X  WINDOW	*openmbufs();
X***************
X*** 33,41 ****
X--- 35,45 ----
X          { "pigs",	showpigs,	fetchpigs,	labelpigs,
X  	  initpigs,	openpigs,	closepigs,	0,
X  	  CF_LOADAV },
X+ #ifndef sun
X          { "swap",	showswap,	fetchswap,	labelswap,
X  	  initswap,	openswap,	closeswap,	0,
X  	  CF_LOADAV },
X+ #endif
X          { "mbufs",	showmbufs,	fetchmbufs,	labelmbufs,
X  	  initmbufs,	openmbufs,	closembufs,	0,
X  	  CF_LOADAV },
END_OF_cmdtab.c.diff
if test 858 -ne `wc -c <cmdtab.c.diff`; then
    echo shar: \"cmdtab.c.diff\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f disks.c.diff -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"disks.c.diff\"
else
echo shar: Extracting \"disks.c.diff\" \(1752 characters\)
sed "s/^X//" >disks.c.diff <<'END_OF_disks.c.diff'
X*** disks.c.orig	Mon Jun 11 15:32:59 1990
X--- disks.c	Tue Jun 12 19:04:05 1990
X***************
X*** 15,20 ****
X--- 15,21 ----
X  static struct nlist nlst[] = {
X  #define	X_DK_NDRIVE	0
X  	{ "_dk_ndrive" },
X+ #ifndef sun
X  #define	X_DK_MSPW	1
X  	{ "_dk_mspw" },
X  #ifdef vax
X***************
X*** 23,36 ****
X  #define	X_UBDINIT	(X_DK_MSPW+2)
X  	{ "_ubdinit" },
X  #endif
X- #ifdef sun
X- #define	X_MBDINIT	(X_DK_MSPW+1)
X- 	{ "_mbdinit" },
X- #endif
X  #ifdef tahoe
X  #define	X_VBDINIT	(X_DK_MSPW+1)
X  	{ "_vbdinit" },
X  #endif
X  	{ "" },
X  };
X  
X--- 24,39 ----
X  #define	X_UBDINIT	(X_DK_MSPW+2)
X  	{ "_ubdinit" },
X  #endif
X  #ifdef tahoe
X  #define	X_VBDINIT	(X_DK_MSPW+1)
X  	{ "_vbdinit" },
X  #endif
X+ #else					/* is sun */
X+ #define	X_MBDINIT	(X_DK_NDRIVE+1)
X+ 	{ "_mbdinit" },
X+ #define	X_DK_BPS	(X_MBDINIT+1)
X+ 	{ "_dk_bps" },
X+ #endif					/* is sun */
X  	{ "" },
X  };
X  
X***************
X*** 40,45 ****
X--- 43,51 ----
X  	register char *cp;
X  	static int once = 0;
X  	static char buf[1024];
X+ # ifdef sun
X+ 	long *bps;
X+ # endif
X  
X  	if (once)
X  		return(1);
X***************
X*** 54,61 ****
X--- 60,79 ----
X  		return(0);
X  	}
X  	dk_mspw = (float *)calloc(dk_ndrive, sizeof (float));
X+ #ifdef sun
X+ 	bps = (long *)calloc(dk_ndrive, sizeof (long));
X+ 	lseek(kmem, nlst[X_DK_BPS].n_value, L_SET);
X+ 	read(kmem, bps, dk_ndrive * sizeof (long));
X+ 	for( i = 0; i < dk_ndrive; i++ )
X+ 	    if( bps[i] > 0 )
X+ 		dk_mspw[i] = 1.0 / bps[i];
X+ 	    else
X+ 		dk_mspw[i] = 0.0;
X+ 	free( bps );
X+ #else	
X  	lseek(kmem, nlst[X_DK_MSPW].n_value, L_SET);
X  	read(kmem, dk_mspw, dk_ndrive * sizeof (float));
X+ #endif
X  	dr_name = (char **)calloc(dk_ndrive, sizeof (char *));
X  	dk_select = (int *)calloc(dk_ndrive, sizeof (int));
X  	for (cp = buf, i = 0; i < dk_ndrive; i++) {
END_OF_disks.c.diff
if test 1752 -ne `wc -c <disks.c.diff`; then
    echo shar: \"disks.c.diff\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f fetch.c.diff -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"fetch.c.diff\"
else
echo shar: Extracting \"fetch.c.diff\" \(763 characters\)
sed "s/^X//" >fetch.c.diff <<'END_OF_fetch.c.diff'
X*** fetch.c.orig	Mon Jun 11 15:32:59 1990
X--- fetch.c	Tue Jun 12 19:05:21 1990
X***************
X*** 57,67 ****
X--- 57,72 ----
X          return (namp);
X  }
X  
X+ #ifdef sun
X+ struct user *up;
X+ #define u	(*up)
X+ #else
X  union {
X          struct  user user;
X          char    upages[UPAGES][NBPG];
X  } user;
X  #define u       user.user
X+ #endif
X  
X  char *
X  getcmd(pid, mproc)
X***************
X*** 84,89 ****
X--- 89,102 ----
X          return (cmd);
X  }
X  
X+ #ifdef sun
X+ getu( pp )
X+     struct proc *pp;
X+ {
X+     up = kvm_getu( kvm, pp );
X+     return( up != NULL );
X+ }
X+ #else
X  static	int argaddr;
X  static	int pcbpf;
X  
X***************
X*** 138,143 ****
X--- 151,157 ----
X          }
X          return (1);
X  }
X+ #endif
X  
X  klseek(fd, loc, off)
X          int fd;
END_OF_fetch.c.diff
if test 763 -ne `wc -c <fetch.c.diff`; then
    echo shar: \"fetch.c.diff\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f iostat.c.diff -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"iostat.c.diff\"
else
echo shar: Extracting \"iostat.c.diff\" \(1208 characters\)
sed "s/^X//" >iostat.c.diff <<'END_OF_iostat.c.diff'
X*** iostat.c.orig	Mon Jun 11 15:32:59 1990
X--- iostat.c	Tue Jun 12 18:54:50 1990
X***************
X*** 45,50 ****
X--- 45,51 ----
X          { "_dk_seek" },
X  #define X_CP_TIME       5
X          { "_cp_time" },
X+ #if 0
X  #ifdef vax
X  #define X_MBDINIT       (X_CP_TIME+1)
X          { "_mbdinit" },
X***************
X*** 55,60 ****
X--- 56,62 ----
X  #define	X_VBDINIT	(X_CP_TIME+1)
X  	{ "_vbdinit" },
X  #endif
X+ #endif					/* if 0 */
X          { "" },
X  };
X  
X***************
X*** 314,325 ****
X          if (v > colwidth) {
X                  sprintf(buf, "%4.1f", val);
X                  k -= strlen(buf);
X!                 while (k--)
X                          waddch(wnd, 'X');
X                  waddstr(wnd, buf);
X                  return;
X          }
X!         while (k--)
X                  waddch(wnd, 'X');
X          wclrtoeol(wnd);
X  }
X--- 316,327 ----
X          if (v > colwidth) {
X                  sprintf(buf, "%4.1f", val);
X                  k -= strlen(buf);
X!                 while (k-- > 0)
X                          waddch(wnd, 'X');
X                  waddstr(wnd, buf);
X                  return;
X          }
X!         while (k-- > 0)
X                  waddch(wnd, 'X');
X          wclrtoeol(wnd);
X  }
END_OF_iostat.c.diff
if test 1208 -ne `wc -c <iostat.c.diff`; then
    echo shar: \"iostat.c.diff\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f keyboard.c.diff -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"keyboard.c.diff\"
else
echo shar: Extracting \"keyboard.c.diff\" \(292 characters\)
sed "s/^X//" >keyboard.c.diff <<'END_OF_keyboard.c.diff'
X*** keyboard.c.orig	Mon Jun 11 15:32:59 1990
X--- keyboard.c	Tue Jun 12 19:09:44 1990
X***************
X*** 15,20 ****
X--- 15,25 ----
X  #include "systat.h"
X  #include <ctype.h>
X  
X+ #ifdef sun
X+ #undef CTRL
X+ #define CTRL(c) ((c)-'a'+1)
X+ #endif
X+ 
X  keyboard()
X  {
X          char ch, line[80];
END_OF_keyboard.c.diff
if test 292 -ne `wc -c <keyboard.c.diff`; then
    echo shar: \"keyboard.c.diff\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f main.c.diff -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"main.c.diff\"
else
echo shar: Extracting \"main.c.diff\" \(2752 characters\)
sed "s/^X//" >main.c.diff <<'END_OF_main.c.diff'
X*** main.c.orig	Mon Jun 11 15:32:58 1990
X--- main.c	Thu Jun 14 11:41:35 1990
X***************
X*** 47,52 ****
X--- 47,55 ----
X          int argc;
X          char **argv;
X  {
X+ # ifdef sun
X+ 	long lccpu;
X+ # endif
X  
X  	argc--, argv++;
X  	while (argc > 0) {
X***************
X*** 90,95 ****
X--- 93,106 ----
X  		perror(swapf);
X  		exit(1);
X  	}
X+ # ifdef sun
X+ 	kvm = kvm_open( NULL, NULL, NULL, O_RDONLY, "systat" );
X+ 	if (kvm == NULL) {
X+ 		perror("kvm");
X+ 		exit(1);
X+ 	}
X+ # endif
X+ 
X          signal(SIGINT, die);
X          signal(SIGQUIT, die);
X          signal(SIGTERM, die);
X***************
X*** 115,121 ****
X--- 126,137 ----
X  
X          gethostname(hostname, sizeof (hostname));
X          lseek(kmem, nlst[X_CCPU].n_value, L_SET);
X+ #ifdef sun
X+         read(kmem, &lccpu, sizeof (ccpu));
X+ 	ccpu = (double) lccpu;
X+ #else
X          read(kmem, &ccpu, sizeof (ccpu));
X+ #endif
X          lccpu = log(ccpu);
X  	hz = getw(nlst[X_HZ].n_value);
X  	phz = getw(nlst[X_PHZ].n_value);
X***************
X*** 164,171 ****
X  	read(kmem, avenrun, sizeof (avenrun));
X          (*curcmd->c_fetch)();
X  	if (curcmd->c_flags & CF_LOADAV) {
X! 		j = 5.0*avenrun[0] + 0.5;
X! 		dellave -= avenrun[0];
X  		if (dellave >= 0.0)
X  			c = '<';
X  		else {
X--- 180,187 ----
X  	read(kmem, avenrun, sizeof (avenrun));
X          (*curcmd->c_fetch)();
X  	if (curcmd->c_flags & CF_LOADAV) {
X! 		j = 5.0*FSC(avenrun[0]) + 0.5;
X! 		dellave -= FSC(avenrun[0]);
X  		if (dellave >= 0.0)
X  			c = '<';
X  		else {
X***************
X*** 174,185 ****
X  		}
X  		if (dellave < 0.1)
X  			c = '|';
X! 		dellave = avenrun[0];
X  		wmove(wload, 0, 0); wclrtoeol(wload);
X  		for (i = (j > 50) ? 50 : j; i > 0; i--)
X  			waddch(wload, c);
X  		if (j > 50)
X! 			wprintw(wload, " %4.1f", avenrun[0]);
X  	}
X          (*curcmd->c_refresh)();
X  	if (curcmd->c_flags & CF_LOADAV)
X--- 190,201 ----
X  		}
X  		if (dellave < 0.1)
X  			c = '|';
X! 		dellave = FSC(avenrun[0]);
X  		wmove(wload, 0, 0); wclrtoeol(wload);
X  		for (i = (j > 50) ? 50 : j; i > 0; i--)
X  			waddch(wload, c);
X  		if (j > 50)
X! 			wprintw(wload, " %4.1f", FSC(avenrun[0]));
X  	}
X          (*curcmd->c_refresh)();
X  	if (curcmd->c_flags & CF_LOADAV)
X***************
X*** 192,203 ****
X  
X  load()
X  {
X  	double	avenrun[3];
X! 
X  	lseek(kmem, nlst[X_AVENRUN].n_value, L_SET);
X  	read(kmem, avenrun, sizeof (avenrun));
X  	mvprintw(CMDLINE, 0, "%4.1f %4.1f %4.1f",
X! 	    avenrun[0], avenrun[1], avenrun[2]);
X  	clrtoeol();
X  }
X  
X--- 208,222 ----
X  
X  load()
X  {
X+ #ifdef sun
X+ 	long	avenrun[3];
X+ #else
X  	double	avenrun[3];
X! #endif
X  	lseek(kmem, nlst[X_AVENRUN].n_value, L_SET);
X  	read(kmem, avenrun, sizeof (avenrun));
X  	mvprintw(CMDLINE, 0, "%4.1f %4.1f %4.1f",
X! 		 FSC(avenrun[0]), FSC(avenrun[1]), FSC(avenrun[2]));
X  	clrtoeol();
X  }
X  
END_OF_main.c.diff
if test 2752 -ne `wc -c <main.c.diff`; then
    echo shar: \"main.c.diff\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f pigs.c.diff -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"pigs.c.diff\"
else
echo shar: Extracting \"pigs.c.diff\" \(1715 characters\)
sed "s/^X//" >pigs.c.diff <<'END_OF_pigs.c.diff'
X*** pigs.c.orig	Mon Jun 11 15:32:57 1990
X--- pigs.c	Thu Jun 14 11:35:50 1990
X***************
X*** 149,160 ****
X          { "_proc" },
X  #define X_NPROC         1
X          { "_nproc" },
X! #define X_USRPTMAP      2
X          { "_Usrptmap" },
X! #define X_USRPT         3
X          { "_usrpt" },
X! #define X_CPTIME	4
X! 	{ "_cp_time" },
X          { "" }
X  };
X  
X--- 149,162 ----
X          { "_proc" },
X  #define X_NPROC         1
X          { "_nproc" },
X! #define X_CPTIME	2
X! 	{ "_cp_time" },
X! #ifndef sun
X! #define X_USRPTMAP      3
X          { "_Usrptmap" },
X! #define X_USRPT         4
X          { "_usrpt" },
X! # endif
X          { "" }
X  };
X  
X***************
X*** 174,183 ****
X--- 176,187 ----
X          }
X  	if (kprocp == NULL)
X                  kprocp = (struct proc *)calloc(nproc, sizeof (struct proc));
X+ # ifndef sun
X          if (usrpt != NULL)
X  		return(1);
X  	usrpt = (struct pte *)nlst[X_USRPT].n_value;
X  	Usrptma = (struct pte *)nlst[X_USRPTMAP].n_value;
X+ # endif
X  	if (pt == NULL)
X  		pt = (struct p_times *)calloc(nproc, sizeof (struct p_times));
X  	lseek(kmem, (long)nlst[X_CPTIME].n_value, L_SET);
X***************
X*** 215,221 ****
X                          continue;
X                  prt->pt_pid = pp->p_pid;
X                  prt->pt_pp = pp;
X!                 prt->pt_pctcpu = pp->p_pctcpu / (1.0 - exp(time * lccpu));
X                  prt->pt_uid = pp->p_uid;
X                  prt++;
X          }
X--- 219,225 ----
X                          continue;
X                  prt->pt_pid = pp->p_pid;
X                  prt->pt_pp = pp;
X!                 prt->pt_pctcpu = FSC(pp->p_pctcpu) / (1.0 - exp(time * lccpu));
X                  prt->pt_uid = pp->p_uid;
X                  prt++;
X          }
END_OF_pigs.c.diff
if test 1715 -ne `wc -c <pigs.c.diff`; then
    echo shar: \"pigs.c.diff\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f swap.c.diff -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"swap.c.diff\"
else
echo shar: Extracting \"swap.c.diff\" \(372 characters\)
sed "s/^X//" >swap.c.diff <<'END_OF_swap.c.diff'
X*** swap.c.orig	Mon Jun 11 15:32:57 1990
X--- swap.c	Tue Jun 12 18:37:35 1990
X***************
X*** 8,13 ****
X--- 8,14 ----
X  static char sccsid[] = "@(#)swap.c	5.4 (Berkeley) 7/20/86";
X  #endif not lint
X  
X+ #ifndef sun
X  #include "systat.h"
X  #include <sys/dir.h>
X  #include <sys/user.h>
X***************
X*** 309,311 ****
X--- 310,313 ----
X  	}
X  	return (row);
X  }
X+ #endif
END_OF_swap.c.diff
if test 372 -ne `wc -c <swap.c.diff`; then
    echo shar: \"swap.c.diff\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f systat.h.diff -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"systat.h.diff\"
else
echo shar: Extracting \"systat.h.diff\" \(939 characters\)
sed "s/^X//" >systat.h.diff <<'END_OF_systat.h.diff'
X*** systat.h.orig	Mon Jun 11 15:32:57 1990
X--- systat.h	Tue Jun 12 19:02:55 1990
X***************
X*** 13,23 ****
X--- 13,32 ----
X  
X  #include <sys/param.h>
X  #include <sys/file.h>
X+ #ifndef sun
X  #include <sys/dkstat.h>
X+ #else
X+ #include <sys/dk.h>
X+ #endif
X  
X  #include <netinet/in.h>
X  #include <arpa/inet.h>
X  
X+ #ifdef sun
X+ #include <kvm.h>
X+ kvm_t *kvm;
X+ #endif
X+ 
X  struct p_times {
X          short   pt_pid;
X          float   pt_pctcpu;
X***************
X*** 66,72 ****
X--- 75,87 ----
X  struct	text *xtext;
X  
X  double  lccpu;
X+ #ifdef sun
X+ long	avenrun[3];
X+ # define FSC(x) (((double)(x))/FSCALE)	/* floatify avenrun, pctcpu */
X+ #else
X  double	avenrun[3];
X+ # define FSC(x) (x)
X+ #endif
X  
X  char    *kmemf, *memf, *swapf;
X  int	hz, phz;
X***************
X*** 82,89 ****
X--- 97,106 ----
X  #define	TCP	0x1
X  #define	UDP	0x2
X  
X+ #ifndef sun
X  struct  pte *usrpt;
X  struct  pte *Usrptma;
X+ #endif
X  
X  WINDOW  *wnd;
X  int	CMDLINE;
END_OF_systat.h.diff
if test 939 -ne `wc -c <systat.h.diff`; then
    echo shar: \"systat.h.diff\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f vmstat.c.diff -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"vmstat.c.diff\"
else
echo shar: Extracting \"vmstat.c.diff\" \(5660 characters\)
sed "s/^X//" >vmstat.c.diff <<'END_OF_vmstat.c.diff'
X*** vmstat.c.orig	Mon Jun 11 15:32:57 1990
X--- vmstat.c	Tue Jun 12 19:21:38 1990
X***************
X*** 23,29 ****
X--- 23,31 ----
X  #include <sys/dir.h>
X  #include <sys/user.h>
X  #include <sys/proc.h>
X+ #ifndef sun
X  #include <sys/namei.h>
X+ #endif
X  
X  #include <machine/pte.h>
X  
X***************
X*** 81,96 ****
X  #define	X_TK_NOUT	11
X  	{ "_dk_seek" },
X  #define	X_DK_SEEK	12
X- 	{ "_nchstats" },
X- #define	X_NCHSTATS	13
X  	{ "_intrnames" },
X! #define	X_INTRNAMES	14
X  	{ "_eintrnames" },
X! #define	X_EINTRNAMES	15
X  	{ "_intrcnt" },
X! #define	X_INTRCNT	16
X  	{ "_eintrcnt" },
X! #define	X_EINTRCNT	17
X  	{ "" },
X  };
X  
X--- 83,100 ----
X  #define	X_TK_NOUT	11
X  	{ "_dk_seek" },
X  #define	X_DK_SEEK	12
X  	{ "_intrnames" },
X! #define	X_INTRNAMES	13
X  	{ "_eintrnames" },
X! #define	X_EINTRNAMES	14
X  	{ "_intrcnt" },
X! #define	X_INTRCNT	15
X  	{ "_eintrcnt" },
X! #define	X_EINTRCNT	16
X! #ifndef sun
X! 	{ "_nchstats" },
X! #define	X_NCHSTATS	17
X! #endif
X  	{ "" },
X  };
X  
X***************
X*** 107,113 ****
X--- 111,119 ----
X  	int	dk_busy;
X  	long	tk_nin;
X  	long	tk_nout;
X+ #ifndef sun
X  	struct	nchstats nchstats;
X+ #endif
X  	long	nchcount;
X  	long	*intrcnt;
X  } s, s1, s2, z;
X***************
X*** 116,124 ****
X  #define sum s.Sum
X  #define sumold s1.Sum
X  #define rate s.Rate
X  #define	nchtotal s.nchstats
X  #define	oldnchtotal s1.nchstats
X! #define oldrate s1.Rate
X  
X  static	char buf[26];
X  static	time_t t;
X--- 122,132 ----
X  #define sum s.Sum
X  #define sumold s1.Sum
X  #define rate s.Rate
X+ #define oldrate s1.Rate
X+ #ifndef sun
X  #define	nchtotal s.nchstats
X  #define	oldnchtotal s1.nchstats
X! #endif
X  
X  static	char buf[26];
X  static	time_t t;
X***************
X*** 275,284 ****
X  	mvprintw(PROCSROW, PROCSCOL, "Procs  r  p  d  s  w");
X  	mvprintw(GRAPHROW + 1, GRAPHCOL,
X  		"|    |    |    |    |    |    |    |    |    |    |");
X! 
X  	mvprintw(NAMEIROW, NAMEICOL, "Namei         Sys-cache     Proc-cache");
X  	mvprintw(NAMEIROW + 1, NAMEICOL,
X  		"    Calls     hits    %%     hits     %%");
X  	mvprintw(DISKROW, DISKCOL, "Discs");
X  	mvprintw(DISKROW + 1, DISKCOL, "seeks");
X  	mvprintw(DISKROW + 2, DISKCOL, "xfers");
X--- 283,293 ----
X  	mvprintw(PROCSROW, PROCSCOL, "Procs  r  p  d  s  w");
X  	mvprintw(GRAPHROW + 1, GRAPHCOL,
X  		"|    |    |    |    |    |    |    |    |    |    |");
X! #ifndef sun
X  	mvprintw(NAMEIROW, NAMEICOL, "Namei         Sys-cache     Proc-cache");
X  	mvprintw(NAMEIROW + 1, NAMEICOL,
X  		"    Calls     hits    %%     hits     %%");
X+ #endif
X  	mvprintw(DISKROW, DISKCOL, "Discs");
X  	mvprintw(DISKROW + 1, DISKCOL, "seeks");
X  	mvprintw(DISKROW + 2, DISKCOL, "xfers");
X***************
X*** 300,307 ****
X--- 309,318 ----
X  
X  #define X(fld)	{t=s.fld[i]; s.fld[i]-=s1.fld[i]; if(state==TIME) s1.fld[i]=t;}
X  #define Y(fld)	{t = s.fld; s.fld -= s1.fld; if(state == TIME) s1.fld = t;}
X+ #ifndef sun
X  #define Z(fld)	{t = s.nchstats.fld; s.nchstats.fld -= s1.nchstats.fld; \
X  	if(state == TIME) s1.nchstats.fld = t;}
X+ #endif
X  #define MAXFAIL 5
X  
X  static	char cpuchar[CPUSTATES] = { '=' , '>', '-', ' ' };
X***************
X*** 355,360 ****
X--- 366,372 ----
X  		putint(l, intrloc[i], INTSCOL, 8);
X  	}
X  	putint(inttotal, INTSROW + 1, INTSCOL, 8);
X+ #ifndef sun
X  	Z(ncs_goodhits); Z(ncs_badhits); Z(ncs_miss);
X  	Z(ncs_long); Z(ncs_pass2); Z(ncs_2passes);
X  	s.nchcount = nchtotal.ncs_goodhits + nchtotal.ncs_badhits +
X***************
X*** 361,366 ****
X--- 373,379 ----
X  	    nchtotal.ncs_miss + nchtotal.ncs_long;
X  	if (state == TIME)
X  		s1.nchcount = s.nchcount;
X+ #endif
X  
X  	psiz = 0;
X  	f2 = 0.0;
X***************
X*** 381,389 ****
X  	}
X  
X  	putint(ucount(), STATROW, STATCOL, 3);
X! 	putfloat(avenrun[0], STATROW, STATCOL + 17, 6, 2, 0);
X! 	putfloat(avenrun[1], STATROW, STATCOL + 23, 6, 2, 0);
X! 	putfloat(avenrun[2], STATROW, STATCOL + 29, 6, 2, 0);
X  	mvaddstr(STATROW, STATCOL + 53, buf);
X  	putint(total.t_arm/2, MEMROW + 2, MEMCOL + 4, 5);
X  	putint(total.t_armtxt/2, MEMROW + 2, MEMCOL + 9, 5);
X--- 394,402 ----
X  	}
X  
X  	putint(ucount(), STATROW, STATCOL, 3);
X! 	putfloat(FSC(avenrun[0]), STATROW, STATCOL + 17, 6, 2, 0);
X! 	putfloat(FSC(avenrun[1]), STATROW, STATCOL + 23, 6, 2, 0);
X! 	putfloat(FSC(avenrun[2]), STATROW, STATCOL + 29, 6, 2, 0);
X  	mvaddstr(STATROW, STATCOL + 53, buf);
X  	putint(total.t_arm/2, MEMROW + 2, MEMCOL + 4, 5);
X  	putint(total.t_armtxt/2, MEMROW + 2, MEMCOL + 9, 5);
X***************
X*** 409,416 ****
X--- 422,431 ----
X  		GENSTATROW + 3, GENSTATCOL, 7);
X  	putrate(rate.v_pdma, oldrate.v_pdma, 
X  		GENSTATROW + 4, GENSTATCOL, 7);
X+ #ifndef sun				/* ugh!! just leave out!! */
X  	putrate(rate.v_soft, oldrate.v_soft, 
X  		GENSTATROW + 5, GENSTATCOL, 7);
X+ #endif
X  	putrate(rate.v_faults, oldrate.v_faults, 
X  		GENSTATROW + 6, GENSTATCOL, 7);
X  	putrate(rate.v_scan, oldrate.v_scan, 
X***************
X*** 491,496 ****
X--- 506,512 ----
X  				"  %3.3s", dr_name[i]);
X  			dinfo(i, ++c);
X  		}
X+ #ifndef sun
X  	putint(s.nchcount, NAMEIROW + 2, NAMEICOL, 9);
X  	putint(nchtotal.ncs_goodhits, NAMEIROW + 2, NAMEICOL + 9, 9);
X  #define nz(x)	((x) ? (x) : 1)
X***************
X*** 500,505 ****
X--- 516,522 ----
X  	putfloat(nchtotal.ncs_pass2 * 100.0 / nz(s.nchcount),
X  	   NAMEIROW + 2, NAMEICOL + 34, 4, 0, 1);
X  #undef nz
X+ #endif
X  }
X  
X  cmdkre(cmd, args)
X***************
X*** 640,647 ****
X--- 657,666 ----
X  	read(kmem, s->dk_seek, dk_ndrive * sizeof (long));
X  	s->tk_nin = getw(name[X_TK_NIN].n_value);
X  	s->tk_nout = getw(name[X_TK_NOUT].n_value);
X+ #ifndef sun
X  	lseek(kmem, (long)name[X_NCHSTATS].n_value,  L_SET);
X  	read(kmem, &s->nchstats, sizeof s->nchstats);
X+ #endif
X  	lseek(kmem, (long)name[X_INTRCNT].n_value,  L_SET);
X  	read(kmem, s->intrcnt, nintr * sizeof (long));
X  }
END_OF_vmstat.c.diff
if test 5660 -ne `wc -c <vmstat.c.diff`; then
    echo shar: \"vmstat.c.diff\" unpacked with wrong size!
fi
# end of overwriting check
fi
echo shar: End of shell archive.
exit 0



More information about the Comp.sources.sun mailing list