[collectd] [PATCH] Added support to statically link collectd.
Sebastian Harl
sh at tokkee.org
Tue Jun 17 22:50:05 CEST 2008
The following changes were required to implement that:
* Prepend the plugin name to the module_register functions of all plugins
when doing a static build: <plugin_name>_module_register.
This has been implemented by introducing the macro MODULE_REGISTER() which
takes the plugin name as a single argument and defines the module_register
function appropriately. That macro is now used in all plugins to define the
module_register function.
* Implement another versions of plugin_load() which handles the static case.
The new version uses lt_dlsym() to get the appropriate module_register
function by name from the program object file.
This has been requested by Jesse Dutton.
Signed-off-by: Sebastian Harl <sh at tokkee.org>
---
configure.in | 6 +++++
contrib/examples/myplugin.c | 2 +-
src/apache.c | 2 +-
src/apcups.c | 2 +-
src/apple_sensors.c | 2 +-
src/ascent.c | 2 +-
src/battery.c | 2 +-
src/cpu.c | 2 +-
src/cpufreq.c | 2 +-
src/csv.c | 2 +-
src/df.c | 2 +-
src/disk.c | 2 +-
src/dns.c | 2 +-
src/email.c | 2 +-
src/entropy.c | 2 +-
src/exec.c | 2 +-
src/hddtemp.c | 2 +-
src/interface.c | 2 +-
src/ipmi.c | 2 +-
src/iptables.c | 2 +-
src/ipvs.c | 2 +-
src/irq.c | 2 +-
src/libvirt.c | 3 +-
src/load.c | 2 +-
src/logfile.c | 2 +-
src/mbmon.c | 2 +-
src/memcached.c | 2 +-
src/memory.c | 2 +-
src/multimeter.c | 2 +-
src/mysql.c | 2 +-
src/netlink.c | 2 +-
src/network.c | 2 +-
src/nfs.c | 2 +-
src/nginx.c | 2 +-
src/notify_desktop.c | 2 +-
src/notify_email.c | 2 +-
src/ntpd.c | 2 +-
src/nut.c | 2 +-
src/perl.c | 2 +-
src/ping.c | 2 +-
src/plugin.c | 44 ++++++++++++++++++++++++++++++++++++++++++-
src/plugin.h | 6 +++++
src/powerdns.c | 2 +-
src/processes.c | 2 +-
src/rrdtool.c | 2 +-
src/sensors.c | 2 +-
src/serial.c | 2 +-
src/snmp.c | 2 +-
src/swap.c | 2 +-
src/syslog.c | 2 +-
src/tail.c | 2 +-
src/tape.c | 2 +-
src/tcpconns.c | 2 +-
src/teamspeak2.c | 2 +-
src/thermal.c | 2 +-
src/unixsock.c | 2 +-
src/users.c | 2 +-
src/uuid.c | 2 +-
src/vmem.c | 2 +-
src/vserver.c | 2 +-
src/wireless.c | 2 +-
src/xmms.c | 2 +-
62 files changed, 114 insertions(+), 61 deletions(-)
diff --git a/configure.in b/configure.in
index dd4787c..7aacf51 100644
--- a/configure.in
+++ b/configure.in
@@ -2565,6 +2565,11 @@ AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
+if test "x$enable_static" = "xyes"; then
+ AC_DEFINE([BUILD_STATIC], 1,
+ [True if we're building a static version of collectd])
+fi
+
dnl ip_vs.h
if test "x$ac_system" = "xLinux" \
&& test "x$have_net_ip_vs_h$have_ip_vs_h" = "xnono"
@@ -2663,6 +2668,7 @@ Configuration:
libxmms . . . . . . . $with_libxmms
Features:
+ static build . . . . $enable_static
daemon mode . . . . . $enable_daemon
debug . . . . . . . . $enable_debug
diff --git a/contrib/examples/myplugin.c b/contrib/examples/myplugin.c
index cdd537a..9f6b571 100644
--- a/contrib/examples/myplugin.c
+++ b/contrib/examples/myplugin.c
@@ -201,7 +201,7 @@ static int my_shutdown (void)
* This function is called after loading the plugin to register it with
* collectd.
*/
-void module_register (void)
+MODULE_REGISTER (myplugin)
{
plugin_register_log ("myplugin", my_log);
plugin_register_notification ("myplugin", my_notify);
diff --git a/src/apache.c b/src/apache.c
index 7667f24..25de9bb 100644
--- a/src/apache.c
+++ b/src/apache.c
@@ -349,7 +349,7 @@ static int apache_read (void)
return (0);
} /* int apache_read */
-void module_register (void)
+MODULE_REGISTER (apache)
{
plugin_register_config ("apache", config,
config_keys, config_keys_num);
diff --git a/src/apcups.c b/src/apcups.c
index fb48109..dec22aa 100644
--- a/src/apcups.c
+++ b/src/apcups.c
@@ -431,7 +431,7 @@ static int apcups_read (void)
return (0);
} /* apcups_read */
-void module_register (void)
+MODULE_REGISTER (apcups)
{
plugin_register_config ("apcups", apcups_config, config_keys,
config_keys_num);
diff --git a/src/apple_sensors.c b/src/apple_sensors.c
index ee0bf8c..9514cf2 100644
--- a/src/apple_sensors.c
+++ b/src/apple_sensors.c
@@ -233,7 +233,7 @@ static int as_read (void)
return (0);
} /* int as_read */
-void module_register (void)
+MODULE_REGISTER (apple_sensors)
{
plugin_register_init ("apple_sensors", as_init);
plugin_register_read ("apple_sensors", as_read);
diff --git a/src/ascent.c b/src/ascent.c
index c443d38..6d4f7c1 100644
--- a/src/ascent.c
+++ b/src/ascent.c
@@ -605,7 +605,7 @@ static int ascent_read (void) /* {{{ */
return (0);
} /* }}} int ascent_read */
-void module_register (void)
+MODULE_REGISTER (ascent)
{
plugin_register_config ("ascent", ascent_config, config_keys, config_keys_num);
plugin_register_init ("ascent", ascent_init);
diff --git a/src/battery.c b/src/battery.c
index f8e67a4..8856c5f 100644
--- a/src/battery.c
+++ b/src/battery.c
@@ -522,7 +522,7 @@ static int battery_read (void)
return (0);
}
-void module_register (void)
+MODULE_REGISTER (battery)
{
plugin_register_init ("battery", battery_init);
plugin_register_read ("battery", battery_read);
diff --git a/src/cpu.c b/src/cpu.c
index 7773dc4..888db36 100644
--- a/src/cpu.c
+++ b/src/cpu.c
@@ -406,7 +406,7 @@ static int cpu_read (void)
return (0);
}
-void module_register (void)
+MODULE_REGISTER (cpu)
{
plugin_register_init ("cpu", init);
plugin_register_read ("cpu", cpu_read);
diff --git a/src/cpufreq.c b/src/cpufreq.c
index f4424e6..1187a59 100644
--- a/src/cpufreq.c
+++ b/src/cpufreq.c
@@ -131,7 +131,7 @@ static int cpufreq_read (void)
return (0);
} /* int cpufreq_read */
-void module_register (void)
+MODULE_REGISTER (cpufreq)
{
plugin_register_init ("cpufreq", cpufreq_init);
plugin_register_read ("cpufreq", cpufreq_read);
diff --git a/src/csv.c b/src/csv.c
index a94b700..18ec202 100644
--- a/src/csv.c
+++ b/src/csv.c
@@ -318,7 +318,7 @@ static int csv_write (const data_set_t *ds, const value_list_t *vl)
return (0);
} /* int csv_write */
-void module_register (void)
+MODULE_REGISTER (csv)
{
plugin_register_config ("csv", csv_config,
config_keys, config_keys_num);
diff --git a/src/df.c b/src/df.c
index 284472b..a9c8e83 100644
--- a/src/df.c
+++ b/src/df.c
@@ -206,7 +206,7 @@ static int df_read (void)
return (0);
} /* int df_read */
-void module_register (void)
+MODULE_REGISTER (df)
{
plugin_register_config ("df", df_config,
config_keys, config_keys_num);
diff --git a/src/disk.c b/src/disk.c
index a6f850a..785e655 100644
--- a/src/disk.c
+++ b/src/disk.c
@@ -689,7 +689,7 @@ static int disk_read (void)
return (0);
} /* int disk_read */
-void module_register (void)
+MODULE_REGISTER (disk)
{
plugin_register_config ("disk", disk_config,
config_keys, config_keys_num);
diff --git a/src/dns.c b/src/dns.c
index c315eab..e741b8b 100644
--- a/src/dns.c
+++ b/src/dns.c
@@ -393,7 +393,7 @@ static int dns_read (void)
return (0);
} /* int dns_read */
-void module_register (void)
+MODULE_REGISTER (dns)
{
plugin_register_config ("dns", dns_config, config_keys, config_keys_num);
plugin_register_init ("dns", dns_init);
diff --git a/src/email.c b/src/email.c
index fbdc785..2dfd8dd 100644
--- a/src/email.c
+++ b/src/email.c
@@ -761,7 +761,7 @@ static int email_read (void)
return (0);
} /* int email_read */
-void module_register (void)
+MODULE_REGISTER (email)
{
plugin_register_config ("email", email_config, config_keys, config_keys_num);
plugin_register_init ("email", email_init);
diff --git a/src/entropy.c b/src/entropy.c
index 85d41cf..03cb2ca 100644
--- a/src/entropy.c
+++ b/src/entropy.c
@@ -73,7 +73,7 @@ static int entropy_read (void)
return (0);
}
-void module_register (void)
+MODULE_REGISTER (entropy)
{
plugin_register_read ("entropy", entropy_read);
} /* void module_register */
diff --git a/src/exec.c b/src/exec.c
index 6b6836e..78f48ff 100644
--- a/src/exec.c
+++ b/src/exec.c
@@ -828,7 +828,7 @@ static int exec_shutdown (void) /* {{{ */
return (0);
} /* int exec_shutdown }}} */
-void module_register (void)
+MODULE_REGISTER (exec)
{
plugin_register_complex_config ("exec", exec_config);
plugin_register_init ("exec", exec_init);
diff --git a/src/hddtemp.c b/src/hddtemp.c
index a9c0941..956ffb9 100644
--- a/src/hddtemp.c
+++ b/src/hddtemp.c
@@ -521,7 +521,7 @@ static int hddtemp_read (void)
/* module_register
Register collectd plugin. */
-void module_register (void)
+MODULE_REGISTER (hddtemp)
{
plugin_register_config ("hddtemp", hddtemp_config,
config_keys, config_keys_num);
diff --git a/src/interface.c b/src/interface.c
index ff4a0aa..974167e 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -354,7 +354,7 @@ static int interface_read (void)
return (0);
} /* int interface_read */
-void module_register (void)
+MODULE_REGISTER (interface)
{
plugin_register_config ("interface", interface_config,
config_keys, config_keys_num);
diff --git a/src/ipmi.c b/src/ipmi.c
index 7a00c88..4f7228e 100644
--- a/src/ipmi.c
+++ b/src/ipmi.c
@@ -543,7 +543,7 @@ static int c_ipmi_shutdown (void)
return (0);
} /* int c_ipmi_shutdown */
-void module_register (void)
+MODULE_REGISTER (ipmi)
{
plugin_register_config ("ipmi", c_ipmi_config,
config_keys, config_keys_num);
diff --git a/src/iptables.c b/src/iptables.c
index dc69f6b..4d8d4f0 100644
--- a/src/iptables.c
+++ b/src/iptables.c
@@ -333,7 +333,7 @@ static int iptables_shutdown (void)
return (0);
} /* int iptables_shutdown */
-void module_register (void)
+MODULE_REGISTER (iptables)
{
plugin_register_config ("iptables", iptables_config,
config_keys, config_keys_num);
diff --git a/src/ipvs.c b/src/ipvs.c
index a64e7b7..ffcef2e 100644
--- a/src/ipvs.c
+++ b/src/ipvs.c
@@ -339,7 +339,7 @@ static int cipvs_shutdown (void)
return 0;
} /* cipvs_shutdown */
-void module_register (void)
+MODULE_REGISTER (ipvs)
{
plugin_register_init ("ipvs", cipvs_init);
plugin_register_read ("ipvs", cipvs_read);
diff --git a/src/irq.c b/src/irq.c
index 792ac34..3d1324b 100644
--- a/src/irq.c
+++ b/src/irq.c
@@ -198,7 +198,7 @@ static int irq_read (void)
return (0);
} /* int irq_read */
-void module_register (void)
+MODULE_REGISTER (irq)
{
plugin_register_config ("irq", irq_config,
config_keys, config_keys_num);
diff --git a/src/libvirt.c b/src/libvirt.c
index 370e794..c41bad2 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -772,8 +772,7 @@ lv_shutdown (void)
return 0;
}
-void
-module_register (void)
+MODULE_REGISTER (libvirt)
{
plugin_register_config ("libvirt",
lv_config,
diff --git a/src/load.c b/src/load.c
index 7d11b98..036051f 100644
--- a/src/load.c
+++ b/src/load.c
@@ -138,7 +138,7 @@ static int load_read (void)
return (0);
}
-void module_register (void)
+MODULE_REGISTER (load)
{
plugin_register_read ("load", load_read);
} /* void module_register */
diff --git a/src/logfile.c b/src/logfile.c
index 382386b..7fa1e68 100644
--- a/src/logfile.c
+++ b/src/logfile.c
@@ -190,7 +190,7 @@ static int logfile_notification (const notification_t *n)
return (0);
} /* int logfile_notification */
-void module_register (void)
+MODULE_REGISTER (logfile)
{
plugin_register_config ("logfile", logfile_config,
config_keys, config_keys_num);
diff --git a/src/mbmon.c b/src/mbmon.c
index 923118f..9c9cf0a 100644
--- a/src/mbmon.c
+++ b/src/mbmon.c
@@ -306,7 +306,7 @@ static int mbmon_read (void)
/* module_register
Register collectd plugin. */
-void module_register (void)
+MODULE_REGISTER (mbmon)
{
plugin_register_config ("mbmon", mbmon_config, config_keys, config_keys_num);
plugin_register_read ("mbmon", mbmon_read);
diff --git a/src/memcached.c b/src/memcached.c
index ca93102..95a10ea 100644
--- a/src/memcached.c
+++ b/src/memcached.c
@@ -462,7 +462,7 @@ static int memcached_read (void) /* {{{ */
}
/* }}} */
-void module_register (void) /* {{{ */
+MODULE_REGISTER (memcached) /* {{{ */
{
plugin_register_config ("memcached", memcached_config, config_keys, config_keys_num);
plugin_register_read ("memcached", memcached_read);
diff --git a/src/memory.c b/src/memory.c
index b56fc5a..e315744 100644
--- a/src/memory.c
+++ b/src/memory.c
@@ -327,7 +327,7 @@ static int memory_read (void)
return (0);
}
-void module_register (void)
+MODULE_REGISTER (memory)
{
plugin_register_init ("memory", memory_init);
plugin_register_read ("memory", memory_read);
diff --git a/src/multimeter.c b/src/multimeter.c
index e09d9f9..9e1dc97 100644
--- a/src/multimeter.c
+++ b/src/multimeter.c
@@ -248,7 +248,7 @@ static int multimeter_shutdown (void)
return (0);
}
-void module_register (void)
+MODULE_REGISTER (multimeter)
{
plugin_register_init ("multimeter", multimeter_init);
plugin_register_read ("multimeter", multimeter_read);
diff --git a/src/mysql.c b/src/mysql.c
index 444acaa..ef85500 100644
--- a/src/mysql.c
+++ b/src/mysql.c
@@ -320,7 +320,7 @@ static int mysql_read (void)
return (0);
} /* int mysql_read */
-void module_register (void)
+MODULE_REGISTER (mysql)
{
plugin_register_config ("mysql", config, config_keys, config_keys_num);
plugin_register_read ("mysql", mysql_read);
diff --git a/src/netlink.c b/src/netlink.c
index d621da5..0b771cf 100644
--- a/src/netlink.c
+++ b/src/netlink.c
@@ -634,7 +634,7 @@ static int ir_shutdown (void)
return (0);
} /* int ir_shutdown */
-void module_register (void)
+MODULE_REGISTER (netlink)
{
plugin_register_config ("netlink", ir_config, config_keys, config_keys_num);
plugin_register_init ("netlink", ir_init);
diff --git a/src/network.c b/src/network.c
index b6778fa..98d81a1 100644
--- a/src/network.c
+++ b/src/network.c
@@ -1787,7 +1787,7 @@ static int network_flush (int timeout, const char *identifier)
return (0);
} /* int network_flush */
-void module_register (void)
+MODULE_REGISTER (network)
{
plugin_register_config ("network", network_config,
config_keys, config_keys_num);
diff --git a/src/nfs.c b/src/nfs.c
index 34f01f4..d47c394 100644
--- a/src/nfs.c
+++ b/src/nfs.c
@@ -357,7 +357,7 @@ static int nfs_read (void)
return (0);
}
-void module_register (void)
+MODULE_REGISTER (nfs)
{
plugin_register_read ("nfs", nfs_read);
} /* void module_register */
diff --git a/src/nginx.c b/src/nginx.c
index 4de59f3..8d98c20 100644
--- a/src/nginx.c
+++ b/src/nginx.c
@@ -265,7 +265,7 @@ static int nginx_read (void)
return (0);
} /* int nginx_read */
-void module_register (void)
+MODULE_REGISTER (nginx)
{
plugin_register_config ("nginx", config, config_keys, config_keys_num);
plugin_register_init ("nginx", init);
diff --git a/src/notify_desktop.c b/src/notify_desktop.c
index 2e62e88..935ea51 100644
--- a/src/notify_desktop.c
+++ b/src/notify_desktop.c
@@ -150,7 +150,7 @@ static int c_notify_init (void)
return 0;
} /* c_notify_init */
-void module_register (void)
+MODULE_REGISTER (notify_desktop)
{
plugin_register_complex_config ("notify_desktop", c_notify_config);
plugin_register_init ("notify_desktop", c_notify_init);
diff --git a/src/notify_email.c b/src/notify_email.c
index dc4e47f..401c442 100644
--- a/src/notify_email.c
+++ b/src/notify_email.c
@@ -275,7 +275,7 @@ static int notify_email_notification (const notification_t *n)
return (0);
} /* int notify_email_notification */
-void module_register (void)
+MODULE_REGISTER (notify_email)
{
plugin_register_init ("notify_email", notify_email_init);
plugin_register_shutdown ("notify_email", notify_email_shutdown);
diff --git a/src/ntpd.c b/src/ntpd.c
index 9475ac9..947585e 100644
--- a/src/ntpd.c
+++ b/src/ntpd.c
@@ -966,7 +966,7 @@ static int ntpd_read (void)
return (0);
} /* int ntpd_read */
-void module_register (void)
+MODULE_REGISTER (ntpd)
{
plugin_register_config ("ntpd", ntpd_config,
config_keys, config_keys_num);
diff --git a/src/nut.c b/src/nut.c
index 75504d4..ff75d15 100644
--- a/src/nut.c
+++ b/src/nut.c
@@ -283,7 +283,7 @@ static int nut_shutdown (void)
return (0);
} /* int nut_shutdown */
-void module_register (void)
+MODULE_REGISTER (nut)
{
plugin_register_config ("nut", nut_config, config_keys, config_keys_num);
plugin_register_read ("nut", nut_read);
diff --git a/src/perl.c b/src/perl.c
index 3a56da6..96d8ddd 100644
--- a/src/perl.c
+++ b/src/perl.c
@@ -1674,7 +1674,7 @@ static int perl_config (oconfig_item_t *ci)
return 0;
} /* static int perl_config (oconfig_item_t *) */
-void module_register (void)
+MODULE_REGISTER (perl)
{
perl_argc = 4;
perl_argv = (char **)smalloc ((perl_argc + 1) * sizeof (char *));
diff --git a/src/ping.c b/src/ping.c
index 20388c3..f2a9c3e 100644
--- a/src/ping.c
+++ b/src/ping.c
@@ -253,7 +253,7 @@ static int ping_read (void)
return (number_of_hosts == 0 ? -1 : 0);
} /* int ping_read */
-void module_register (void)
+MODULE_REGISTER (ping)
{
plugin_register_config ("ping", ping_config,
config_keys, config_keys_num);
diff --git a/src/plugin.c b/src/plugin.c
index 4a25aaa..7f377db 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -73,6 +73,7 @@ static int read_threads_num = 0;
/*
* Static functions
*/
+#if ! BUILD_STATIC
static const char *plugin_get_dir (void)
{
if (plugindir == NULL)
@@ -80,6 +81,7 @@ static const char *plugin_get_dir (void)
else
return (plugindir);
}
+#endif
static int register_callback (llist_t **list, const char *name, void *callback)
{
@@ -135,6 +137,7 @@ 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..
*/
+#if ! BUILD_STATIC
static int plugin_load_file (char *file)
{
lt_dlhandle dlh;
@@ -166,6 +169,7 @@ static int plugin_load_file (char *file)
return (0);
}
+#endif
static void *plugin_read_thread (void *args)
{
@@ -310,6 +314,43 @@ void plugin_set_dir (const char *dir)
}
}
+#if BUILD_STATIC
+int plugin_load (const char *type)
+{
+ lt_dlhandle dlh;
+ void (*reg_handle) (void);
+
+ char module_register[strlen (type) + strlen ("_module_register") + 1];
+
+ lt_dlinit ();
+ lt_dlerror (); /* clear errors */
+
+ if ((dlh = lt_dlopen (NULL)) == NULL)
+ {
+ const char *error = lt_dlerror ();
+
+ ERROR ("lt_dlopen failed: %s", error);
+ fprintf (stderr, "lt_dlopen failed: %s\n", error);
+ fprintf (stderr, "Unable to load plugin %s.\n", type);
+ return (1);
+ }
+
+ ssnprintf (module_register, sizeof (module_register),
+ "%s_module_register", type);
+
+ if ((reg_handle = (void (*) (void)) lt_dlsym (dlh, module_register))
+ == NULL) {
+ WARNING ("Couldn't find symbol ``%s'': %s", module_register,
+ lt_dlerror ());
+ fprintf (stderr, "Unable to load plugin %s.\n", type);
+ lt_dlclose (dlh);
+ return (-1);
+ }
+
+ (*reg_handle) ();
+ return (0);
+} /* plugin_load (static) */
+#else /* ! BUILD_STATIC */
#define BUFSIZE 512
int plugin_load (const char *type)
{
@@ -388,7 +429,8 @@ int plugin_load (const char *type)
fprintf (stderr, "Could not find plugin %s.\n", type);
return (ret);
-}
+} /* plugin_load (dynamic) */
+#endif /* BUILD_STATIC */
/*
* The `register_*' functions follow
diff --git a/src/plugin.h b/src/plugin.h
index 3bf7e4c..9d81e1b 100644
--- a/src/plugin.h
+++ b/src/plugin.h
@@ -52,6 +52,12 @@
#define NOTIF_WARNING 2
#define NOTIF_OKAY 4
+#if BUILD_STATIC
+# define MODULE_REGISTER(name) void name##_module_register (void)
+#else
+# define MODULE_REGISTER(name) void module_register (void)
+#endif /* BUILD_STATIC */
+
/*
* Public data types
*/
diff --git a/src/powerdns.c b/src/powerdns.c
index 9d93f93..f85adb1 100644
--- a/src/powerdns.c
+++ b/src/powerdns.c
@@ -963,7 +963,7 @@ static int powerdns_shutdown (void)
return (0);
} /* static int powerdns_shutdown */
-void module_register (void)
+MODULE_REGISTER (powerdns)
{
plugin_register_complex_config ("powerdns", powerdns_config);
plugin_register_read ("powerdns", powerdns_read);
diff --git a/src/processes.c b/src/processes.c
index 5459672..548c618 100644
--- a/src/processes.c
+++ b/src/processes.c
@@ -1263,7 +1263,7 @@ static int ps_read (void)
return (0);
} /* int ps_read */
-void module_register (void)
+MODULE_REGISTER (processes)
{
plugin_register_config ("processes", ps_config,
config_keys, config_keys_num);
diff --git a/src/rrdtool.c b/src/rrdtool.c
index fd499fd..93535e7 100644
--- a/src/rrdtool.c
+++ b/src/rrdtool.c
@@ -1247,7 +1247,7 @@ static int rrd_init (void)
return (0);
} /* int rrd_init */
-void module_register (void)
+MODULE_REGISTER (rrdtool)
{
plugin_register_config ("rrdtool", rrd_config,
config_keys, config_keys_num);
diff --git a/src/sensors.c b/src/sensors.c
index 5ed82a8..8e45cfd 100644
--- a/src/sensors.c
+++ b/src/sensors.c
@@ -583,7 +583,7 @@ static int sensors_read (void)
return (0);
} /* int sensors_read */
-void module_register (void)
+MODULE_REGISTER (sensors)
{
plugin_register_config ("sensors", sensors_config,
config_keys, config_keys_num);
diff --git a/src/serial.c b/src/serial.c
index 1c5d5a5..bf42d30 100644
--- a/src/serial.c
+++ b/src/serial.c
@@ -120,7 +120,7 @@ static int serial_read (void)
return (0);
} /* int serial_read */
-void module_register (void)
+MODULE_REGISTER (serial)
{
plugin_register_read ("serial", serial_read);
} /* void module_register */
diff --git a/src/snmp.c b/src/snmp.c
index 75fa880..fd4bc0b 100644
--- a/src/snmp.c
+++ b/src/snmp.c
@@ -1575,7 +1575,7 @@ static int csnmp_shutdown (void)
return (0);
} /* int csnmp_shutdown */
-void module_register (void)
+MODULE_REGISTER (snmp)
{
plugin_register_complex_config ("snmp", csnmp_config);
plugin_register_init ("snmp", csnmp_init);
diff --git a/src/swap.c b/src/swap.c
index 4f0a0ba..e0cecd7 100644
--- a/src/swap.c
+++ b/src/swap.c
@@ -303,7 +303,7 @@ static int swap_read (void)
return (0);
} /* int swap_read */
-void module_register (void)
+MODULE_REGISTER (swap)
{
plugin_register_init ("swap", swap_init);
plugin_register_read ("swap", swap_read);
diff --git a/src/syslog.c b/src/syslog.c
index a21bef1..e22f0a9 100644
--- a/src/syslog.c
+++ b/src/syslog.c
@@ -83,7 +83,7 @@ static int sl_shutdown (void)
return (0);
}
-void module_register (void)
+MODULE_REGISTER (syslog)
{
openlog ("collectd", LOG_CONS | LOG_PID, LOG_DAEMON);
diff --git a/src/tail.c b/src/tail.c
index 01bf629..f0bfd49 100644
--- a/src/tail.c
+++ b/src/tail.c
@@ -342,7 +342,7 @@ static int ctail_shutdown (void)
return (0);
} /* int ctail_shutdown */
-void module_register (void)
+MODULE_REGISTER (tail)
{
plugin_register_complex_config ("tail", ctail_config);
plugin_register_init ("tail", ctail_init);
diff --git a/src/tape.c b/src/tape.c
index 67750ef..0b5bbc1 100644
--- a/src/tape.c
+++ b/src/tape.c
@@ -127,7 +127,7 @@ static int tape_read (void)
return (0);
}
-void module_register (void)
+MODULE_REGISTER (tape)
{
plugin_register_init ("tape", tape_init);
plugin_register_read ("tape", tape_read);
diff --git a/src/tcpconns.c b/src/tcpconns.c
index 4f46e78..794e38e 100644
--- a/src/tcpconns.c
+++ b/src/tcpconns.c
@@ -516,7 +516,7 @@ static int conn_read (void)
} /* int conn_read */
#endif /* HAVE_SYSCTLBYNAME */
-void module_register (void)
+MODULE_REGISTER (tcpconns)
{
plugin_register_config ("tcpconns", conn_config,
config_keys, config_keys_num);
diff --git a/src/teamspeak2.c b/src/teamspeak2.c
index 5cd427a..eb3824f 100644
--- a/src/teamspeak2.c
+++ b/src/teamspeak2.c
@@ -832,7 +832,7 @@ static int tss2_shutdown(void)
return (0);
} /* int tss2_shutdown */
-void module_register(void)
+MODULE_REGISTER (teamspeak2)
{
/*
* Mandatory module_register function
diff --git a/src/thermal.c b/src/thermal.c
index 4af63bc..1538628 100644
--- a/src/thermal.c
+++ b/src/thermal.c
@@ -300,7 +300,7 @@ static int thermal_shutdown (void)
return 0;
}
-void module_register (void)
+MODULE_REGISTER (thermal)
{
plugin_register_config ("thermal", thermal_config,
config_keys, STATIC_ARRAY_SIZE(config_keys));
diff --git a/src/unixsock.c b/src/unixsock.c
index d34b91f..37fb582 100644
--- a/src/unixsock.c
+++ b/src/unixsock.c
@@ -417,7 +417,7 @@ static int us_shutdown (void)
return (0);
} /* int us_shutdown */
-void module_register (void)
+MODULE_REGISTER (unixsock)
{
plugin_register_config ("unixsock", us_config,
config_keys, config_keys_num);
diff --git a/src/users.c b/src/users.c
index 5b12e98..9eee30a 100644
--- a/src/users.c
+++ b/src/users.c
@@ -111,7 +111,7 @@ static int users_read (void)
return (0);
} /* int users_read */
-void module_register (void)
+MODULE_REGISTER (users)
{
plugin_register_read ("users", users_read);
} /* void module_register(void) */
diff --git a/src/uuid.c b/src/uuid.c
index e0de0d9..1c5c94a 100644
--- a/src/uuid.c
+++ b/src/uuid.c
@@ -266,7 +266,7 @@ uuid_init (void)
return 0;
}
-void module_register (void)
+MODULE_REGISTER (uuid)
{
plugin_register_config ("uuid", uuid_config,
config_keys, NR_CONFIG_KEYS);
diff --git a/src/vmem.c b/src/vmem.c
index 1e826a1..43a1c5d 100644
--- a/src/vmem.c
+++ b/src/vmem.c
@@ -275,7 +275,7 @@ static int vmem_read (void)
return (0);
} /* int vmem_read */
-void module_register (void)
+MODULE_REGISTER (vmem)
{
plugin_register_config ("vmem", vmem_config,
config_keys, config_keys_num);
diff --git a/src/vserver.c b/src/vserver.c
index 4cc8251..ab20c4e 100644
--- a/src/vserver.c
+++ b/src/vserver.c
@@ -309,7 +309,7 @@ static int vserver_read (void)
return (0);
} /* int vserver_read */
-void module_register (void)
+MODULE_REGISTER (vserver)
{
plugin_register_init ("vserver", vserver_init);
plugin_register_read ("vserver", vserver_read);
diff --git a/src/wireless.c b/src/wireless.c
index a0644fe..b0ee0d3 100644
--- a/src/wireless.c
+++ b/src/wireless.c
@@ -163,7 +163,7 @@ static int wireless_read (void)
return (0);
} /* int wireless_read */
-void module_register (void)
+MODULE_REGISTER (wireless)
{
plugin_register_read ("wireless", wireless_read);
} /* void module_register */
diff --git a/src/xmms.c b/src/xmms.c
index 01c7e0c..4f13ff9 100644
--- a/src/xmms.c
+++ b/src/xmms.c
@@ -64,7 +64,7 @@ int cxmms_read (void)
return (0);
} /* int read */
-void module_register (void)
+MODULE_REGISTER (xmms)
{
plugin_register_read ("xmms", cxmms_read);
} /* void module_register */
--
1.5.6.rc2
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20080617/d20b3755/attachment.pgp
More information about the collectd
mailing list