From 404b1807e6dc4b9d1758f62a5a7b88f1d4d65eb4 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Fri, 22 Feb 2013 08:12:43 +0100 Subject: [PATCH] Removed PCH support (as it's clearly not working properly). --- autogen.sh | 6 ------ components/compat/compatcomponent.cpp | 6 +++--- configure.ac | 9 --------- lib/base/Makefile.am | 13 ------------- lib/base/dynamicobject.cpp | 2 +- lib/base/process.cpp | 2 +- lib/config/Makefile.am | 14 ------------- lib/config/configitem.cpp | 18 ++++++++--------- lib/config/configitem.h | 5 ++++- lib/icinga/Makefile.am | 14 ------------- lib/icinga/externalcommandprocessor.cpp | 2 +- lib/icinga/host.cpp | 2 ++ lib/icinga/icingaapplication.cpp | 2 -- lib/python/Makefile.am | 14 ------------- lib/remoting/Makefile.am | 14 ------------- libtool-pch.patch | 26 ------------------------- 16 files changed, 20 insertions(+), 129 deletions(-) delete mode 100644 libtool-pch.patch diff --git a/autogen.sh b/autogen.sh index 09e9b9f6e..17b17bdc2 100755 --- a/autogen.sh +++ b/autogen.sh @@ -186,12 +186,6 @@ do automake --add-missing --gnu $am_opt echo "Running autoconf ..." autoconf - - if ! patch --dry-run -p0 < libtool-pch.patch >/dev/null; then - echo "Warning: Libtool patch did not apply cleanly." - else - patch -p0 < libtool-pch.patch - fi ) fi done diff --git a/components/compat/compatcomponent.cpp b/components/compat/compatcomponent.cpp index 0c62a69bc..5507b5801 100644 --- a/components/compat/compatcomponent.cpp +++ b/components/compat/compatcomponent.cpp @@ -91,7 +91,7 @@ String CompatComponent::GetCommandPath(void) const void CompatComponent::Start(void) { m_StatusTimer = boost::make_shared(); - m_StatusTimer->SetInterval(30); + m_StatusTimer->SetInterval(60); m_StatusTimer->OnTimerExpired.connect(boost::bind(&CompatComponent::StatusTimerHandler, this)); m_StatusTimer->Start(); m_StatusTimer->Reschedule(0); @@ -359,12 +359,12 @@ void CompatComponent::DumpServiceStatusAttrs(ofstream& fp, const Service::Ptr& s else state = 1; - if (Host::IsReachable(host)) + if (!Host::IsReachable(host)) state = 2; } { - ObjectLock olock(service); + ObjectLock olock(service); fp << "\t" << "check_interval=" << service->GetCheckInterval() / 60.0 << "\n" << "\t" << "retry_interval=" << service->GetRetryInterval() / 60.0 << "\n" diff --git a/configure.ac b/configure.ac index 386568fd2..d27eabee0 100644 --- a/configure.ac +++ b/configure.ac @@ -92,15 +92,6 @@ if test "x$enable_debug" = "xyes"; then fi AC_MSG_RESULT($enable_debug) -AC_MSG_CHECKING(whether to enable GCC precompiled headers) -AC_ARG_ENABLE(pch, [ --enable-pch=[no/yes] enable GCC precompiled headers (default=no)],, enable_pch=no) -AM_CONDITIONAL([USE_PCH], [test "x$enable_pch" = "xyes"]) -if test "x$enable_pch" = "xyes"; then - CFLAGS="$CFLAGS -fpch-deps -fpch-preprocess -Winvalid-pch" - CXXFLAGS="$CXXFLAGS -fpch-deps -fpch-preprocess -Winvalid-pch" -fi -AC_MSG_RESULT($enable_pch) - AS_AC_EXPAND([ICINGA_PREFIX], $prefix) AC_DEFINE_UNQUOTED([ICINGA_PREFIX], "$ICINGA_PREFIX", [The installation prefix.]) diff --git a/lib/base/Makefile.am b/lib/base/Makefile.am index 721504a35..60ffcb8cc 100644 --- a/lib/base/Makefile.am +++ b/lib/base/Makefile.am @@ -106,16 +106,3 @@ libbase_la_LIBADD = \ ${top_builddir}/third-party/mmatch/libmmatch.la \ ${top_builddir}/third-party/cJSON/libcJSON.la \ ${top_builddir}/third-party/popen-noshell/libpopen_noshell.la - -if USE_PCH -BUILT_SOURCES = i2-base.h.gch - -i2-base.h.gch: i2-base.h - $(AM_V_CXX)$(LTCXXCOMPILE) $(libbase_la_CPPFLAGS) -o $@ $^ - -libbase_la_DEPENDENCIES = \ - i2-base.h.gch - -clean-local: - rm -f i2-base.h.gch -endif diff --git a/lib/base/dynamicobject.cpp b/lib/base/dynamicobject.cpp index 0a73afa93..bf4e714f7 100644 --- a/lib/base/dynamicobject.cpp +++ b/lib/base/dynamicobject.cpp @@ -24,7 +24,7 @@ using namespace icinga; double DynamicObject::m_CurrentTx = 0; set DynamicObject::m_ModifiedObjects; boost::mutex DynamicObject::m_TransactionMutex; -boost::once_flag DynamicObject::m_TransactionOnce; +boost::once_flag DynamicObject::m_TransactionOnce = BOOST_ONCE_INIT; Timer::Ptr DynamicObject::m_TransactionTimer; signals2::signal DynamicObject::OnRegistered; diff --git a/lib/base/process.cpp b/lib/base/process.cpp index 640d89d79..7e9a08a6f 100644 --- a/lib/base/process.cpp +++ b/lib/base/process.cpp @@ -21,7 +21,7 @@ using namespace icinga; -boost::once_flag Process::m_ThreadOnce; +boost::once_flag Process::m_ThreadOnce = BOOST_ONCE_INIT; boost::mutex Process::m_Mutex; deque Process::m_Tasks; double Process::m_LastReport = 0; diff --git a/lib/config/Makefile.am b/lib/config/Makefile.am index 796f0ba1c..18ad41c77 100644 --- a/lib/config/Makefile.am +++ b/lib/config/Makefile.am @@ -46,17 +46,3 @@ libconfig_la_LDFLAGS = \ libconfig_la_LIBADD = \ ${top_builddir}/lib/base/libbase.la - -if USE_PCH -BUILT_SOURCES += i2-config.h.gch - -i2-config.h.gch: i2-config.h - $(AM_V_CXX)$(LTCXXCOMPILE) $(libconfig_la_CPPFLAGS) -o $@ $^ - -libconfig_la_DEPENDENCIES = \ - i2-config.h.gch - -clean-local: - rm -f i2-config.h.gch -endif - diff --git a/lib/config/configitem.cpp b/lib/config/configitem.cpp index 3b821301a..bccb661b1 100644 --- a/lib/config/configitem.cpp +++ b/lib/config/configitem.cpp @@ -21,7 +21,7 @@ using namespace icinga; -boost::mutex ConfigItem::m_Mutex; +recursive_mutex ConfigItem::m_Mutex; ConfigItem::ItemMap ConfigItem::m_Items; signals2::signal ConfigItem::OnCommitted; signals2::signal ConfigItem::OnRemoved; @@ -181,7 +181,7 @@ DynamicObject::Ptr ConfigItem::Commit(const ConfigItem::Ptr& self) BOOST_THROW_EXCEPTION(runtime_error("Type '" + type + "' does not exist.")); { - boost::mutex::scoped_lock lock(m_Mutex); + recursive_mutex::scoped_lock lock(m_Mutex); /* Try to find an existing item with the same type and name. */ pair ikey = make_pair(type, name); @@ -368,16 +368,14 @@ DynamicObject::Ptr ConfigItem::GetDynamicObject(void) const */ ConfigItem::Ptr ConfigItem::GetObject(const String& type, const String& name) { - { - boost::mutex::scoped_lock lock(m_Mutex); + recursive_mutex::scoped_lock lock(m_Mutex); - ConfigItem::ItemMap::iterator it; + ConfigItem::ItemMap::iterator it; - it = m_Items.find(make_pair(type, name)); + it = m_Items.find(make_pair(type, name)); - if (it != m_Items.end()) - return it->second; - } + if (it != m_Items.end()) + return it->second; return ConfigItem::Ptr(); } @@ -416,7 +414,7 @@ void ConfigItem::Dump(ostream& fp) const */ void ConfigItem::UnloadUnit(const String& unit) { - boost::mutex::scoped_lock lock(m_Mutex); + recursive_mutex::scoped_lock lock(m_Mutex); Logger::Write(LogInformation, "config", "Unloading config items from compilation unit '" + unit + "'"); diff --git a/lib/config/configitem.h b/lib/config/configitem.h index a20b36143..56c1c4707 100644 --- a/lib/config/configitem.h +++ b/lib/config/configitem.h @@ -90,10 +90,13 @@ private: set m_ChildObjects; /**< Instantiated items * that inherit from this item */ - static boost::mutex m_Mutex; + static recursive_mutex m_Mutex; typedef map, ConfigItem::Ptr> ItemMap; static ItemMap m_Items; /**< All registered configuration items. */ + + static ConfigItem::Ptr GetObjectUnlocked(const String& type, + const String& name); }; } diff --git a/lib/icinga/Makefile.am b/lib/icinga/Makefile.am index 7dc431874..9e09a230c 100644 --- a/lib/icinga/Makefile.am +++ b/lib/icinga/Makefile.am @@ -61,17 +61,3 @@ libicinga_la_LIBADD = \ ${top_builddir}/lib/base/libbase.la \ ${top_builddir}/lib/config/libconfig.la \ ${top_builddir}/lib/remoting/libremoting.la - -if USE_PCH -BUILT_SOURCES = i2-icinga.h.gch - -i2-icinga.h.gch: i2-icinga.h - $(AM_V_CXX)$(LTCXXCOMPILE) $(libicinga_la_CPPFLAGS) -o $@ $^ - -libicinga_la_DEPENDENCIES = \ - i2-icinga.h.gch - -clean-local: - rm -f i2-icinga.h.gch -endif - diff --git a/lib/icinga/externalcommandprocessor.cpp b/lib/icinga/externalcommandprocessor.cpp index fb4290539..ed9621cb6 100644 --- a/lib/icinga/externalcommandprocessor.cpp +++ b/lib/icinga/externalcommandprocessor.cpp @@ -21,7 +21,7 @@ using namespace icinga; -boost::once_flag ExternalCommandProcessor::m_InitializeOnce; +boost::once_flag ExternalCommandProcessor::m_InitializeOnce = BOOST_ONCE_INIT; boost::mutex ExternalCommandProcessor::m_Mutex; map ExternalCommandProcessor::m_Commands; diff --git a/lib/icinga/host.cpp b/lib/icinga/host.cpp index 4bb21902f..581794b18 100644 --- a/lib/icinga/host.cpp +++ b/lib/icinga/host.cpp @@ -160,6 +160,8 @@ bool Host::IsReachable(const Host::Ptr& self) hc = host->GetHostCheckService(); } + ObjectLock olock(hc); + /* ignore hosts that are up */ if (hc && hc->GetState() == StateOK) continue; diff --git a/lib/icinga/icingaapplication.cpp b/lib/icinga/icingaapplication.cpp index a961d9be1..96eda887d 100644 --- a/lib/icinga/icingaapplication.cpp +++ b/lib/icinga/icingaapplication.cpp @@ -17,8 +17,6 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * ******************************************************************************/ -#include -#include #include "i2-icinga.h" using namespace icinga; diff --git a/lib/python/Makefile.am b/lib/python/Makefile.am index 36080d860..d314d6968 100644 --- a/lib/python/Makefile.am +++ b/lib/python/Makefile.am @@ -32,18 +32,4 @@ libpython_la_LIBADD = \ ${top_builddir}/lib/base/libbase.la \ ${top_builddir}/lib/config/libconfig.la \ ${top_builddir}/lib/remoting/libremoting.la - -if USE_PCH -BUILT_SOURCES = i2-python.h.gch - -i2-python.h.gch: i2-python.h - $(AM_V_CXX)$(LTCXXCOMPILE) $(libpython_la_CPPFLAGS) -o $@ $^ - -libpython_la_DEPENDENCIES = \ - i2-python.h.gch - -clean-local: - rm -f i2-python.h.gch -endif - endif diff --git a/lib/remoting/Makefile.am b/lib/remoting/Makefile.am index 84e32b6fa..372dcca81 100644 --- a/lib/remoting/Makefile.am +++ b/lib/remoting/Makefile.am @@ -35,17 +35,3 @@ libremoting_la_LDFLAGS = \ libremoting_la_LIBADD = \ ${top_builddir}/lib/base/libbase.la \ ${top_builddir}/lib/config/libconfig.la - -if USE_PCH -BUILT_SOURCES = i2-remoting.h.gch - -i2-remoting.h.gch: i2-remoting.h - $(AM_V_CXX)$(LTCXXCOMPILE) $(libremoting_la_CPPFLAGS) -o $@ $^ - -libremoting_la_DEPENDENCIES = \ - i2-remoting.h.gch - -clean-local: - rm -f i2-remoting.h.gch -endif - diff --git a/libtool-pch.patch b/libtool-pch.patch deleted file mode 100644 index 2f1aac229..000000000 --- a/libtool-pch.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- m4/ltmain.sh 2013-02-21 11:23:30.000000000 +0100 -+++ m4/ltmain.sh 2013-02-21 11:36:37.000000000 +0100 -@@ -2507,6 +2507,7 @@ - - case $libobj in - *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; -+ *.gch) obj=$libobj ;; - *) - func_fatal_error "cannot determine name of library object from \`$libobj'" - ;; -@@ -2717,7 +2718,14 @@ - fi - - $opt_dry_run || { -- func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" -+ case $libobj in -+ *.gch) -+ ln -sF "$objdir/$objname" "$libobj" -+ ;; -+ *) -+ func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" -+ ;; -+ esac - - # Unlock the critical section if it was locked - if test "$need_locks" != no; then -- 2.40.0