summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7df0365)
raw | patch | inline | side by side (parent: 7df0365)
author | octo <octo> | |
Tue, 13 Dec 2005 21:50:01 +0000 (21:50 +0000) | ||
committer | octo <octo> | |
Tue, 13 Dec 2005 21:50:01 +0000 (21:50 +0000) |
Added function `plugin_exists (char *type)' to `plugin.[ch]'
src/Makefile.am | patch | blob | history | |
src/collectd.h | patch | blob | history | |
src/plugin.c | patch | blob | history | |
src/plugin.h | patch | blob | history |
diff --git a/src/Makefile.am b/src/Makefile.am
index 207288d5e7630a3a0776f9fccc02b06105460ed6..f4ac403ce21a5ac49ab12974d674f3abe504f02b 100644 (file)
--- a/src/Makefile.am
+++ b/src/Makefile.am
plugin.c plugin.h \
configfile.c configfile.h
#collectd_CFLAGS = -DPLUGINDIR='"$(pkglibdir)"'
-collectd_CPPFLAGS = -DLOCALSTATEDIR='"$(localstatedir)"' -DPLUGINDIR='"$(pkglibdir)"'
+collectd_CPPFLAGS = -DLOCALSTATEDIR='"$(localstatedir)"' -DSYSCONFDIR='"$(sysconfdir)"' -DPLUGINDIR='"$(pkglibdir)"'
collectd_LDFLAGS = -export-dynamic
collectd_CFLAGS = -Werror
collectd_LDADD = $(LIBLTDL) libconfig/libconfig.la "-dlopen" self
diff --git a/src/collectd.h b/src/collectd.h
index c7aa925ae4d23547d3807c0f1c5f28a7a1554463..32b9735d1b77c2ae094fd9ac44440cc8ddddb0f7 100644 (file)
--- a/src/collectd.h
+++ b/src/collectd.h
#define PIDFILE LOCALSTATEDIR"/run/collectd.pid"
#endif
+#ifndef SYSCONFDIR
+#define SYSCONFDIR "/opt/collectd/etc"
+#endif
+
+#ifndef CONFIGFILE
+#define CONFIGFILE SYSCONFDIR"/collectd.conf"
+#endif
+
#define MODE_SERVER 0x01
#define MODE_CLIENT 0x02
#define MODE_LOCAL 0x03
diff --git a/src/plugin.c b/src/plugin.c
index a6792de055251a18c62d9688eba94904fb211ec9..a249cf7688b5f7b8c375cf0e34118e6642724b2a 100644 (file)
--- a/src/plugin.c
+++ b/src/plugin.c
return (ret);
}
+/*
+ * Returns true if the plugin is loaded (i.e. `exists') and false otherwise.
+ * This is used in `configfile.c' to skip sections that are not needed..
+ */
+bool plugin_exists (char *type)
+{
+ if (plugin_search (type) == NULL)
+ return (false);
+ else
+ return (true);
+}
+
/*
* (Try to) load the shared object `name'. Won't complain if it isn't a shared
* object, but it will bitch about a shared object not having a
diff --git a/src/plugin.h b/src/plugin.h
index 4a8b7ad797059706a0453519e9f3f8b29471637a..e14376e599eca2d1609a89f324068853615513b3 100644 (file)
--- a/src/plugin.h
+++ b/src/plugin.h
void plugin_init_all (void);
void plugin_read_all (void);
+bool plugin_exists (char *type);
void plugin_register (char *type,
void (*init) (void),
void (*read) (void),