Subject: Re: pkg/35806: sysutils/top gcc 4.1.2
To: None <agc@NetBSD.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org,>
From: john heasley <heas@shrubbery.net>
List: pkgsrc-bugs
Date: 02/25/2007 22:15:06
The following reply was made to PR pkg/35806; it has been noted by GNATS.

From: john heasley <heas@shrubbery.net>
To: Alistair Crooks <agc@pkgsrc.org>
Cc: gnats-bugs@NetBSD.org, gnats-admin@NetBSD.org,
	pkgsrc-bugs@NetBSD.org, Gilles Dauphin <dauphin@enst.fr>
Subject: Re: pkg/35806: sysutils/top gcc 4.1.2
Date: Sun, 25 Feb 2007 14:12:15 -0800

 --/04w6evG8XlLl3ft
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 Sun, Feb 25, 2007 at 11:31:35AM +0000, Alistair Crooks:
 > AFAICT, the patch in the PR isn't in pkgsrc.
 > 
 > Can someone tell me what the status is?
 > 
 > (I have no Solaris machines easily to hand, I'm afraid)
 
 That does not apply to top 3.6a7 cleanly (the attached does).  it does
 build on solaris 10-sparc, though the configure script is adding -xarch=v9
 which gcc does not like.  
 
 --/04w6evG8XlLl3ft
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename=patch-ao
 
 $NetBSD$
 
 --- machine/m_sunos5.c.orig	2004-03-31 04:01:00.000000000 +0000
 +++ machine/m_sunos5.c
 @@ -292,7 +292,7 @@ int (*proc_compares[])() = {
  kvm_t *kd;
  static DIR *procdir;
  static int nproc;
 -static int ncpus;
 +static int lv_ncpus;
  
  /* these are for keeping track of the proc array */
  static int bytes;
 @@ -425,11 +425,11 @@ machine_init (struct statics *statics)
  
  
  #ifndef USE_KSTAT
 -    (void) getkval (nlst[X_NCPUS].n_value, (int *) (&ncpus),
 -		    sizeof (ncpus), "ncpus");
 +    (void) getkval (nlst[X_NCPUS].n_value, (int *) (&lv_ncpus),
 +		    sizeof (lv_ncpus), "ncpus");
  
 -    cpu_offset = (unsigned long *) malloc (ncpus * sizeof (unsigned long));
 -    for (i = offset = 0; i < ncpus; offset += sizeof(unsigned long)) {
 +    cpu_offset = (unsigned long *) malloc (lv_ncpus * sizeof (unsigned long));
 +    for (i = offset = 0; i < lv_ncpus; offset += sizeof(unsigned long)) {
          (void) getkval (nlst[X_CPU].n_value + offset,
                          &cpu_offset[i], sizeof (unsigned long),
                          nlst[X_CPU].n_name );
 @@ -583,11 +583,11 @@ int kupdate(int avenrun[3])
  	ncpu = 0;
  
  	kn = kstat_data_lookup(ks, "ncpus");
 -	if (kn && kn->value.ui32 > ncpus) {
 -	    ncpus = kn->value.ui32;
 -	    cpu_ks = (kstat_t **) realloc (cpu_ks, ncpus * sizeof (kstat_t *));
 +	if (kn && kn->value.ui32 > lv_ncpus) {
 +	    lv_ncpus = kn->value.ui32;
 +	    cpu_ks = (kstat_t **) realloc (cpu_ks, lv_ncpus * sizeof (kstat_t *));
  	    cpu_stat = (cpu_stat_t *) realloc (cpu_stat,
 -			ncpus * sizeof (cpu_stat_t));
 +			lv_ncpus * sizeof (cpu_stat_t));
  	}
  
  	for (ks = kc->kc_chain; ks; 
 @@ -601,15 +601,15 @@ int kupdate(int avenrun[3])
  
  		cpu_ks[ncpu] = ks;
  		ncpu++;
 -		if (ncpu > ncpus)
 +		if (ncpu > lv_ncpus)
  		{
  		    fprintf(stderr, "kstat finds too many cpus: should be %d\n",
 -			    ncpus);
 +			    lv_ncpus);
  		    quit(1);
  		}
  	    }
  	}
 -	/* note that ncpu could be less than ncpus, but that's okay */
 +	/* note that ncpu could be less than lv_ncpus, but that's okay */
  	changed = 0;
      }
  
 @@ -699,7 +699,7 @@ get_system_info (struct system_info *si)
  
  #else /* !USE_KSTAT */
  
 -  for (i = 0; i < ncpus; i++)
 +  for (i = 0; i < lv_ncpus; i++)
      if (cpu_offset[i] != 0)
      {
        /* get struct cpu for this processor */
 @@ -877,7 +877,7 @@ format_next_process (
    cputime = pp->pr_time.tv_sec;
    pctcpu = percent_cpu (pp);
  
 -  if (pp->pr_state == SONPROC && ncpus > 1)
 +  if (pp->pr_state == SONPROC && lv_ncpus > 1)
      sprintf(sb,"cpu/%-2d", pp->pr_onpro); /* XXX large #s may overflow colums */
    else
      *sb = '\0';
 
 --/04w6evG8XlLl3ft--