Print this page
NEX-18699 libfmd_snmp needs to prevent double loading
Reviewed by: Joyce McIntosh <joyce.mcintosh@nexenta.com>
Reviewed by: Cynthia Eastham <cynthia.eastham@nexenta.com>
NEX-17796 libfmd_snmp performance is awful
Reviewed by: Cynthia Eastham <cynthia.eastham@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>
        
@@ -35,11 +35,10 @@
 
 static const sunFm_table_t sun_fm_tables[] = {
         TABLE_REG(sunFmModuleTable),
         TABLE_REG(sunFmResourceTable),
         TABLE_REG(sunFmProblemTable),
-        TABLE_REG(sunFmFaultEventTable),
         TABLE_NULL
 };
 
 /*
  * This is our entry point for initialization by the agent, which
@@ -47,13 +46,17 @@
  * by the agent API.
  */
 int
 init_sunFM(void)
 {
+        static int              once = 0;
         int                     max_err = MIB_REGISTERED_OK;
         const sunFm_table_t     *table;
 
+        if (once != 0)
+                return (MIB_DUPLICATE_REGISTRATION);
+
         for (table = sun_fm_tables; table->t_name != NULL; table++) {
                 int err = table->t_init();
 
                 switch (err) {
                 case MIB_REGISTERED_OK:
@@ -78,7 +81,8 @@
 
                 if (err > max_err)
                         max_err = err;
         }
 
+        once = 1;
         return (max_err);
 }