[comp.sources.bugs] Corrected patches to top v2.1 for Ultrix Decstation

jim@mango.miami.edu (jim brown) (02/27/90)

Here are patches to top v2.1 for an Ultrix Decstation 3100.
The affected files are display.c, top.c, and layout.h.

My original posting of this patch left out a change to top.c.
Here is the original posting with the added line in top.c to define
the macro FIX_TO_DBL.

Jim Brown.

-------------- Clip Here ----------------
*** display.c.orig	Fri Jul 29 15:35:38 1988
--- display.c	Wed Feb 14 19:23:07 1990
***************
*** 13,18 ****
--- 13,19 ----
  
  #include <stdio.h>
  #include <ctype.h>
+ #include <sys/fixpoint.h>
  #include <sys/param.h>
  #include <sys/dir.h>
  #include <sys/user.h>
***************
*** 22,27 ****
--- 23,29 ----
  #endif
  #include <sys/proc.h>
  #include <sys/dk.h>
+ 
  #include "screen.h"		/* interface to screen package */
  #include "layout.h"		/* defines for screen position layout */
  #include "top.h"
***************
*** 63,69 ****
  i_loadave(mpid, avenrun)
  
  int mpid;
! #if defined(sun)
  long *avenrun;
  #else
  double *avenrun;
--- 65,71 ----
  i_loadave(mpid, avenrun)
  
  int mpid;
! #if defined(sun) || defined(mips)
  long *avenrun;
  #else
  double *avenrun;
***************
*** 81,88 ****
--- 83,94 ----
  #if defined(sun)
  	    (double)avenrun[i] / FSCALE);
  #else
+ #if defined(mips)
+ 	    FIX_TO_DBL(avenrun[i]));
+ #else
  	    avenrun[i]);
  #endif
+ #endif
      }
      lmpid = mpid;
  }
***************
*** 90,96 ****
  u_loadave(mpid, avenrun)
  
  int mpid;
! #if defined(sun)
  long *avenrun;
  #else
  double *avenrun;
--- 96,102 ----
  u_loadave(mpid, avenrun)
  
  int mpid;
! #if defined(sun) || defined(mips)
  long *avenrun;
  #else
  double *avenrun;
***************
*** 114,121 ****
--- 120,131 ----
  #if defined(sun)
  	    (double)avenrun[i] / FSCALE);
  #else
+ #if defined(mips)
+ 	    FIX_TO_DBL(avenrun[i]));
+ #else
  	    avenrun[i]);
  #endif
+ #endif
      }
  }
  
***************
*** 234,240 ****
  int i1, i2, i3, i4, i5;
  
  {
!     printf("Memory: %4dK (%4dK) real, %4dK (%4dK) virtual, %4dK free",
  	i1, i2, i3, i4, i5);
  }
  
--- 244,250 ----
  int i1, i2, i3, i4, i5;
  
  {
!     printf("Memory: %5dK (%5dK) real, %5dK (%5dK) virtual, %5dK free",
  	i1, i2, i3, i4, i5);
  }
  
***************
*** 244,254 ****
  
  {
      Move_to(x_realmem, y_mem);
!     printf("%4dK (%4d", i1, i2);
      Move_to(x_virtmem, y_mem);
!     printf("%4dK (%4d", i3, i4);
      Move_to(x_free, y_mem);
!     printf("%4d", i5);
  }
  
  i_header(f2)
--- 254,264 ----
  
  {
      Move_to(x_realmem, y_mem);
!     printf("%5dK (%5d", i1, i2);
      Move_to(x_virtmem, y_mem);
!     printf("%5dK (%5d", i3, i4);
      Move_to(x_free, y_mem);
!     printf("%5d", i5);
  }
  
  i_header(f2)
***************
*** 270,276 ****
--- 280,290 ----
  #if defined(sun)
  #define percent_cpu(pp) ((double)(pp)->p_pctcpu / FSCALE)
  #else
+ #if defined(mips)
+ #define percent_cpu(pp) (FIX_TO_DBL((pp)->p_pctcpu))
+ #else
  #define percent_cpu(pp) ((pp)->p_pctcpu)
+ #endif mips
  #endif sun
  
  #define weighted_cpu(pct, pp) ((pp)->p_time == 0 ? 0.0 : \

*** layout.h.orig	Fri Jul 29 15:35:20 1988
--- layout.h	Wed Feb 14 18:22:12 1990
***************
*** 15,22 ****
  #define  x_brkdn	14
  #define  y_brkdn	1
  #define  x_realmem	8
! #define  x_virtmem	28
! #define  x_free		51
  #define  y_mem		3
  #define  x_header	0
  #define  y_header	5
--- 15,22 ----
  #define  x_brkdn	14
  #define  y_brkdn	1
  #define  x_realmem	8
! #define  x_virtmem	30
! #define  x_free		55
  #define  y_mem		3
  #define  x_header	0
  #define  y_header	5

*** top.c.orig	Mon Feb 26 17:27:51 1990
--- top.c	Wed Feb 14 19:23:03 1990
***************
*** 19,24 ****
--- 19,26 ----
   *  that will run on Sun Unix version 1.1 or later ("sun" is automatically
   *  set by the Sun C compiler).
   *
+  *  The Ultrix MIPS kernel also uses scaled integers for load average.
+  *
   *  The Pyramid splits the stack size (p_ssize) into control stack and user
   *  stack sizes.  Compilation with the preprocessor variable "pyr" gets an
   *  executable that will run on Pyramids ("pyr" is automatically set by the
***************
*** 34,39 ****
--- 36,42 ----
  #include <nlist.h>
  #include <signal.h>
  #include <setjmp.h>
+ #include <sys/fixpoint.h>
  #include <sys/param.h>
  #include <sys/dir.h>
  #include <sys/user.h>
***************
*** 119,125 ****
  long cp_time_offset;
  long total_offset;
  
! #if defined(sun)
  long ccpu;
  long avenrun[3];
  #else
--- 122,128 ----
  long cp_time_offset;
  long total_offset;
  
! #if defined(sun) || defined(mips)
  long ccpu;
  long avenrun[3];
  #else
***************
*** 353,359 ****
--- 356,366 ----
  #if defined(sun)
  	logcpu = log((double)ccpu / FSCALE);
  #else
+ #if defined(mips)
+ 	logcpu = log(FIX_TO_DBL(ccpu));
+ #else
  	logcpu = log(ccpu);
+ #endif
  #endif
  
  	/* allocate space for proc structure array and array of pointers */

??? end of revised patches to top v2.1 ???