From 4dedfa46272ffa0c52e426b3051fddd0b8d0bea2 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Wed, 5 Apr 2017 11:54:10 +0200 Subject: [PATCH] Remove utils_ignorelist.[ch] from daemon; link plugins directly. The collectd daemon isn't using the "ignorelist" functionality itself -- it was only linked in to provide it to loaded plugins. Since the code is under the GPL, this interfers with our intend of having an MIT licensed daemon. This patch changes the build system to link plugins with the ignorelist directly instead of expecting the symbols to be in the daemon. --- Makefile.am | 38 +++++++++++++++++------------ src/{daemon => }/utils_ignorelist.c | 0 src/{daemon => }/utils_ignorelist.h | 0 3 files changed, 22 insertions(+), 16 deletions(-) rename src/{daemon => }/utils_ignorelist.c (100%) rename src/{daemon => }/utils_ignorelist.h (100%) diff --git a/Makefile.am b/Makefile.am index c0334723..23e6a24f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -114,6 +114,7 @@ noinst_LTLIBRARIES = \ libformat_graphite.la \ libformat_json.la \ libheap.la \ + libignorelist.la \ liblatency.la \ liblookup.la \ libmetadata.la \ @@ -199,8 +200,6 @@ collectd_SOURCES = \ src/daemon/utils_cache.h \ src/daemon/utils_complain.c \ src/daemon/utils_complain.h \ - src/daemon/utils_ignorelist.c \ - src/daemon/utils_ignorelist.h \ src/daemon/utils_llist.c \ src/daemon/utils_llist.h \ src/daemon/utils_random.c \ @@ -331,6 +330,10 @@ libheap_la_SOURCES = \ src/daemon/utils_heap.c \ src/daemon/utils_heap.h +libignorelist_la_SOURCES = \ + src/utils_ignorelist.c \ + src/utils_ignorelist.h + libmetadata_la_SOURCES = \ src/daemon/meta_data.c \ src/daemon/meta_data.h @@ -340,13 +343,11 @@ libplugin_mock_la_SOURCES = \ src/daemon/utils_cache_mock.c \ src/daemon/utils_complain.c \ src/daemon/utils_complain.h \ - src/daemon/utils_ignorelist.c \ - src/daemon/utils_ignorelist.h \ src/daemon/utils_time.c \ src/daemon/utils_time.h libplugin_mock_la_CPPFLAGS = $(AM_CPPFLAGS) -DMOCK_TIME -libplugin_mock_la_LIBADD = libcommon.la $(COMMON_LIBS) +libplugin_mock_la_LIBADD = libcommon.la libignorelist.la $(COMMON_LIBS) libformat_graphite_la_SOURCES = \ src/utils_format_graphite.c \ @@ -602,7 +603,7 @@ if BUILD_PLUGIN_CGROUPS pkglib_LTLIBRARIES += cgroups.la cgroups_la_SOURCES = src/cgroups.c cgroups_la_LDFLAGS = $(PLUGIN_LDFLAGS) -cgroups_la_LIBADD = libmount.la +cgroups_la_LIBADD = libignorelist.la libmount.la endif if BUILD_PLUGIN_CHRONY @@ -719,7 +720,7 @@ if BUILD_PLUGIN_DF pkglib_LTLIBRARIES += df.la df_la_SOURCES = src/df.c df_la_LDFLAGS = $(PLUGIN_LDFLAGS) -df_la_LIBADD = libmount.la +df_la_LIBADD = libignorelist.la libmount.la endif if BUILD_PLUGIN_DISK @@ -728,7 +729,7 @@ disk_la_SOURCES = src/disk.c disk_la_CFLAGS = $(AM_CFLAGS) disk_la_CPPFLAGS = $(AM_CPPFLAGS) disk_la_LDFLAGS = $(PLUGIN_LDFLAGS) -disk_la_LIBADD = +disk_la_LIBADD = libignorelist.la if BUILD_WITH_LIBKSTAT disk_la_LIBADD += -lkstat endif @@ -888,7 +889,7 @@ pkglib_LTLIBRARIES += interface.la interface_la_SOURCES = src/interface.c interface_la_CFLAGS = $(AM_CFLAGS) interface_la_LDFLAGS = $(PLUGIN_LDFLAGS) -interface_la_LIBADD = +interface_la_LIBADD = libignorelist.la if BUILD_WITH_LIBSTATGRAB interface_la_CFLAGS += $(BUILD_WITH_LIBSTATGRAB_CFLAGS) interface_la_LIBADD += $(BUILD_WITH_LIBSTATGRAB_LDFLAGS) @@ -924,7 +925,7 @@ pkglib_LTLIBRARIES += ipmi.la ipmi_la_SOURCES = src/ipmi.c ipmi_la_CFLAGS = $(AM_CFLAGS) $(BUILD_WITH_OPENIPMI_CFLAGS) ipmi_la_LDFLAGS = $(PLUGIN_LDFLAGS) -ipmi_la_LIBADD = $(BUILD_WITH_OPENIPMI_LIBS) +ipmi_la_LIBADD = libignorelist.la $(BUILD_WITH_OPENIPMI_LIBS) endif if BUILD_PLUGIN_IPVS @@ -941,6 +942,7 @@ if BUILD_PLUGIN_IRQ pkglib_LTLIBRARIES += irq.la irq_la_SOURCES = src/irq.c irq_la_LDFLAGS = $(PLUGIN_LDFLAGS) +irq_la_LIBADD = libignorelist.la endif if BUILD_PLUGIN_JAVA @@ -1013,6 +1015,7 @@ madwifi_la_SOURCES = \ src/madwifi.c \ src/madwifi.h madwifi_la_LDFLAGS = $(PLUGIN_LDFLAGS) +madwifi_la_LIBADD = libignorelist.la endif if BUILD_PLUGIN_MATCH_EMPTY_COUNTER @@ -1065,6 +1068,7 @@ if BUILD_PLUGIN_MD pkglib_LTLIBRARIES += md.la md_la_SOURCES = src/md.c md_la_LDFLAGS = $(PLUGIN_LDFLAGS) +md_la_LIBADD = libignorelist.la endif if BUILD_PLUGIN_MEMCACHEC @@ -1114,7 +1118,7 @@ pkglib_LTLIBRARIES += mic.la mic_la_SOURCES = src/mic.c mic_la_CPPFLAGS = $(AM_CPPFLAGS) $(BUILD_WITH_MIC_CPPFLAGS) mic_la_LDFLAGS = $(PLUGIN_LDFLAGS) $(BUILD_WITH_MIC_LDFLAGS) -mic_la_LIBADD = $(BUILD_WITH_MIC_LIBS) +mic_la_LIBADD = libignorelist.la $(BUILD_WITH_MIC_LIBS) endif if BUILD_PLUGIN_MODBUS @@ -1152,7 +1156,7 @@ pkglib_LTLIBRARIES += netapp.la netapp_la_SOURCES = src/netapp.c netapp_la_CPPFLAGS = $(AM_CPPFLAGS) $(LIBNETAPP_CPPFLAGS) netapp_la_LDFLAGS = $(PLUGIN_LDFLAGS) $(LIBNETAPP_LDFLAGS) -netapp_la_LIBADD = $(LIBNETAPP_LIBS) +netapp_la_LIBADD = libignorelist.la $(LIBNETAPP_LIBS) endif if BUILD_PLUGIN_NETLINK @@ -1257,8 +1261,8 @@ if BUILD_PLUGIN_ONEWIRE pkglib_LTLIBRARIES += onewire.la onewire_la_SOURCES = src/onewire.c onewire_la_CPPFLAGS = $(AM_CPPFLAGS) $(BUILD_WITH_LIBOWCAPI_CPPFLAGS) -onewire_la_LIBADD = $(BUILD_WITH_LIBOWCAPI_LIBS) onewire_la_LDFLAGS = $(PLUGIN_LDFLAGS) $(BUILD_WITH_LIBOWCAPI_LDFLAGS) +onewire_la_LIBADD = libignorelist.la $(BUILD_WITH_LIBOWCAPI_LIBS) endif if BUILD_PLUGIN_OPENLDAP @@ -1396,6 +1400,7 @@ if BUILD_PLUGIN_PROTOCOLS pkglib_LTLIBRARIES += protocols.la protocols_la_SOURCES = src/protocols.c protocols_la_LDFLAGS = $(PLUGIN_LDFLAGS) +protocols_la_LIBADD = libignorelist.la endif if BUILD_PLUGIN_REDIS @@ -1441,7 +1446,7 @@ pkglib_LTLIBRARIES += sensors.la sensors_la_SOURCES = src/sensors.c sensors_la_CPPFLAGS = $(AM_CPPFLAGS) $(BUILD_WITH_LIBSENSORS_CPPFLAGS) sensors_la_LDFLAGS = $(PLUGIN_LDFLAGS) $(BUILD_WITH_LIBSENSORS_LDFLAGS) -sensors_la_LIBADD = $(BUILD_WITH_LIBSENSORS_LIBS) +sensors_la_LIBADD = libignorelist.la $(BUILD_WITH_LIBSENSORS_LIBS) endif if BUILD_PLUGIN_SERIAL @@ -1464,7 +1469,7 @@ pkglib_LTLIBRARIES += smart.la smart_la_SOURCES = src/smart.c smart_la_CPPFLAGS = $(AM_CPPFLAGS) $(BUILD_WITH_LIBATASMART_CPPFLAGS) $(BUILD_WITH_LIBUDEV_CPPFLAGS) smart_la_LDFLAGS = $(PLUGIN_LDFLAGS) $(BUILD_WITH_LIBATASMART_LDFLAGS) $(BUILD_WITH_LIBUDEV_LDFLAGS) -smart_la_LIBADD = $(BUILD_WITH_LIBATASMART_LIBS) $(BUILD_WITH_LIBUDEV_LIBS) +smart_la_LIBADD = libignorelist.la $(BUILD_WITH_LIBATASMART_LIBS) $(BUILD_WITH_LIBUDEV_LIBS) endif endif @@ -1606,6 +1611,7 @@ if BUILD_PLUGIN_THERMAL pkglib_LTLIBRARIES += thermal.la thermal_la_SOURCES = src/thermal.c thermal_la_LDFLAGS = $(PLUGIN_LDFLAGS) +thermal_la_LIBADD = libignorelist.la endif if BUILD_PLUGIN_THRESHOLD @@ -1683,8 +1689,8 @@ pkglib_LTLIBRARIES += virt.la virt_la_SOURCES = src/virt.c virt_la_CFLAGS = $(AM_CFLAGS) \ $(BUILD_WITH_LIBVIRT_CFLAGS) $(BUILD_WITH_LIBXML2_CFLAGS) -virt_la_LIBADD = $(BUILD_WITH_LIBVIRT_LIBS) $(BUILD_WITH_LIBXML2_LIBS) virt_la_LDFLAGS = $(PLUGIN_LDFLAGS) +virt_la_LIBADD = libignorelist.la $(BUILD_WITH_LIBVIRT_LIBS) $(BUILD_WITH_LIBXML2_LIBS) # TODO: enable once we support only modern libvirts which depends on libnl-3 # the libvirt on wheezy is linked in libnl v1, and there is a small leak here, diff --git a/src/daemon/utils_ignorelist.c b/src/utils_ignorelist.c similarity index 100% rename from src/daemon/utils_ignorelist.c rename to src/utils_ignorelist.c diff --git a/src/daemon/utils_ignorelist.h b/src/utils_ignorelist.h similarity index 100% rename from src/daemon/utils_ignorelist.h rename to src/utils_ignorelist.h -- 2.30.2