src/configfile.c: s/TypesDS/TypesDB/;
[collectd.git] / src / plugin.c
index c927522..495e169 100644 (file)
@@ -118,10 +118,10 @@ static int plugin_unregister (llist_t *list, const char *name)
  * object, but it will bitch about a shared object not having a
  * ``module_register'' symbol..
  */
-static int plugin_load_file (char *file, modreg_e load)
+static int plugin_load_file (char *file)
 {
        lt_dlhandle dlh;
-       void (*reg_handle) (modreg_e mr);
+       void (*reg_handle) (void);
 
        DEBUG ("file = %s", file);
 
@@ -137,7 +137,7 @@ static int plugin_load_file (char *file, modreg_e load)
                return (1);
        }
 
-       if ((reg_handle = (void (*) (modreg_e)) lt_dlsym (dlh, "module_register")) == NULL)
+       if ((reg_handle = (void (*) (void)) lt_dlsym (dlh, "module_register")) == NULL)
        {
                WARNING ("Couldn't find symbol ``module_register'' in ``%s'': %s\n",
                                file, lt_dlerror ());
@@ -145,7 +145,7 @@ static int plugin_load_file (char *file, modreg_e load)
                return (-1);
        }
 
-       (*reg_handle) (load);
+       (*reg_handle) ();
 
        return (0);
 }
@@ -186,6 +186,8 @@ static void *plugin_read_thread (void *args)
 
                        if (status != 0)
                        {
+                               if (rf->wait_time < interval_g)
+                                       rf->wait_time = interval_g;
                                rf->wait_left = rf->wait_time;
                                rf->wait_time = rf->wait_time * 2;
                                if (rf->wait_time > 86400)
@@ -291,7 +293,7 @@ void plugin_set_dir (const char *dir)
 }
 
 #define BUFSIZE 512
-int plugin_load (const char *type, modreg_e mr)
+int plugin_load (const char *type)
 {
        DIR  *dh;
        const char *dir;
@@ -348,7 +350,7 @@ int plugin_load (const char *type, modreg_e mr)
                        continue;
                }
 
-               if (plugin_load_file (filename, mr) == 0)
+               if (plugin_load_file (filename) == 0)
                {
                        /* success */
                        ret = 0;
@@ -500,8 +502,9 @@ void plugin_init_all (void)
                {
                        ERROR ("Initialization of plugin `%s' "
                                        "failed with status %i. "
-                                       "Plugin will be unloaded. TODO!",
+                                       "Plugin will be unloaded.",
                                        le->key, status);
+                       /* FIXME: Unload _all_ functions */
                        plugin_unregister_read (le->key);
                }