Re: Compile trouble with 5.4pre3

"Dave Shield" <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
On 05/10/06, Dave Shield <[email protected]> wrote:
> Please try applying the following patch to cpu.c and cpu_kstat.c

<Sigh>
Please try applying the following patch, which is actually included this time!

You just can't get the staff these days.....

Dave

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
cpu.diff (application/octet-stream, 2.1 KB)
--- cpu.c	2006-08-26 15:31:13.000000000 +0100
+++ cpu.c2	2006-10-05 10:46:37.976400000 +0100
@@ -55,19 +55,27 @@
         /*
          * Find the specified CPU entry
          */
+    DEBUGMSGTL(("cpu", "cpu_get_byIdx %d ", idx));
     for ( cpu=_cpu_head; cpu; cpu=cpu->next ) {
-        if ( cpu->idx == idx )
+        if ( cpu->idx == idx ) {
+            DEBUGMSG(("cpu", "(found)\n"));
             return cpu;
+        }
     }
-    if (!create)
+    if (!create) {
+        DEBUGMSG(("cpu", "(not found)\n"));
         return NULL;
+    }
 
         /*
          * Create a new CPU entry, and insert it into the list....
          */
     cpu = SNMP_MALLOC_TYPEDEF( netsnmp_cpu_info );
-    if (!cpu)
+    if (!cpu) {
         return NULL;
+        DEBUGMSG(("cpu", "(failed)\n"));
+    }
+    DEBUGMSG(("cpu", "(created)\n"));
     cpu->idx = idx;
         /* ... either as the first (or only) entry....  */
     if ( !_cpu_head || _cpu_head->idx > idx ) {
--- cpu_kstat.c	2006-10-04 20:24:28.000000000 +0100
+++ cpu_kstat.c2	2006-10-05 10:46:42.666295000 +0100
@@ -34,6 +34,7 @@
         kstat_fd = kstat_open();
     kstat_chain_update( kstat_fd );
 
+    DEBUGMSGTL(("cpu", "cpu_kstat init\n "));
     for (ksp = kstat_fd->kc_chain; ksp != NULL; ksp = ksp->ks_next) {
         if (ksp->ks_flags & KSTAT_FLAG_INVALID)
             continue;
@@ -95,14 +96,17 @@
     cpu->nCtxSwitches = 0;
 
     kstat_chain_update( kstat_fd );
+    DEBUGMSGTL(("cpu", "cpu_kstat load\n "));
     for (ksp = kstat_fd->kc_chain; ksp != NULL; ksp = ksp->ks_next) {
         if (ksp->ks_flags & KSTAT_FLAG_INVALID)
             continue;
         if (strcmp(ksp->ks_module, "cpu_stat") == 0) {
-            cpu2 = netsnmp_cpu_get_byIdx( i++, 0 );
+            i    = ksp->ks_instance;
+            cpu2 = netsnmp_cpu_get_byIdx( i, 0 );
             if ((ksp->ks_type != KSTAT_TYPE_RAW) ||
                 (ksp->ks_data_size != sizeof(cs))||
                 (kstat_read(kstat_fd, ksp, &cs) == -1)) {
+                DEBUGMSGTL(("cpu", "cpu_kstat load failed (%d)\n ", i));
                 break;   /* or continue ? */
             }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.