Subject: Re: top for Solaris 2.3

From: [email-masked] (Andy Polyakov)
Date: Fri, 28 Jan 1994 19:50:06 GMT

People wrote:
>: -> 	Top version 3.2 works fine.
>: 
>: 	But not for a multi-processor machine.  
>Does anybody out there know where I can get a MP version ?

Try following patch for top-3.3beta:

*** machine/m_sunos5.c.orig	Thu Dec 23 12:43:52 1993
--- machine/m_sunos5.c	Thu Dec 23 17:49:15 1993
***************
*** 242,250 ****
--- 242,264 ----
  
      (void) getkval (nlst[X_NCPUS].n_value, (int *) (&ncpus),
  		    sizeof (ncpus), "ncpus");
+ #ifdef SINGLECPU
      cpu_offset = (unsigned long *) malloc (ncpus * sizeof (unsigned long));
      (void) getkval (nlst[X_CPU].n_value, cpu_offset,
  		    ncpus * sizeof (unsigned long), nlst[X_CPU].n_name);
+ #else
+ #ifndef MAXCPU
+ #define MAXCPU 16
+ #endif
+     cpu_offset = (unsigned long *) malloc (MAXCPU * sizeof (unsigned long));
+     memset (cpu_offset, 0, MAXCPU * sizeof (unsigned long));
+     (void) getkval (nlst[X_CPU].n_value, cpu_offset,
+                     MAXCPU * sizeof (unsigned long), nlst[X_CPU].n_name);
+     { int i,n;
+         for (i=0,n=0;i<MAXCPU && n<ncpus;i++)
+             if (cpu_offset[i]) cpu_offset[n++] = cpu_offset[i];
+     }    
+ #endif
  
      /* allocate space for proc structure array and array of pointers */
      bytes = nproc * PRPSINFOSIZE;

=========================================================================
Andy Polyakov,	System Manager
-------------------------------------------------------------------------
E-Mail:	[email-masked]	| Mail:	Fysikgrand 3
				|	Chalmers University of Technology
Phone:	+46(31)7723301		|	S-412 96 Goteborg
FAX:	+46(31)165176		|	Sweden
-------------------------------------------------------------------------