From 6f2ea6bc081b918faf19ca19779177d57fa84f7c Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Tue, 2 Sep 2014 13:02:22 +0200 Subject: [PATCH] Fix build problems with Oracle Solaris Studio refs #6896 --- CMakeLists.txt | 2 ++ components/checker/checkercomponent.cpp | 2 +- components/compat/checkresultreader.cpp | 2 +- components/compat/compatlogger.cpp | 6 ++-- components/compat/externalcommandlistener.cpp | 2 +- components/compat/statusdatawriter.cpp | 24 +++++++-------- .../db_ido_mysql/idomysqlconnection.cpp | 2 +- .../db_ido_pgsql/idopgsqlconnection.cpp | 2 +- components/livestatus/commandstable.cpp | 6 ++-- components/livestatus/commentstable.cpp | 4 +-- components/livestatus/contactgroupstable.cpp | 2 +- components/livestatus/contactstable.cpp | 2 +- components/livestatus/downtimestable.cpp | 2 +- components/livestatus/endpointstable.cpp | 2 +- components/livestatus/hostgroupstable.cpp | 2 +- components/livestatus/hoststable.cpp | 2 +- components/livestatus/livestatuslistener.cpp | 2 +- components/livestatus/servicegroupstable.cpp | 2 +- components/livestatus/servicestable.cpp | 2 +- components/livestatus/statustable.cpp | 4 +-- components/livestatus/timeperiodstable.cpp | 2 +- .../notification/notificationcomponent.cpp | 4 +-- components/perfdata/graphitewriter.cpp | 2 +- components/perfdata/perfdatawriter.cpp | 2 +- config.h.cmake | 1 + lib/base/debug.hpp | 2 +- lib/base/dynamictype.hpp | 2 +- lib/base/exception.cpp | 18 ++++++------ lib/base/fifo.cpp | 6 ++-- lib/base/filelogger.cpp | 2 +- lib/base/scriptfunctionwrapper.hpp | 2 +- lib/base/stacktrace.cpp | 2 +- lib/base/sysloglogger.cpp | 2 +- lib/base/threadpool.cpp | 2 +- lib/base/utility.cpp | 20 +++++++------ lib/base/utility.hpp | 2 +- lib/base/value-operators.cpp | 2 +- lib/db_ido/dbconnection.cpp | 8 ++--- lib/icinga/apievents.cpp | 2 +- lib/icinga/checkable-comment.cpp | 4 +-- lib/icinga/checkable-downtime.cpp | 4 +-- lib/icinga/cib.cpp | 8 ++--- lib/icinga/dependency-apply.cpp | 4 +-- lib/icinga/hostgroup.cpp | 2 +- lib/icinga/icingaapplication.cpp | 2 +- lib/icinga/icingastatuswriter.cpp | 2 +- lib/icinga/notification-apply.cpp | 4 +-- lib/icinga/scheduleddowntime-apply.cpp | 4 +-- lib/icinga/scheduleddowntime.cpp | 2 +- lib/icinga/service-apply.cpp | 2 +- lib/icinga/servicegroup.cpp | 2 +- lib/icinga/timeperiod.cpp | 2 +- lib/icinga/usergroup.cpp | 2 +- lib/remote/apilistener-sync.cpp | 4 +-- lib/remote/apilistener.cpp | 16 +++++----- lib/remote/endpoint.cpp | 2 +- third-party/execvpe/execvpe.c | 5 +--- tools/mkclass/class_parser.yy | 29 +++++++++++-------- 58 files changed, 132 insertions(+), 125 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7739c6683..487e7528e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -116,6 +116,7 @@ set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/Bin/${CMAKE_BUILD_TYPE} CACHE PAT include(CheckSymbolExists) include(CheckFunctionExists) include(CheckLibraryExists) +include(CheckIncludeFileCXX) check_symbol_exists(__COUNTER__ "" HAVE_COUNTER_MACRO) @@ -129,6 +130,7 @@ check_function_exists(backtrace_symbols HAVE_BACKTRACE_SYMBOLS) check_function_exists(pipe2 HAVE_PIPE2) check_library_exists(dl dladdr "dlfcn.h" HAVE_DLADDR) check_library_exists(execinfo backtrace_symbols "" HAVE_LIBEXECINFO) +check_include_file_cxx(cxxabi.h HAVE_CXXABI_H) if(HAVE_LIBEXECINFO) set(HAVE_BACKTRACE_SYMBOLS TRUE) diff --git a/components/checker/checkercomponent.cpp b/components/checker/checkercomponent.cpp index abb4ac973..28ff0736e 100644 --- a/components/checker/checkercomponent.cpp +++ b/components/checker/checkercomponent.cpp @@ -40,7 +40,7 @@ Value CheckerComponent::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& perf { Dictionary::Ptr nodes = make_shared(); - BOOST_FOREACH(const CheckerComponent::Ptr& checker, DynamicType::GetObjects()) { + BOOST_FOREACH(const CheckerComponent::Ptr& checker, DynamicType::GetObjectsByType()) { unsigned long idle = checker->GetIdleCheckables(); unsigned long pending = checker->GetPendingCheckables(); diff --git a/components/compat/checkresultreader.cpp b/components/compat/checkresultreader.cpp index d9d9a198d..436593168 100644 --- a/components/compat/checkresultreader.cpp +++ b/components/compat/checkresultreader.cpp @@ -42,7 +42,7 @@ Value CheckResultReader::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr&) { Dictionary::Ptr nodes = make_shared(); - BOOST_FOREACH(const CheckResultReader::Ptr& checkresultreader, DynamicType::GetObjects()) { + BOOST_FOREACH(const CheckResultReader::Ptr& checkresultreader, DynamicType::GetObjectsByType()) { nodes->Set(checkresultreader->GetName(), 1); //add more stats } diff --git a/components/compat/compatlogger.cpp b/components/compat/compatlogger.cpp index 0f901cf07..969cc7448 100644 --- a/components/compat/compatlogger.cpp +++ b/components/compat/compatlogger.cpp @@ -49,7 +49,7 @@ Value CompatLogger::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr&) { Dictionary::Ptr nodes = make_shared(); - BOOST_FOREACH(const CompatLogger::Ptr& compat_logger, DynamicType::GetObjects()) { + BOOST_FOREACH(const CompatLogger::Ptr& compat_logger, DynamicType::GetObjectsByType()) { nodes->Set(compat_logger->GetName(), 1); //add more stats } @@ -450,7 +450,7 @@ void CompatLogger::ReopenFile(bool rotate) WriteLine("LOG ROTATION: " + GetRotationMethod()); WriteLine("LOG VERSION: 2.0"); - BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjects()) { + BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType()) { String output; CheckResult::Ptr cr = host->GetLastCheckResult(); @@ -468,7 +468,7 @@ void CompatLogger::ReopenFile(bool rotate) WriteLine(msgbuf.str()); } - BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjects()) { + BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType()) { Host::Ptr host = service->GetHost(); String output; diff --git a/components/compat/externalcommandlistener.cpp b/components/compat/externalcommandlistener.cpp index a4f76a4d9..c32dd36fd 100644 --- a/components/compat/externalcommandlistener.cpp +++ b/components/compat/externalcommandlistener.cpp @@ -35,7 +35,7 @@ Value ExternalCommandListener::StatsFunc(Dictionary::Ptr& status, Dictionary::Pt { Dictionary::Ptr nodes = make_shared(); - BOOST_FOREACH(const ExternalCommandListener::Ptr& externalcommandlistener, DynamicType::GetObjects()) { + BOOST_FOREACH(const ExternalCommandListener::Ptr& externalcommandlistener, DynamicType::GetObjectsByType()) { nodes->Set(externalcommandlistener->GetName(), 1); //add more stats } diff --git a/components/compat/statusdatawriter.cpp b/components/compat/statusdatawriter.cpp index b0b714bf6..328d9b9ec 100644 --- a/components/compat/statusdatawriter.cpp +++ b/components/compat/statusdatawriter.cpp @@ -52,7 +52,7 @@ Value StatusDataWriter::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr&) { Dictionary::Ptr nodes = make_shared(); - BOOST_FOREACH(const StatusDataWriter::Ptr& statusdatawriter, DynamicType::GetObjects()) { + BOOST_FOREACH(const StatusDataWriter::Ptr& statusdatawriter, DynamicType::GetObjectsByType()) { nodes->Set(statusdatawriter->GetName(), 1); //add more stats } @@ -543,7 +543,7 @@ void StatusDataWriter::UpdateObjectsCache(void) "# This file is auto-generated. Do not modify this file." "\n" "\n"; - BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjects()) { + BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType()) { std::ostringstream tempobjectfp; tempobjectfp << std::fixed; DumpHostObject(tempobjectfp, host); @@ -557,7 +557,7 @@ void StatusDataWriter::UpdateObjectsCache(void) } } - BOOST_FOREACH(const HostGroup::Ptr& hg, DynamicType::GetObjects()) { + BOOST_FOREACH(const HostGroup::Ptr& hg, DynamicType::GetObjectsByType()) { std::ostringstream tempobjectfp; tempobjectfp << std::fixed; @@ -588,7 +588,7 @@ void StatusDataWriter::UpdateObjectsCache(void) objectfp << tempobjectfp.str(); } - BOOST_FOREACH(const ServiceGroup::Ptr& sg, DynamicType::GetObjects()) { + BOOST_FOREACH(const ServiceGroup::Ptr& sg, DynamicType::GetObjectsByType()) { std::ostringstream tempobjectfp; tempobjectfp << std::fixed; @@ -629,7 +629,7 @@ void StatusDataWriter::UpdateObjectsCache(void) objectfp << tempobjectfp.str(); } - BOOST_FOREACH(const User::Ptr& user, DynamicType::GetObjects()) { + BOOST_FOREACH(const User::Ptr& user, DynamicType::GetObjectsByType()) { std::ostringstream tempobjectfp; tempobjectfp << std::fixed; @@ -657,7 +657,7 @@ void StatusDataWriter::UpdateObjectsCache(void) objectfp << tempobjectfp.str(); } - BOOST_FOREACH(const UserGroup::Ptr& ug, DynamicType::GetObjects()) { + BOOST_FOREACH(const UserGroup::Ptr& ug, DynamicType::GetObjectsByType()) { std::ostringstream tempobjectfp; tempobjectfp << std::fixed; @@ -673,23 +673,23 @@ void StatusDataWriter::UpdateObjectsCache(void) objectfp << tempobjectfp.str(); } - BOOST_FOREACH(const Command::Ptr& command, DynamicType::GetObjects()) { + BOOST_FOREACH(const Command::Ptr& command, DynamicType::GetObjectsByType()) { DumpCommand(objectfp, command); } - BOOST_FOREACH(const Command::Ptr& command, DynamicType::GetObjects()) { + BOOST_FOREACH(const Command::Ptr& command, DynamicType::GetObjectsByType()) { DumpCommand(objectfp, command); } - BOOST_FOREACH(const Command::Ptr& command, DynamicType::GetObjects()) { + BOOST_FOREACH(const Command::Ptr& command, DynamicType::GetObjectsByType()) { DumpCommand(objectfp, command); } - BOOST_FOREACH(const TimePeriod::Ptr& tp, DynamicType::GetObjects()) { + BOOST_FOREACH(const TimePeriod::Ptr& tp, DynamicType::GetObjectsByType()) { DumpTimePeriod(objectfp, tp); } - BOOST_FOREACH(const Dependency::Ptr& dep, DynamicType::GetObjects()) { + BOOST_FOREACH(const Dependency::Ptr& dep, DynamicType::GetObjectsByType()) { Checkable::Ptr parent = dep->GetParent(); if (!parent) { @@ -813,7 +813,7 @@ void StatusDataWriter::StatusTimerHandler(void) statusfp << "\t" "}" "\n" "\n"; - BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjects()) { + BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType()) { std::ostringstream tempstatusfp; tempstatusfp << std::fixed; DumpHostStatus(tempstatusfp, host); diff --git a/components/db_ido_mysql/idomysqlconnection.cpp b/components/db_ido_mysql/idomysqlconnection.cpp index fb6d61fa6..f8a82a68e 100644 --- a/components/db_ido_mysql/idomysqlconnection.cpp +++ b/components/db_ido_mysql/idomysqlconnection.cpp @@ -42,7 +42,7 @@ Value IdoMysqlConnection::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& pe { Dictionary::Ptr nodes = make_shared(); - BOOST_FOREACH(const IdoMysqlConnection::Ptr& idomysqlconnection, DynamicType::GetObjects()) { + BOOST_FOREACH(const IdoMysqlConnection::Ptr& idomysqlconnection, DynamicType::GetObjectsByType()) { size_t items = idomysqlconnection->m_QueryQueue.GetLength(); Dictionary::Ptr stats = make_shared(); diff --git a/components/db_ido_pgsql/idopgsqlconnection.cpp b/components/db_ido_pgsql/idopgsqlconnection.cpp index 8130da7c9..6c76071fc 100644 --- a/components/db_ido_pgsql/idopgsqlconnection.cpp +++ b/components/db_ido_pgsql/idopgsqlconnection.cpp @@ -44,7 +44,7 @@ Value IdoPgsqlConnection::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& pe { Dictionary::Ptr nodes = make_shared(); - BOOST_FOREACH(const IdoPgsqlConnection::Ptr& idopgsqlconnection, DynamicType::GetObjects()) { + BOOST_FOREACH(const IdoPgsqlConnection::Ptr& idopgsqlconnection, DynamicType::GetObjectsByType()) { size_t items = idopgsqlconnection->m_QueryQueue.GetLength(); Dictionary::Ptr stats = make_shared(); diff --git a/components/livestatus/commandstable.cpp b/components/livestatus/commandstable.cpp index 391a9c303..babb4d7a1 100644 --- a/components/livestatus/commandstable.cpp +++ b/components/livestatus/commandstable.cpp @@ -60,13 +60,13 @@ String CommandsTable::GetPrefix(void) const void CommandsTable::FetchRows(const AddRowFunction& addRowFn) { - BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects()) { + BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjectsByType()) { addRowFn(object); } - BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects()) { + BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjectsByType()) { addRowFn(object); } - BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects()) { + BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjectsByType()) { addRowFn(object); } } diff --git a/components/livestatus/commentstable.cpp b/components/livestatus/commentstable.cpp index 9cb05746d..71cf399f5 100644 --- a/components/livestatus/commentstable.cpp +++ b/components/livestatus/commentstable.cpp @@ -62,7 +62,7 @@ String CommentsTable::GetPrefix(void) const void CommentsTable::FetchRows(const AddRowFunction& addRowFn) { - BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjects()) { + BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType()) { Dictionary::Ptr comments = host->GetComments(); ObjectLock olock(comments); @@ -74,7 +74,7 @@ void CommentsTable::FetchRows(const AddRowFunction& addRowFn) } } - BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjects()) { + BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType()) { Dictionary::Ptr comments = service->GetComments(); ObjectLock olock(comments); diff --git a/components/livestatus/contactgroupstable.cpp b/components/livestatus/contactgroupstable.cpp index e2c7c29a7..bf1340a0d 100644 --- a/components/livestatus/contactgroupstable.cpp +++ b/components/livestatus/contactgroupstable.cpp @@ -49,7 +49,7 @@ String ContactGroupsTable::GetPrefix(void) const void ContactGroupsTable::FetchRows(const AddRowFunction& addRowFn) { - BOOST_FOREACH(const UserGroup::Ptr& ug, DynamicType::GetObjects()) { + BOOST_FOREACH(const UserGroup::Ptr& ug, DynamicType::GetObjectsByType()) { addRowFn(ug); } } diff --git a/components/livestatus/contactstable.cpp b/components/livestatus/contactstable.cpp index d1b0d3427..e62dc50ce 100644 --- a/components/livestatus/contactstable.cpp +++ b/components/livestatus/contactstable.cpp @@ -67,7 +67,7 @@ String ContactsTable::GetPrefix(void) const void ContactsTable::FetchRows(const AddRowFunction& addRowFn) { - BOOST_FOREACH(const User::Ptr& user, DynamicType::GetObjects()) { + BOOST_FOREACH(const User::Ptr& user, DynamicType::GetObjectsByType()) { addRowFn(user); } } diff --git a/components/livestatus/downtimestable.cpp b/components/livestatus/downtimestable.cpp index 0047c4bac..829261c49 100644 --- a/components/livestatus/downtimestable.cpp +++ b/components/livestatus/downtimestable.cpp @@ -62,7 +62,7 @@ String DowntimesTable::GetPrefix(void) const void DowntimesTable::FetchRows(const AddRowFunction& addRowFn) { - BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjects()) { + BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType()) { Dictionary::Ptr downtimes = service->GetDowntimes(); ObjectLock olock(downtimes); diff --git a/components/livestatus/endpointstable.cpp b/components/livestatus/endpointstable.cpp index d1d5492cc..c3d1e37dc 100644 --- a/components/livestatus/endpointstable.cpp +++ b/components/livestatus/endpointstable.cpp @@ -60,7 +60,7 @@ String EndpointsTable::GetPrefix(void) const void EndpointsTable::FetchRows(const AddRowFunction& addRowFn) { - BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjects()) { + BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjectsByType()) { addRowFn(endpoint); } } diff --git a/components/livestatus/hostgroupstable.cpp b/components/livestatus/hostgroupstable.cpp index 25b271c32..04b8c3b74 100644 --- a/components/livestatus/hostgroupstable.cpp +++ b/components/livestatus/hostgroupstable.cpp @@ -73,7 +73,7 @@ String HostGroupsTable::GetPrefix(void) const void HostGroupsTable::FetchRows(const AddRowFunction& addRowFn) { - BOOST_FOREACH(const HostGroup::Ptr& hg, DynamicType::GetObjects()) { + BOOST_FOREACH(const HostGroup::Ptr& hg, DynamicType::GetObjectsByType()) { addRowFn(hg); } } diff --git a/components/livestatus/hoststable.cpp b/components/livestatus/hoststable.cpp index 4140270e3..1359d3388 100644 --- a/components/livestatus/hoststable.cpp +++ b/components/livestatus/hoststable.cpp @@ -174,7 +174,7 @@ String HostsTable::GetPrefix(void) const void HostsTable::FetchRows(const AddRowFunction& addRowFn) { - BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjects()) { + BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType()) { addRowFn(host); } } diff --git a/components/livestatus/livestatuslistener.cpp b/components/livestatus/livestatuslistener.cpp index 40fe340fb..7ff0be005 100644 --- a/components/livestatus/livestatuslistener.cpp +++ b/components/livestatus/livestatuslistener.cpp @@ -47,7 +47,7 @@ Value LivestatusListener::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& pe { Dictionary::Ptr nodes = make_shared(); - BOOST_FOREACH(const LivestatusListener::Ptr& livestatuslistener, DynamicType::GetObjects()) { + BOOST_FOREACH(const LivestatusListener::Ptr& livestatuslistener, DynamicType::GetObjectsByType()) { Dictionary::Ptr stats = make_shared(); stats->Set("connections", l_Connections); diff --git a/components/livestatus/servicegroupstable.cpp b/components/livestatus/servicegroupstable.cpp index d5cb60f87..2769cb240 100644 --- a/components/livestatus/servicegroupstable.cpp +++ b/components/livestatus/servicegroupstable.cpp @@ -64,7 +64,7 @@ String ServiceGroupsTable::GetPrefix(void) const void ServiceGroupsTable::FetchRows(const AddRowFunction& addRowFn) { - BOOST_FOREACH(const ServiceGroup::Ptr& sg, DynamicType::GetObjects()) { + BOOST_FOREACH(const ServiceGroup::Ptr& sg, DynamicType::GetObjectsByType()) { addRowFn(sg); } } diff --git a/components/livestatus/servicestable.cpp b/components/livestatus/servicestable.cpp index 782a4dfc8..e001784e4 100644 --- a/components/livestatus/servicestable.cpp +++ b/components/livestatus/servicestable.cpp @@ -145,7 +145,7 @@ String ServicesTable::GetPrefix(void) const void ServicesTable::FetchRows(const AddRowFunction& addRowFn) { - BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjects()) { + BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType()) { addRowFn(service); } } diff --git a/components/livestatus/statustable.cpp b/components/livestatus/statustable.cpp index abdb2b9bd..08860e5f0 100644 --- a/components/livestatus/statustable.cpp +++ b/components/livestatus/statustable.cpp @@ -207,12 +207,12 @@ Value StatusTable::ProgramStartAccessor(const Value&) Value StatusTable::NumHostsAccessor(const Value&) { - return std::distance(DynamicType::GetObjects().first, DynamicType::GetObjects().second); + return std::distance(DynamicType::GetObjectsByType().first, DynamicType::GetObjectsByType().second); } Value StatusTable::NumServicesAccessor(const Value&) { - return std::distance(DynamicType::GetObjects().first, DynamicType::GetObjects().second); + return std::distance(DynamicType::GetObjectsByType().first, DynamicType::GetObjectsByType().second); } Value StatusTable::ProgramVersionAccessor(const Value&) diff --git a/components/livestatus/timeperiodstable.cpp b/components/livestatus/timeperiodstable.cpp index ad12f95d2..bca515d59 100644 --- a/components/livestatus/timeperiodstable.cpp +++ b/components/livestatus/timeperiodstable.cpp @@ -54,7 +54,7 @@ String TimePeriodsTable::GetPrefix(void) const void TimePeriodsTable::FetchRows(const AddRowFunction& addRowFn) { - BOOST_FOREACH(const TimePeriod::Ptr& tp, DynamicType::GetObjects()) { + BOOST_FOREACH(const TimePeriod::Ptr& tp, DynamicType::GetObjectsByType()) { addRowFn(tp); } } diff --git a/components/notification/notificationcomponent.cpp b/components/notification/notificationcomponent.cpp index efe0b66ea..73999421a 100644 --- a/components/notification/notificationcomponent.cpp +++ b/components/notification/notificationcomponent.cpp @@ -38,7 +38,7 @@ Value NotificationComponent::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& { Dictionary::Ptr nodes = make_shared(); - BOOST_FOREACH(const NotificationComponent::Ptr& notification_component, DynamicType::GetObjects()) { + BOOST_FOREACH(const NotificationComponent::Ptr& notification_component, DynamicType::GetObjectsByType()) { nodes->Set(notification_component->GetName(), 1); //add more stats } @@ -72,7 +72,7 @@ void NotificationComponent::NotificationTimerHandler(void) { double now = Utility::GetTime(); - BOOST_FOREACH(const Notification::Ptr& notification, DynamicType::GetObjects()) { + BOOST_FOREACH(const Notification::Ptr& notification, DynamicType::GetObjectsByType()) { Checkable::Ptr checkable = notification->GetCheckable(); if (checkable->IsPaused() && GetEnableHA()) diff --git a/components/perfdata/graphitewriter.cpp b/components/perfdata/graphitewriter.cpp index 61dca323b..b792c8d90 100644 --- a/components/perfdata/graphitewriter.cpp +++ b/components/perfdata/graphitewriter.cpp @@ -50,7 +50,7 @@ Value GraphiteWriter::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr&) { Dictionary::Ptr nodes = make_shared(); - BOOST_FOREACH(const GraphiteWriter::Ptr& graphitewriter, DynamicType::GetObjects()) { + BOOST_FOREACH(const GraphiteWriter::Ptr& graphitewriter, DynamicType::GetObjectsByType()) { nodes->Set(graphitewriter->GetName(), 1); //add more stats } diff --git a/components/perfdata/perfdatawriter.cpp b/components/perfdata/perfdatawriter.cpp index ea256e2c1..213d7b9bd 100644 --- a/components/perfdata/perfdatawriter.cpp +++ b/components/perfdata/perfdatawriter.cpp @@ -40,7 +40,7 @@ Value PerfdataWriter::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr&) { Dictionary::Ptr nodes = make_shared(); - BOOST_FOREACH(const PerfdataWriter::Ptr& perfdatawriter, DynamicType::GetObjects()) { + BOOST_FOREACH(const PerfdataWriter::Ptr& perfdatawriter, DynamicType::GetObjectsByType()) { nodes->Set(perfdatawriter->GetName(), 1); //add more stats } diff --git a/config.h.cmake b/config.h.cmake index 2c03a0ae9..0df4bb2c1 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -7,6 +7,7 @@ #cmakedefine HAVE_VFORK #cmakedefine HAVE_DLADDR #cmakedefine HAVE_LIBEXECINFO +#cmakedefine HAVE_CXXABI_H #cmakedefine ICINGA2_UNITY_BUILD diff --git a/lib/base/debug.hpp b/lib/base/debug.hpp index b1ede5649..82bfae40c 100644 --- a/lib/base/debug.hpp +++ b/lib/base/debug.hpp @@ -52,7 +52,7 @@ NORETURNPRE int icinga_assert_fail(const char *expr, const char *file, int line) inline int icinga_assert_fail(const char *expr, const char *file, int line) { fprintf(stderr, "%s:%d: assertion failed: %s\n", file, line, expr); - abort(); + std::abort(); #if !defined(__GNUC__) && !defined(_MSC_VER) return 0; diff --git a/lib/base/dynamictype.hpp b/lib/base/dynamictype.hpp index 5a9927f45..fd5271f59 100644 --- a/lib/base/dynamictype.hpp +++ b/lib/base/dynamictype.hpp @@ -53,7 +53,7 @@ public: std::pair, DynamicTypeIterator > GetObjects(void); template - static std::pair, DynamicTypeIterator > GetObjects(void) + static std::pair, DynamicTypeIterator > GetObjectsByType(void) { DynamicType::Ptr type = GetByName(T::GetTypeName()); return std::make_pair( diff --git a/lib/base/exception.cpp b/lib/base/exception.cpp index 633c8159a..a2a9c6a9b 100644 --- a/lib/base/exception.cpp +++ b/lib/base/exception.cpp @@ -20,24 +20,23 @@ #include "base/exception.hpp" #include -#ifndef _MSC_VER +#ifdef HAVE_CXXABI_H # include -#endif /* _MSC_VER */ +#endif /* HAVE_CXXABI_H */ using namespace icinga; static boost::thread_specific_ptr l_LastExceptionStack; static boost::thread_specific_ptr l_LastExceptionContext; -#ifndef _MSC_VER +#ifdef HAVE_CXXABI_H # if __clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ > 3) # define TYPEINFO_TYPE std::type_info # else # define TYPEINFO_TYPE void # endif -#endif /* _MSC_VER */ -#if !defined(__GLIBCXX__) && !defined(_WIN32) +# if !defined(__GLIBCXX__) && !defined(_WIN32) static boost::thread_specific_ptr l_LastExceptionObj; static boost::thread_specific_ptr l_LastExceptionPvtInfo; @@ -46,18 +45,19 @@ static boost::thread_specific_ptr l_LastExceptionDest; extern "C" void __cxa_throw(void *obj, TYPEINFO_TYPE *pvtinfo, void (*dest)(void *)); extern "C" void __cxa_rethrow_primary_exception(void* thrown_object); -#endif /* !__GLIBCXX__ && !_WIN32 */ +# endif /* !__GLIBCXX__ && !_WIN32 */ +#endif /* HAVE_CXXABI_H */ void icinga::RethrowUncaughtException(void) { -#if defined(__GLIBCXX__) || defined(_WIN32) +#if defined(__GLIBCXX__) || !defined(HAVE_CXXABI_H) throw; #else /* __GLIBCXX__ || _WIN32 */ __cxa_throw(*l_LastExceptionObj.get(), *l_LastExceptionPvtInfo.get(), *l_LastExceptionDest.get()); #endif /* __GLIBCXX__ || _WIN32 */ } -#ifndef _MSC_VER +#ifdef HAVE_CXXABI_H extern "C" void __cxa_throw(void *obj, TYPEINFO_TYPE *pvtinfo, void (*dest)(void *)) { @@ -108,7 +108,7 @@ void __cxa_throw(void *obj, TYPEINFO_TYPE *pvtinfo, void (*dest)(void *)) real_cxa_throw(obj, tinfo, dest); } -#endif /* _MSC_VER */ +#endif /* HAVE_CXXABI_H */ StackTrace *icinga::GetLastExceptionStack(void) { diff --git a/lib/base/fifo.cpp b/lib/base/fifo.cpp index c61e4a962..3f3d75d4a 100644 --- a/lib/base/fifo.cpp +++ b/lib/base/fifo.cpp @@ -68,7 +68,7 @@ void FIFO::ResizeBuffer(size_t newSize, bool decrease) void FIFO::Optimize(void) { if (m_DataSize < m_Offset) { - memcpy(m_Buffer, m_Buffer + m_Offset, m_DataSize); + std::memcpy(m_Buffer, m_Buffer + m_Offset, m_DataSize); m_Offset = 0; if (m_DataSize > 0) @@ -87,7 +87,7 @@ size_t FIFO::Read(void *buffer, size_t count) count = m_DataSize; if (buffer != NULL) - memcpy(buffer, m_Buffer + m_Offset, count); + std::memcpy(buffer, m_Buffer + m_Offset, count); m_DataSize -= count; m_Offset += count; @@ -103,7 +103,7 @@ size_t FIFO::Read(void *buffer, size_t count) void FIFO::Write(const void *buffer, size_t count) { ResizeBuffer(m_Offset + m_DataSize + count, false); - memcpy(m_Buffer + m_Offset + m_DataSize, buffer, count); + std::memcpy(m_Buffer + m_Offset + m_DataSize, buffer, count); m_DataSize += count; } diff --git a/lib/base/filelogger.cpp b/lib/base/filelogger.cpp index 123adeab7..e075e8cb2 100644 --- a/lib/base/filelogger.cpp +++ b/lib/base/filelogger.cpp @@ -33,7 +33,7 @@ Value FileLogger::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr&) { Dictionary::Ptr nodes = make_shared(); - BOOST_FOREACH(const FileLogger::Ptr& filelogger, DynamicType::GetObjects()) { + BOOST_FOREACH(const FileLogger::Ptr& filelogger, DynamicType::GetObjectsByType()) { nodes->Set(filelogger->GetName(), 1); //add more stats } diff --git a/lib/base/scriptfunctionwrapper.hpp b/lib/base/scriptfunctionwrapper.hpp index c250bdd7b..4f8002de2 100644 --- a/lib/base/scriptfunctionwrapper.hpp +++ b/lib/base/scriptfunctionwrapper.hpp @@ -271,7 +271,7 @@ boost::function& arguments)> WrapScriptFunction( template boost::function& arguments)> WrapScriptFunction(TR (*function)(const std::vector&)) { - return boost::bind(function, _1); + return boost::bind(function, _1); } inline boost::function& arguments)> WrapScriptFunction(void (*function)(const std::vector&)) diff --git a/lib/base/stacktrace.cpp b/lib/base/stacktrace.cpp index 92fcc0e58..2938d7e0d 100644 --- a/lib/base/stacktrace.cpp +++ b/lib/base/stacktrace.cpp @@ -139,7 +139,7 @@ void StackTrace::Print(std::ostream& fp, int ignoreFrames) const fp << "\t(" << i - ignoreFrames - 1 << ") " << message << std::endl; } - free(messages); + std::free(messages); fp << std::endl; # else /* HAVE_BACKTRACE_SYMBOLS */ diff --git a/lib/base/sysloglogger.cpp b/lib/base/sysloglogger.cpp index 80a69cd33..01a9cff0d 100644 --- a/lib/base/sysloglogger.cpp +++ b/lib/base/sysloglogger.cpp @@ -32,7 +32,7 @@ Value SyslogLogger::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr&) { Dictionary::Ptr nodes = make_shared(); - BOOST_FOREACH(const SyslogLogger::Ptr& sysloglogger, DynamicType::GetObjects()) { + BOOST_FOREACH(const SyslogLogger::Ptr& sysloglogger, DynamicType::GetObjectsByType()) { nodes->Set(sysloglogger->GetName(), 1); //add more stats } diff --git a/lib/base/threadpool.cpp b/lib/base/threadpool.cpp index c7adb9cd4..92fe9f4a1 100644 --- a/lib/base/threadpool.cpp +++ b/lib/base/threadpool.cpp @@ -268,7 +268,7 @@ void ThreadPool::ManagerThreadProc(void) avg_latency = 0; if (utilization < 60 || utilization > 80 || alive < 8) { - double wthreads = ceil((utilization * alive) / 80.0); + double wthreads = std::ceil((utilization * alive) / 80.0); int tthreads = wthreads - alive; diff --git a/lib/base/utility.cpp b/lib/base/utility.cpp index 86b0e0bd5..951389421 100644 --- a/lib/base/utility.cpp +++ b/lib/base/utility.cpp @@ -35,9 +35,9 @@ # include #endif /* __FreeBSD__ */ -#ifndef _MSC_VER +#ifdef HAVE_CXXABI_H # include -#endif /* _MSC_VER */ +#endif /* HAVE_CXXABI_H */ using namespace icinga; @@ -56,7 +56,7 @@ String Utility::DemangleSymbolName(const String& sym) { String result = sym; -#ifndef _MSC_VER +#ifdef HAVE_CXXABI_H int status; char *realname = abi::__cxa_demangle(sym.CStr(), 0, 0, &status); @@ -64,11 +64,13 @@ String Utility::DemangleSymbolName(const String& sym) result = String(realname); free(realname); } -#else /* _MSC_VER */ +#elif defined(_MSC_VER) /* HAVE_CXXABI_H */ CHAR output[256]; if (UnDecorateSymbolName(sym.CStr(), output, sizeof(output), UNDNAME_COMPLETE) > 0) result = output; +#else /* _MSC_VER */ + /* We're pretty much out of options here. */ #endif /* _MSC_VER */ return result; @@ -705,7 +707,7 @@ String Utility::NaturalJoin(const std::vector& tokens) return result; } -String Utility::FormatDuration(int duration) +String Utility::FormatDuration(double duration) { std::vector tokens; String result; @@ -713,19 +715,19 @@ String Utility::FormatDuration(int duration) if (duration >= 86400) { int days = duration / 86400; tokens.push_back(Convert::ToString(days) + (days != 1 ? " days" : " day")); - duration %= 86400; + duration = static_cast(duration) % 86400; } if (duration >= 3600) { int hours = duration / 3600; tokens.push_back(Convert::ToString(hours) + (hours != 1 ? " hours" : " hour")); - duration %= 3600; + duration = static_cast(duration) % 3600; } if (duration >= 60) { int minutes = duration / 60; tokens.push_back(Convert::ToString(minutes) + (minutes != 1 ? " minutes" : " minute")); - duration %= 60; + duration = static_cast(duration) % 60; } if (duration >= 1) { @@ -734,7 +736,7 @@ String Utility::FormatDuration(int duration) } if (tokens.size() == 0) { - int milliseconds = floor(duration * 1000); + int milliseconds = std::floor(duration * 1000); if (milliseconds >= 1) tokens.push_back(Convert::ToString(milliseconds) + (milliseconds != 1 ? " milliseconds" : " millisecond")); else diff --git a/lib/base/utility.hpp b/lib/base/utility.hpp index 361d17c4d..f9fa9eebb 100644 --- a/lib/base/utility.hpp +++ b/lib/base/utility.hpp @@ -95,7 +95,7 @@ public: static String NaturalJoin(const std::vector& tokens); - static String FormatDuration(int duration); + static String FormatDuration(double duration); static String FormatDateTime(const char *format, double ts); static String FormatErrorNumber(int code); diff --git a/lib/base/value-operators.cpp b/lib/base/value-operators.cpp index 72e72b981..8eb689bd3 100644 --- a/lib/base/value-operators.cpp +++ b/lib/base/value-operators.cpp @@ -49,7 +49,7 @@ Value::operator String(void) const case ValueEmpty: return String(); case ValueNumber: - fractional = modf(boost::get(m_Value), &integral); + fractional = std::modf(boost::get(m_Value), &integral); if (fractional != 0) return boost::lexical_cast(m_Value); diff --git a/lib/db_ido/dbconnection.cpp b/lib/db_ido/dbconnection.cpp index 7b2c45229..92dd437ff 100644 --- a/lib/db_ido/dbconnection.cpp +++ b/lib/db_ido/dbconnection.cpp @@ -143,10 +143,10 @@ void DbConnection::ProgramStatusHandler(void) query3.WhereCriteria->Set("instance_id", 0); /* DbConnection class fills in real ID */ DbObject::OnQuery(query3); - InsertRuntimeVariable("total_services", std::distance(DynamicType::GetObjects().first, DynamicType::GetObjects().second)); - InsertRuntimeVariable("total_scheduled_services", std::distance(DynamicType::GetObjects().first, DynamicType::GetObjects().second)); - InsertRuntimeVariable("total_hosts", std::distance(DynamicType::GetObjects().first, DynamicType::GetObjects().second)); - InsertRuntimeVariable("total_scheduled_hosts", std::distance(DynamicType::GetObjects().first, DynamicType::GetObjects().second)); + InsertRuntimeVariable("total_services", std::distance(DynamicType::GetObjectsByType().first, DynamicType::GetObjectsByType().second)); + InsertRuntimeVariable("total_scheduled_services", std::distance(DynamicType::GetObjectsByType().first, DynamicType::GetObjectsByType().second)); + InsertRuntimeVariable("total_hosts", std::distance(DynamicType::GetObjectsByType().first, DynamicType::GetObjectsByType().second)); + InsertRuntimeVariable("total_scheduled_hosts", std::distance(DynamicType::GetObjectsByType().first, DynamicType::GetObjectsByType().second)); Dictionary::Ptr vars = IcingaApplication::GetInstance()->GetVars(); diff --git a/lib/icinga/apievents.cpp b/lib/icinga/apievents.cpp index ac8048af4..e6801c994 100644 --- a/lib/icinga/apievents.cpp +++ b/lib/icinga/apievents.cpp @@ -1403,7 +1403,7 @@ void ApiEvents::RepositoryTimerHandler(void) Dictionary::Ptr repository = make_shared(); - BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjects()) { + BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType()) { Array::Ptr services = make_shared(); BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) { diff --git a/lib/icinga/checkable-comment.cpp b/lib/icinga/checkable-comment.cpp index ce60b91c1..736398c5f 100644 --- a/lib/icinga/checkable-comment.cpp +++ b/lib/icinga/checkable-comment.cpp @@ -234,11 +234,11 @@ void Checkable::RemoveExpiredComments(void) void Checkable::CommentsExpireTimerHandler(void) { - BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjects()) { + BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType()) { host->RemoveExpiredComments(); } - BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjects()) { + BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType()) { service->RemoveExpiredComments(); } } diff --git a/lib/icinga/checkable-downtime.cpp b/lib/icinga/checkable-downtime.cpp index 735cfade4..d793cf847 100644 --- a/lib/icinga/checkable-downtime.cpp +++ b/lib/icinga/checkable-downtime.cpp @@ -295,11 +295,11 @@ void Checkable::RemoveExpiredDowntimes(void) void Checkable::DowntimesExpireTimerHandler(void) { - BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjects()) { + BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType()) { host->RemoveExpiredDowntimes(); } - BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjects()) { + BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType()) { service->RemoveExpiredDowntimes(); } } diff --git a/lib/icinga/cib.cpp b/lib/icinga/cib.cpp index f0e2e8e66..c6dcae7a3 100644 --- a/lib/icinga/cib.cpp +++ b/lib/icinga/cib.cpp @@ -80,7 +80,7 @@ CheckableCheckStatistics CIB::CalculateHostCheckStats(void) double min_execution_time = -1, max_execution_time = 0, sum_execution_time = 0; int count_execution_time = 0; - BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjects()) { + BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType()) { ObjectLock olock(host); CheckResult::Ptr cr = host->GetLastCheckResult(); @@ -129,7 +129,7 @@ CheckableCheckStatistics CIB::CalculateServiceCheckStats(void) double min_execution_time = -1, max_execution_time = 0, sum_execution_time = 0; int count_execution_time = 0; - BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjects()) { + BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType()) { ObjectLock olock(service); CheckResult::Ptr cr = service->GetLastCheckResult(); @@ -175,7 +175,7 @@ ServiceStatistics CIB::CalculateServiceStats(void) { ServiceStatistics ss = {0}; - BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjects()) { + BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType()) { ObjectLock olock(service); CheckResult::Ptr cr = service->GetLastCheckResult(); @@ -209,7 +209,7 @@ HostStatistics CIB::CalculateHostStats(void) { HostStatistics hs = {0}; - BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjects()) { + BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType()) { ObjectLock olock(host); if (host->IsReachable()) { diff --git a/lib/icinga/dependency-apply.cpp b/lib/icinga/dependency-apply.cpp index 9a2509e22..27d74f04a 100644 --- a/lib/icinga/dependency-apply.cpp +++ b/lib/icinga/dependency-apply.cpp @@ -112,7 +112,7 @@ void Dependency::EvaluateApplyRule(const ApplyRule& rule) if (rule.GetTargetType() == "Host") { apply_count = 0; - BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjects()) { + BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType()) { CONTEXT("Evaluating 'apply' rules for host '" + host->GetName() + "'"); if (EvaluateApplyRuleOne(host, rule)) @@ -125,7 +125,7 @@ void Dependency::EvaluateApplyRule(const ApplyRule& rule) } else if (rule.GetTargetType() == "Service") { apply_count = 0; - BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjects()) { + BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType()) { CONTEXT("Evaluating 'apply' rules for Service '" + service->GetName() + "'"); if (EvaluateApplyRuleOne(service, rule)) diff --git a/lib/icinga/hostgroup.cpp b/lib/icinga/hostgroup.cpp index cb6cd209e..dc4d95ccb 100644 --- a/lib/icinga/hostgroup.cpp +++ b/lib/icinga/hostgroup.cpp @@ -74,7 +74,7 @@ bool HostGroup::EvaluateObjectRuleOne(const Host::Ptr& host, const ObjectRule& r void HostGroup::EvaluateObjectRule(const ObjectRule& rule) { - BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjects()) { + BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType()) { CONTEXT("Evaluating group membership in '" + rule.GetName() + "' for host '" + host->GetName() + "'"); EvaluateObjectRuleOne(host, rule); diff --git a/lib/icinga/icingaapplication.cpp b/lib/icinga/icingaapplication.cpp index de8ee47e6..f6c516665 100644 --- a/lib/icinga/icingaapplication.cpp +++ b/lib/icinga/icingaapplication.cpp @@ -67,7 +67,7 @@ Value IcingaApplication::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& per { Dictionary::Ptr nodes = make_shared(); - BOOST_FOREACH(const IcingaApplication::Ptr& icingaapplication, DynamicType::GetObjects()) { + BOOST_FOREACH(const IcingaApplication::Ptr& icingaapplication, DynamicType::GetObjectsByType()) { Dictionary::Ptr stats = make_shared(); stats->Set("node_name", icingaapplication->GetNodeName()); stats->Set("enable_notifications", icingaapplication->GetEnableNotifications()); diff --git a/lib/icinga/icingastatuswriter.cpp b/lib/icinga/icingastatuswriter.cpp index 9ab93b54f..f3c8283dd 100644 --- a/lib/icinga/icingastatuswriter.cpp +++ b/lib/icinga/icingastatuswriter.cpp @@ -38,7 +38,7 @@ Value IcingaStatusWriter::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& pe { Dictionary::Ptr nodes = make_shared(); - BOOST_FOREACH(const IcingaStatusWriter::Ptr& icingastatuswriter, DynamicType::GetObjects()) { + BOOST_FOREACH(const IcingaStatusWriter::Ptr& icingastatuswriter, DynamicType::GetObjectsByType()) { nodes->Set(icingastatuswriter->GetName(), 1); //add more stats } diff --git a/lib/icinga/notification-apply.cpp b/lib/icinga/notification-apply.cpp index 3af98fba9..57d9c37bd 100644 --- a/lib/icinga/notification-apply.cpp +++ b/lib/icinga/notification-apply.cpp @@ -107,7 +107,7 @@ void Notification::EvaluateApplyRule(const ApplyRule& rule) if (rule.GetTargetType() == "Host") { apply_count = 0; - BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjects()) { + BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType()) { CONTEXT("Evaluating 'apply' rules for host '" + host->GetName() + "'"); if (EvaluateApplyRuleOne(host, rule)) @@ -120,7 +120,7 @@ void Notification::EvaluateApplyRule(const ApplyRule& rule) } else if (rule.GetTargetType() == "Service") { apply_count = 0; - BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjects()) { + BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType()) { CONTEXT("Evaluating 'apply' rules for Service '" + service->GetName() + "'"); if (EvaluateApplyRuleOne(service, rule)) diff --git a/lib/icinga/scheduleddowntime-apply.cpp b/lib/icinga/scheduleddowntime-apply.cpp index 7d2ecae79..778f29833 100644 --- a/lib/icinga/scheduleddowntime-apply.cpp +++ b/lib/icinga/scheduleddowntime-apply.cpp @@ -107,7 +107,7 @@ void ScheduledDowntime::EvaluateApplyRules(const std::vector& rules) if (rule.GetTargetType() == "Host") { apply_count = 0; - BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjects()) { + BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType()) { CONTEXT("Evaluating 'apply' rules for host '" + host->GetName() + "'"); if (EvaluateApplyRule(host, rule)) @@ -120,7 +120,7 @@ void ScheduledDowntime::EvaluateApplyRules(const std::vector& rules) } else if (rule.GetTargetType() == "Service") { apply_count = 0; - BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjects()) { + BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType()) { CONTEXT("Evaluating 'apply' rules for Service '" + service->GetName() + "'"); if(EvaluateApplyRule(service, rule)) diff --git a/lib/icinga/scheduleddowntime.cpp b/lib/icinga/scheduleddowntime.cpp index 09bb8ecac..43f4113ae 100644 --- a/lib/icinga/scheduleddowntime.cpp +++ b/lib/icinga/scheduleddowntime.cpp @@ -71,7 +71,7 @@ void ScheduledDowntime::Start(void) void ScheduledDowntime::TimerProc(void) { - BOOST_FOREACH(const ScheduledDowntime::Ptr& sd, DynamicType::GetObjects()) { + BOOST_FOREACH(const ScheduledDowntime::Ptr& sd, DynamicType::GetObjectsByType()) { sd->CreateNextDowntime(); } } diff --git a/lib/icinga/service-apply.cpp b/lib/icinga/service-apply.cpp index 3034b52d9..65bc83faa 100644 --- a/lib/icinga/service-apply.cpp +++ b/lib/icinga/service-apply.cpp @@ -94,7 +94,7 @@ void Service::EvaluateApplyRule(const ApplyRule& rule) { int apply_count = 0; - BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjects()) { + BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType()) { CONTEXT("Evaluating 'apply' rules for host '" + host->GetName() + "'"); if (EvaluateApplyRuleOne(host, rule)) diff --git a/lib/icinga/servicegroup.cpp b/lib/icinga/servicegroup.cpp index 6a00651e9..d4455761d 100644 --- a/lib/icinga/servicegroup.cpp +++ b/lib/icinga/servicegroup.cpp @@ -77,7 +77,7 @@ bool ServiceGroup::EvaluateObjectRuleOne(const Service::Ptr& service, const Obje void ServiceGroup::EvaluateObjectRule(const ObjectRule& rule) { - BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjects()) { + BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType()) { CONTEXT("Evaluating group membership in '" + rule.GetName() + "' for service '" + service->GetName() + "'"); EvaluateObjectRuleOne(service, rule); diff --git a/lib/icinga/timeperiod.cpp b/lib/icinga/timeperiod.cpp index 085910266..c97707564 100644 --- a/lib/icinga/timeperiod.cpp +++ b/lib/icinga/timeperiod.cpp @@ -256,7 +256,7 @@ void TimePeriod::UpdateTimerHandler(void) { double now = Utility::GetTime(); - BOOST_FOREACH(const TimePeriod::Ptr& tp, DynamicType::GetObjects()) { + BOOST_FOREACH(const TimePeriod::Ptr& tp, DynamicType::GetObjectsByType()) { double valid_end; { diff --git a/lib/icinga/usergroup.cpp b/lib/icinga/usergroup.cpp index a9d5a96b3..9a6e8bbe0 100644 --- a/lib/icinga/usergroup.cpp +++ b/lib/icinga/usergroup.cpp @@ -74,7 +74,7 @@ bool UserGroup::EvaluateObjectRuleOne(const User::Ptr& user, const ObjectRule& r void UserGroup::EvaluateObjectRule(const ObjectRule& rule) { - BOOST_FOREACH(const User::Ptr& user, DynamicType::GetObjects()) { + BOOST_FOREACH(const User::Ptr& user, DynamicType::GetObjectsByType()) { CONTEXT("Evaluating group membership in '" + rule.GetName() + "' for user '" + user->GetName() + "'"); EvaluateObjectRuleOne(user, rule); diff --git a/lib/remote/apilistener-sync.cpp b/lib/remote/apilistener-sync.cpp index 2dad6d6d5..33fdc3535 100644 --- a/lib/remote/apilistener-sync.cpp +++ b/lib/remote/apilistener-sync.cpp @@ -129,7 +129,7 @@ void ApiListener::SyncZoneDir(const Zone::Ptr& zone) const void ApiListener::SyncZoneDirs(void) const { - BOOST_FOREACH(const Zone::Ptr& zone, DynamicType::GetObjects()) { + BOOST_FOREACH(const Zone::Ptr& zone, DynamicType::GetObjectsByType()) { if (!IsConfigMaster(zone)) continue; @@ -157,7 +157,7 @@ void ApiListener::SendConfigUpdate(const ApiClient::Ptr& aclient) String zonesDir = Application::GetLocalStateDir() + "/lib/icinga2/api/zones"; - BOOST_FOREACH(const Zone::Ptr& zone, DynamicType::GetObjects()) { + BOOST_FOREACH(const Zone::Ptr& zone, DynamicType::GetObjectsByType()) { String zoneDir = zonesDir + "/" + zone->GetName(); if (!zone->IsChildOf(azone) && !zone->IsGlobal()) { diff --git a/lib/remote/apilistener.cpp b/lib/remote/apilistener.cpp index a3b5b8475..64474390e 100644 --- a/lib/remote/apilistener.cpp +++ b/lib/remote/apilistener.cpp @@ -88,7 +88,7 @@ void ApiListener::OnConfigLoaded(void) */ void ApiListener::Start(void) { - if (std::distance(DynamicType::GetObjects().first, DynamicType::GetObjects().second) > 1) { + if (std::distance(DynamicType::GetObjectsByType().first, DynamicType::GetObjectsByType().second) > 1) { Log(LogCritical, "ApiListener", "Only one ApiListener object is allowed."); return; } @@ -118,7 +118,7 @@ void ApiListener::Start(void) ApiListener::Ptr ApiListener::GetInstance(void) { - BOOST_FOREACH(const ApiListener::Ptr& listener, DynamicType::GetObjects()) + BOOST_FOREACH(const ApiListener::Ptr& listener, DynamicType::GetObjectsByType()) return listener; return ApiListener::Ptr(); @@ -332,7 +332,7 @@ void ApiListener::ApiTimerHandler(void) BOOST_FOREACH(int ts, files) { bool need = false; - BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjects()) { + BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjectsByType()) { if (endpoint->GetName() == GetIdentity()) continue; @@ -355,7 +355,7 @@ void ApiListener::ApiTimerHandler(void) if (IsMaster()) { Zone::Ptr my_zone = Zone::GetLocalZone(); - BOOST_FOREACH(const Zone::Ptr& zone, DynamicType::GetObjects()) { + BOOST_FOREACH(const Zone::Ptr& zone, DynamicType::GetObjectsByType()) { /* only connect to endpoints in a) the same zone b) our parent zone c) immediate child zones */ if (my_zone != zone && my_zone != zone->GetParent() && zone != my_zone->GetParent()) continue; @@ -391,7 +391,7 @@ void ApiListener::ApiTimerHandler(void) } } - BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjects()) { + BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjectsByType()) { if (!endpoint->IsConnected()) continue; @@ -421,7 +421,7 @@ void ApiListener::ApiTimerHandler(void) Log(LogNotice, "ApiListener", "Current zone master: " + master->GetName()); std::vector names; - BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjects()) + BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjectsByType()) if (endpoint->IsConnected()) names.push_back(endpoint->GetName() + " (" + Convert::ToString(endpoint->GetClients().size()) + ")"); @@ -483,7 +483,7 @@ void ApiListener::SyncRelayMessage(const MessageOrigin& origin, const DynamicObj std::vector skippedEndpoints; std::set finishedZones; - BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjects()) { + BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjectsByType()) { /* don't relay messages to ourselves or disconnected endpoints */ if (endpoint->GetName() == GetIdentity() || !endpoint->IsConnected()) continue; @@ -744,7 +744,7 @@ std::pair ApiListener::GetStatus(void) Array::Ptr not_connected_endpoints = make_shared(); Array::Ptr connected_endpoints = make_shared(); - BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjects()) { + BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjectsByType()) { if (endpoint->GetName() == GetIdentity()) continue; diff --git a/lib/remote/endpoint.cpp b/lib/remote/endpoint.cpp index fa05bb9cc..59be36178 100644 --- a/lib/remote/endpoint.cpp +++ b/lib/remote/endpoint.cpp @@ -38,7 +38,7 @@ void Endpoint::OnConfigLoaded(void) { DynamicObject::OnConfigLoaded(); - BOOST_FOREACH(const Zone::Ptr& zone, DynamicType::GetObjects()) { + BOOST_FOREACH(const Zone::Ptr& zone, DynamicType::GetObjectsByType()) { const std::set members = zone->GetEndpoints(); if (members.empty()) diff --git a/third-party/execvpe/execvpe.c b/third-party/execvpe/execvpe.c index 64c0e86b2..705901df2 100644 --- a/third-party/execvpe/execvpe.c +++ b/third-party/execvpe/execvpe.c @@ -17,16 +17,13 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#ifdef __linux__ #include -#endif /* __linux */ #include #include #include #include #include #include -#include #include "execvpe.h" #if !defined(_MSC_VER) && !defined(HAVE_EXECVPE) @@ -37,7 +34,7 @@ static void scripts_argv (const char *file, char *const argv[], int argc, char **new_argv) { /* Construct an argument list for the shell. */ - new_argv[0] = (char *) _PATH_BSHELL; + new_argv[0] = (char *) "/bin/sh"; new_argv[1] = (char *) file; while (argc > 1) { diff --git a/tools/mkclass/class_parser.yy b/tools/mkclass/class_parser.yy index 1c45c4810..5ab6621c0 100644 --- a/tools/mkclass/class_parser.yy +++ b/tools/mkclass/class_parser.yy @@ -21,6 +21,11 @@ #include "classcompiler.hpp" #include #include +#include + +using std::malloc; +using std::free; +using std::exit; using namespace icinga; @@ -92,7 +97,7 @@ void yyerror(YYLTYPE *locp, ClassCompiler *, const char *err) std::cerr << "in " << locp->path << " at " << locp->first_line << ":" << locp->first_column << "-" << locp->last_line << ":" << locp->last_column << ": " << err << std::endl; - exit(1); + std::exit(1); } int yyparse(ClassCompiler *context); @@ -119,12 +124,12 @@ statements: /* empty */ statement: include { context->HandleInclude($1, yylloc); - free($1); + std::free($1); } | angle_include { context->HandleAngleInclude($1, yylloc); - free($1); + std::free($1); } | class { @@ -135,7 +140,7 @@ statement: include | code { context->HandleCode($1, yylloc); - free($1); + std::free($1); } ; @@ -154,7 +159,7 @@ angle_include: T_INCLUDE T_ANGLE_STRING namespace: T_NAMESPACE identifier '{' { context->HandleNamespaceBegin($2, yylloc); - free($2); + std::free($2); } statements '}' { @@ -173,16 +178,16 @@ class: class_attribute_list T_CLASS T_IDENTIFIER inherits_specifier type_base_sp $$ = new Klass(); $$->Name = $3; - free($3); + std::free($3); if ($4) { $$->Parent = $4; - free($4); + std::free($4); } if ($5) { $$->TypeBase = $5; - free($5); + std::free($5); } $$->Attributes = $1; @@ -243,14 +248,14 @@ class_field: field_attribute_list identifier identifier alternative_name_specifi field->Attributes = $1; field->Type = $2; - free($2); + std::free($2); field->Name = $3; - free($3); + std::free($3); if ($4) { field->AlternativeName = $4; - free($4); + std::free($4); } std::vector::const_iterator it; @@ -333,7 +338,7 @@ field_accessors: /* empty */ field_accessor: T_FIELD_ACCESSOR_TYPE T_STRING { $$ = new FieldAccessor(static_cast($1), $2); - free($2); + std::free($2); } ; -- 2.50.1