pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/35806: sysutils/top gcc 4.1.2



>Number:         35806
>Category:       pkg
>Synopsis:       sysutils/top gcc 4.1.2
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Feb 23 10:10:00 +0000 2007
>Originator:     Gilles Dauphin
>Release:        SunOS 5.10 i86pc
>Organization:
ENST 
>Environment:


System: SunOS bi.enst.fr 5.10 Generic_118855-19 i86pc


>Description:


gcc -DHAVE_CONFIG_H -I. -I. -O -m64  -c ./machine/m_sunos5.c
./machine/m_sunos5.c:295: error: static declaration of 'ncpus' follows 
non-static declaration
/usr/include/sys/cpuvar.h:456: error: previous declaration of 'ncpus' was here




>How-To-Repeat:


bmake


>Fix:


--- machine/m_sunos5.c.orig     Wed Mar 31 06:01:00 2004
+++ machine/m_sunos5.c  Fri Feb 23 11:07:08 2007
@@ -292,7 +292,7 @@
 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 @@
 
 
 #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 @@
        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 @@
 
                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 @@
 
 #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 @@
   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';






Home | Main Index | Thread Index | Old Index