Martin,

Here's the "diff -u " output of the original solaris.c and my updated 
solaris.c.  This is an odd scenario, but it could come up in certain 
environments (....like mine).

Thanks.
-Mike

--- ../2.6.0_0322/ganglia-2.6.0/gmond/machines/solaris.c        Mon Feb 23 
18:27:17 2004
+++ ./machine.c.final   Fri Apr  2 12:28:30 2004
@@ -1,7 +1,7 @@
 #include "lib/interface.h"
 #include "lib/ganglia.h"
 #include "metric_typedefs.h"
-#include "debug_msg.h"
+#include "lib/debug_msg.h"

 /* This is file is an amended version of solaris.c included in ganglia 2.5.4
  * and ganglia 2.5.5. It has been modified by Adeyemi Adesanya
@@ -227,6 +227,27 @@
    debug_msg( "%s: kc is %p", name, kc);
    ks = kstat_lookup(kc, km_name, 0, ks_name);
    debug_msg("%s: Just did kstat_lookup().",name);
+
+   /* CPU_INFO module & instance check
+    * If the first online CPU is not in slot #0, gmond will segfault and core 
dump.
+    * If ks == NULL, then traverse the cpu instance #'s until the first online 
cpu is found.
+    * After the traversal, if ks == NULL, then something is very wrong with 
the cpu configuration.
+    */
+   if ((km_name == "cpu_info") && (ks == NULL))  {
+         int instance_num = 1;
+         int num_tries = 0;
+         while ((num_tries < (int)metriclist.cpu_num.uint32) && (ks == NULL)) {
+             char *new_ks_name = (char *)malloc(20*sizeof(char));
+             sprintf(new_ks_name, "cpu_info%d", instance_num);
+             debug_msg( "Lookup up kstat:  km (unix?)='%s', ks 
(system_misc?)='%s',kn (resulting metric?)='%s'", km_name, new_ks_name, name);
+             ks = kstat_lookup(kc, km_name, instance_num, new_ks_name);
+             debug_msg("%s: Just did kstat_lookup().\n",new_ks_name);
+             ++instance_num;
+             ++num_tries;
+             free(new_ks_name);
+         }
+   }
+
    if (ks == NULL)
       {
       perror("ks");





                                                                                
                                                 
                      Martin Knoblauch                                          
                                                 
                      <[EMAIL PROTECTED]        To:       Michael 
Hom/NewYork/DBNA/[EMAIL PROTECTED]                                     
                      de>                      cc:       [EMAIL PROTECTED], 
ganglia-developers@lists.sourceforge.net               
                                               Subject:  Re: 
[Ganglia-developers] 2.6.0 -Solaris kstat cpu_info                  
                      04/03/2004 02:41                                          
                                                 
                      AM                                                        
                                                 
                      Please respond to                                         
                                                 
                      knobi                                                     
                                                 
                                                                                
                                                 
                                                                                
                                                 




Michael,

 could you please post a "diff -u" style patch, so that I can apply it
automatically (alternatively just send me your version of solaris.c).

 Robert: could you have a look at the change for sanity/correctness?
Apparently your previous fix did not take into account the case that
CPU #0 is missing. Unfortunatelly I have no box to test those cases
out.

Cheers
Martin


=====
------------------------------------------------------
Martin Knoblauch
email: k n o b i AT knobisoft DOT de
www:   http://www.knobisoft.de





--

This e-mail may contain confidential and/or privileged information. If you are 
not the intended recipient (or have received this e-mail in error) please 
notify the sender immediately and destroy this e-mail. Any unauthorized 
copying, disclosure or distribution of the material in this e-mail is strictly 
forbidden.



Reply via email to