]> granicus.if.org Git - icinga2/commitdiff
Fix build problems with Oracle Solaris Studio
authorGunnar Beutner <gunnar.beutner@netways.de>
Tue, 2 Sep 2014 11:02:22 +0000 (13:02 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Tue, 2 Sep 2014 11:09:17 +0000 (13:09 +0200)
refs #6896

58 files changed:
CMakeLists.txt
components/checker/checkercomponent.cpp
components/compat/checkresultreader.cpp
components/compat/compatlogger.cpp
components/compat/externalcommandlistener.cpp
components/compat/statusdatawriter.cpp
components/db_ido_mysql/idomysqlconnection.cpp
components/db_ido_pgsql/idopgsqlconnection.cpp
components/livestatus/commandstable.cpp
components/livestatus/commentstable.cpp
components/livestatus/contactgroupstable.cpp
components/livestatus/contactstable.cpp
components/livestatus/downtimestable.cpp
components/livestatus/endpointstable.cpp
components/livestatus/hostgroupstable.cpp
components/livestatus/hoststable.cpp
components/livestatus/livestatuslistener.cpp
components/livestatus/servicegroupstable.cpp
components/livestatus/servicestable.cpp
components/livestatus/statustable.cpp
components/livestatus/timeperiodstable.cpp
components/notification/notificationcomponent.cpp
components/perfdata/graphitewriter.cpp
components/perfdata/perfdatawriter.cpp
config.h.cmake
lib/base/debug.hpp
lib/base/dynamictype.hpp
lib/base/exception.cpp
lib/base/fifo.cpp
lib/base/filelogger.cpp
lib/base/scriptfunctionwrapper.hpp
lib/base/stacktrace.cpp
lib/base/sysloglogger.cpp
lib/base/threadpool.cpp
lib/base/utility.cpp
lib/base/utility.hpp
lib/base/value-operators.cpp
lib/db_ido/dbconnection.cpp
lib/icinga/apievents.cpp
lib/icinga/checkable-comment.cpp
lib/icinga/checkable-downtime.cpp
lib/icinga/cib.cpp
lib/icinga/dependency-apply.cpp
lib/icinga/hostgroup.cpp
lib/icinga/icingaapplication.cpp
lib/icinga/icingastatuswriter.cpp
lib/icinga/notification-apply.cpp
lib/icinga/scheduleddowntime-apply.cpp
lib/icinga/scheduleddowntime.cpp
lib/icinga/service-apply.cpp
lib/icinga/servicegroup.cpp
lib/icinga/timeperiod.cpp
lib/icinga/usergroup.cpp
lib/remote/apilistener-sync.cpp
lib/remote/apilistener.cpp
lib/remote/endpoint.cpp
third-party/execvpe/execvpe.c
tools/mkclass/class_parser.yy

index 7739c66835fa1ab669988d0250cf5cfaf1c562a5..487e7528e5525402e3df4a74498199b16bb285ab 100644 (file)
@@ -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)
index abb4ac9739a5823ac65de04162bea80879999cc4..28ff0736eb896bfb25e570eecc16d975af7c5b53 100644 (file)
@@ -40,7 +40,7 @@ Value CheckerComponent::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& perf
 {
        Dictionary::Ptr nodes = make_shared<Dictionary>();
 
-       BOOST_FOREACH(const CheckerComponent::Ptr& checker, DynamicType::GetObjects<CheckerComponent>()) {
+       BOOST_FOREACH(const CheckerComponent::Ptr& checker, DynamicType::GetObjectsByType<CheckerComponent>()) {
                unsigned long idle = checker->GetIdleCheckables();
                unsigned long pending = checker->GetPendingCheckables();
 
index d9d9a198d768c97b41203c7474c5bd7dd72a2705..436593168ea6cddf771e99622893239cbcbedea6 100644 (file)
@@ -42,7 +42,7 @@ Value CheckResultReader::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr&)
 {
        Dictionary::Ptr nodes = make_shared<Dictionary>();
 
-       BOOST_FOREACH(const CheckResultReader::Ptr& checkresultreader, DynamicType::GetObjects<CheckResultReader>()) {
+       BOOST_FOREACH(const CheckResultReader::Ptr& checkresultreader, DynamicType::GetObjectsByType<CheckResultReader>()) {
                nodes->Set(checkresultreader->GetName(), 1); //add more stats
        }
 
index 0f901cf0761f98d7b37ac9ab15d30066995f634a..969cc74485ac4c5ef209a12116ec6e171c4bdcd3 100644 (file)
@@ -49,7 +49,7 @@ Value CompatLogger::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr&)
 {
        Dictionary::Ptr nodes = make_shared<Dictionary>();
 
-       BOOST_FOREACH(const CompatLogger::Ptr& compat_logger, DynamicType::GetObjects<CompatLogger>()) {
+       BOOST_FOREACH(const CompatLogger::Ptr& compat_logger, DynamicType::GetObjectsByType<CompatLogger>()) {
                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<Host>()) {
+       BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType<Host>()) {
                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<Service>()) {
+       BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType<Service>()) {
                Host::Ptr host = service->GetHost();
 
                String output;
index a4f76a4d9ae1c929529f8dba5b4a73dffc437f73..c32dd36fd611b965c71f1659a517e59a35a0e52d 100644 (file)
@@ -35,7 +35,7 @@ Value ExternalCommandListener::StatsFunc(Dictionary::Ptr& status, Dictionary::Pt
 {
        Dictionary::Ptr nodes = make_shared<Dictionary>();
 
-       BOOST_FOREACH(const ExternalCommandListener::Ptr& externalcommandlistener, DynamicType::GetObjects<ExternalCommandListener>()) {
+       BOOST_FOREACH(const ExternalCommandListener::Ptr& externalcommandlistener, DynamicType::GetObjectsByType<ExternalCommandListener>()) {
                nodes->Set(externalcommandlistener->GetName(), 1); //add more stats
        }
 
index b0b714bf67f702191c15100ce91af38feffdfade..328d9b9ec6161d2bd392180b8c06b48e616ab446 100644 (file)
@@ -52,7 +52,7 @@ Value StatusDataWriter::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr&)
 {
        Dictionary::Ptr nodes = make_shared<Dictionary>();
 
-       BOOST_FOREACH(const StatusDataWriter::Ptr& statusdatawriter, DynamicType::GetObjects<StatusDataWriter>()) {
+       BOOST_FOREACH(const StatusDataWriter::Ptr& statusdatawriter, DynamicType::GetObjectsByType<StatusDataWriter>()) {
                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<Host>()) {
+       BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType<Host>()) {
                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<HostGroup>()) {
+       BOOST_FOREACH(const HostGroup::Ptr& hg, DynamicType::GetObjectsByType<HostGroup>()) {
                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<ServiceGroup>()) {
+       BOOST_FOREACH(const ServiceGroup::Ptr& sg, DynamicType::GetObjectsByType<ServiceGroup>()) {
                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<User>()) {
+       BOOST_FOREACH(const User::Ptr& user, DynamicType::GetObjectsByType<User>()) {
                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<UserGroup>()) {
+       BOOST_FOREACH(const UserGroup::Ptr& ug, DynamicType::GetObjectsByType<UserGroup>()) {
                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<CheckCommand>()) {
+       BOOST_FOREACH(const Command::Ptr& command, DynamicType::GetObjectsByType<CheckCommand>()) {
                DumpCommand(objectfp, command);
        }
 
-       BOOST_FOREACH(const Command::Ptr& command, DynamicType::GetObjects<NotificationCommand>()) {
+       BOOST_FOREACH(const Command::Ptr& command, DynamicType::GetObjectsByType<NotificationCommand>()) {
                DumpCommand(objectfp, command);
        }
 
-       BOOST_FOREACH(const Command::Ptr& command, DynamicType::GetObjects<EventCommand>()) {
+       BOOST_FOREACH(const Command::Ptr& command, DynamicType::GetObjectsByType<EventCommand>()) {
                DumpCommand(objectfp, command);
        }
 
-       BOOST_FOREACH(const TimePeriod::Ptr& tp, DynamicType::GetObjects<TimePeriod>()) {
+       BOOST_FOREACH(const TimePeriod::Ptr& tp, DynamicType::GetObjectsByType<TimePeriod>()) {
                DumpTimePeriod(objectfp, tp);
        }
 
-       BOOST_FOREACH(const Dependency::Ptr& dep, DynamicType::GetObjects<Dependency>()) {
+       BOOST_FOREACH(const Dependency::Ptr& dep, DynamicType::GetObjectsByType<Dependency>()) {
                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<Host>()) {
+       BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType<Host>()) {
                std::ostringstream tempstatusfp;
                tempstatusfp << std::fixed;
                DumpHostStatus(tempstatusfp, host);
index fb6d61fa68d74a79d4205c82e52c990f4cb73350..f8a82a68efb2ecc60e963ef2edcfcf825085bba3 100644 (file)
@@ -42,7 +42,7 @@ Value IdoMysqlConnection::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& pe
 {
        Dictionary::Ptr nodes = make_shared<Dictionary>();
 
-       BOOST_FOREACH(const IdoMysqlConnection::Ptr& idomysqlconnection, DynamicType::GetObjects<IdoMysqlConnection>()) {
+       BOOST_FOREACH(const IdoMysqlConnection::Ptr& idomysqlconnection, DynamicType::GetObjectsByType<IdoMysqlConnection>()) {
                size_t items = idomysqlconnection->m_QueryQueue.GetLength();
 
                Dictionary::Ptr stats = make_shared<Dictionary>();
index 8130da7c98d9d97617ea16f5111987ab83d98462..6c76071fca0a3a7e43ba907900d05fe3254d1d81 100644 (file)
@@ -44,7 +44,7 @@ Value IdoPgsqlConnection::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& pe
 {
        Dictionary::Ptr nodes = make_shared<Dictionary>();
 
-       BOOST_FOREACH(const IdoPgsqlConnection::Ptr& idopgsqlconnection, DynamicType::GetObjects<IdoPgsqlConnection>()) {
+       BOOST_FOREACH(const IdoPgsqlConnection::Ptr& idopgsqlconnection, DynamicType::GetObjectsByType<IdoPgsqlConnection>()) {
                size_t items = idopgsqlconnection->m_QueryQueue.GetLength();
 
                Dictionary::Ptr stats = make_shared<Dictionary>();
index 391a9c303babb9ef4e0ac19874612e7f69b2304d..babb4d7a1b54322003a9c89bfb0a8321945f264a 100644 (file)
@@ -60,13 +60,13 @@ String CommandsTable::GetPrefix(void) const
 
 void CommandsTable::FetchRows(const AddRowFunction& addRowFn)
 {
-       BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects<CheckCommand>()) {
+       BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjectsByType<CheckCommand>()) {
                addRowFn(object);
        }
-       BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects<EventCommand>()) {
+       BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjectsByType<EventCommand>()) {
                addRowFn(object);
        }
-       BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects<NotificationCommand>()) {
+       BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjectsByType<NotificationCommand>()) {
                addRowFn(object);
        }
 }
index 9cb05746dfad873eea487c400388e7956bd382ac..71cf399f55f62184464732e5079c284c62a01e0d 100644 (file)
@@ -62,7 +62,7 @@ String CommentsTable::GetPrefix(void) const
 
 void CommentsTable::FetchRows(const AddRowFunction& addRowFn)
 {
-       BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjects<Host>()) {
+       BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType<Host>()) {
                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<Service>()) {
+       BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType<Service>()) {
                Dictionary::Ptr comments = service->GetComments();
 
                ObjectLock olock(comments);
index e2c7c29a7191659dd0b06162003468c3f5e5cd7f..bf1340a0dbf2425a56e6281b975b140651f05394 100644 (file)
@@ -49,7 +49,7 @@ String ContactGroupsTable::GetPrefix(void) const
 
 void ContactGroupsTable::FetchRows(const AddRowFunction& addRowFn)
 {
-       BOOST_FOREACH(const UserGroup::Ptr& ug, DynamicType::GetObjects<UserGroup>()) {
+       BOOST_FOREACH(const UserGroup::Ptr& ug, DynamicType::GetObjectsByType<UserGroup>()) {
                addRowFn(ug);
        }
 }
index d1b0d3427ba1c5c9e32a2b8006cc208e60a1c3a1..e62dc50ce16eddef7722edc4d000f4f7e59e5aba 100644 (file)
@@ -67,7 +67,7 @@ String ContactsTable::GetPrefix(void) const
 
 void ContactsTable::FetchRows(const AddRowFunction& addRowFn)
 {
-       BOOST_FOREACH(const User::Ptr& user, DynamicType::GetObjects<User>()) {
+       BOOST_FOREACH(const User::Ptr& user, DynamicType::GetObjectsByType<User>()) {
                addRowFn(user);
        }
 }
index 0047c4bac4d389eed30ef4de32c5158dbb92bdfe..829261c49689c2f0413e2af2b02740ee29295de8 100644 (file)
@@ -62,7 +62,7 @@ String DowntimesTable::GetPrefix(void) const
 
 void DowntimesTable::FetchRows(const AddRowFunction& addRowFn)
 {
-       BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjects<Service>()) {
+       BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType<Service>()) {
                Dictionary::Ptr downtimes = service->GetDowntimes();
 
                ObjectLock olock(downtimes);
index d1d5492cc0fddfc5b9f7d0613daa2bd15af03d79..c3d1e37dc5e96c4553a06f13dc44395021cce249 100644 (file)
@@ -60,7 +60,7 @@ String EndpointsTable::GetPrefix(void) const
 
 void EndpointsTable::FetchRows(const AddRowFunction& addRowFn)
 {
-       BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjects<Endpoint>()) {
+       BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjectsByType<Endpoint>()) {
                addRowFn(endpoint);
        }
 }
index 25b271c32eb487da46dfc0c4723a9ef1a9bbb8ca..04b8c3b746443a44cfbce11b1fd6c5981418d693 100644 (file)
@@ -73,7 +73,7 @@ String HostGroupsTable::GetPrefix(void) const
 
 void HostGroupsTable::FetchRows(const AddRowFunction& addRowFn)
 {
-       BOOST_FOREACH(const HostGroup::Ptr& hg, DynamicType::GetObjects<HostGroup>()) {
+       BOOST_FOREACH(const HostGroup::Ptr& hg, DynamicType::GetObjectsByType<HostGroup>()) {
                addRowFn(hg);
        }
 }
index 4140270e38c63f555136a8924036938d025c4be7..1359d33880bc2aea551355cb411971527ffebc37 100644 (file)
@@ -174,7 +174,7 @@ String HostsTable::GetPrefix(void) const
 
 void HostsTable::FetchRows(const AddRowFunction& addRowFn)
 {
-       BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjects<Host>()) {
+       BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType<Host>()) {
                addRowFn(host);
        }
 }
index 40fe340fb199695185e79fe606bd8664c665c11b..7ff0be00500ac8844c7f8d6b96d7a286d149d12b 100644 (file)
@@ -47,7 +47,7 @@ Value LivestatusListener::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& pe
 {
        Dictionary::Ptr nodes = make_shared<Dictionary>();
 
-       BOOST_FOREACH(const LivestatusListener::Ptr& livestatuslistener, DynamicType::GetObjects<LivestatusListener>()) {
+       BOOST_FOREACH(const LivestatusListener::Ptr& livestatuslistener, DynamicType::GetObjectsByType<LivestatusListener>()) {
                Dictionary::Ptr stats = make_shared<Dictionary>();
                stats->Set("connections", l_Connections);
 
index d5cb60f87fce55abd8d694cb58ec44cfc198109b..2769cb240fac95b7abcd26663288bbcf780f38c7 100644 (file)
@@ -64,7 +64,7 @@ String ServiceGroupsTable::GetPrefix(void) const
 
 void ServiceGroupsTable::FetchRows(const AddRowFunction& addRowFn)
 {
-       BOOST_FOREACH(const ServiceGroup::Ptr& sg, DynamicType::GetObjects<ServiceGroup>()) {
+       BOOST_FOREACH(const ServiceGroup::Ptr& sg, DynamicType::GetObjectsByType<ServiceGroup>()) {
                addRowFn(sg);
        }
 }
index 782a4dfc82e3d050f253f8df72b16fead3934015..e001784e4271b4fbc760ad738d202d3b80250716 100644 (file)
@@ -145,7 +145,7 @@ String ServicesTable::GetPrefix(void) const
 
 void ServicesTable::FetchRows(const AddRowFunction& addRowFn)
 {
-       BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjects<Service>()) {
+       BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType<Service>()) {
                addRowFn(service);
        }
 }
index abdb2b9bd0712cc4082e19dfa20f5c0ec8af3e6c..08860e5f0027bd83f2211f3a92f6337fc9944723 100644 (file)
@@ -207,12 +207,12 @@ Value StatusTable::ProgramStartAccessor(const Value&)
 
 Value StatusTable::NumHostsAccessor(const Value&)
 {
-       return std::distance(DynamicType::GetObjects<Host>().first, DynamicType::GetObjects<Host>().second);
+       return std::distance(DynamicType::GetObjectsByType<Host>().first, DynamicType::GetObjectsByType<Host>().second);
 }
 
 Value StatusTable::NumServicesAccessor(const Value&)
 {
-       return std::distance(DynamicType::GetObjects<Service>().first, DynamicType::GetObjects<Service>().second);
+       return std::distance(DynamicType::GetObjectsByType<Service>().first, DynamicType::GetObjectsByType<Service>().second);
 }
 
 Value StatusTable::ProgramVersionAccessor(const Value&)
index ad12f95d264fbe3db1b40bc97909fc3bb868d270..bca515d59894d7be39798746164993cf617fd9c8 100644 (file)
@@ -54,7 +54,7 @@ String TimePeriodsTable::GetPrefix(void) const
 
 void TimePeriodsTable::FetchRows(const AddRowFunction& addRowFn)
 {
-       BOOST_FOREACH(const TimePeriod::Ptr& tp, DynamicType::GetObjects<TimePeriod>()) {
+       BOOST_FOREACH(const TimePeriod::Ptr& tp, DynamicType::GetObjectsByType<TimePeriod>()) {
                addRowFn(tp);
        }
 }
index efe0b66ea41f9ec81f7f1e5f8f4928f784c626f2..73999421af57df9264f8b54d206c39a374924c5b 100644 (file)
@@ -38,7 +38,7 @@ Value NotificationComponent::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr&
 {
        Dictionary::Ptr nodes = make_shared<Dictionary>();
 
-       BOOST_FOREACH(const NotificationComponent::Ptr& notification_component, DynamicType::GetObjects<NotificationComponent>()) {
+       BOOST_FOREACH(const NotificationComponent::Ptr& notification_component, DynamicType::GetObjectsByType<NotificationComponent>()) {
                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<Notification>()) {
+       BOOST_FOREACH(const Notification::Ptr& notification, DynamicType::GetObjectsByType<Notification>()) {
                Checkable::Ptr checkable = notification->GetCheckable();
 
                if (checkable->IsPaused() && GetEnableHA())
index 61dca323b6d188b8483b49f79375de88d9c3887a..b792c8d9008f6b9f349d15812156afbee64aff6e 100644 (file)
@@ -50,7 +50,7 @@ Value GraphiteWriter::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr&)
 {
        Dictionary::Ptr nodes = make_shared<Dictionary>();
 
-       BOOST_FOREACH(const GraphiteWriter::Ptr& graphitewriter, DynamicType::GetObjects<GraphiteWriter>()) {
+       BOOST_FOREACH(const GraphiteWriter::Ptr& graphitewriter, DynamicType::GetObjectsByType<GraphiteWriter>()) {
                nodes->Set(graphitewriter->GetName(), 1); //add more stats
        }
 
index ea256e2c105d5f870d0b08acddc9c349ff451430..213d7b9bd4f360343509a56f9bb970dd48248607 100644 (file)
@@ -40,7 +40,7 @@ Value PerfdataWriter::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr&)
 {
        Dictionary::Ptr nodes = make_shared<Dictionary>();
 
-       BOOST_FOREACH(const PerfdataWriter::Ptr& perfdatawriter, DynamicType::GetObjects<PerfdataWriter>()) {
+       BOOST_FOREACH(const PerfdataWriter::Ptr& perfdatawriter, DynamicType::GetObjectsByType<PerfdataWriter>()) {
                nodes->Set(perfdatawriter->GetName(), 1); //add more stats
        }
 
index 2c03a0ae9a6167f39974e51882b1530974550443..0df4bb2c1007041df87e30e45aaf88453bfdbf23 100644 (file)
@@ -7,6 +7,7 @@
 #cmakedefine HAVE_VFORK
 #cmakedefine HAVE_DLADDR
 #cmakedefine HAVE_LIBEXECINFO
+#cmakedefine HAVE_CXXABI_H
 
 #cmakedefine ICINGA2_UNITY_BUILD
 
index b1ede56494baa2d3a6cfd28f1d3d8ddb12bdb4df..82bfae40ca496ce108fc5a5ee48d454c48ed03f3 100644 (file)
@@ -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;
index 5a9927f4567bad22082cd958f528bc1df322b8a8..fd5271f59a640eaae2f62f0fb7ad71dbd8ff8dff 100644 (file)
@@ -53,7 +53,7 @@ public:
        std::pair<DynamicTypeIterator<DynamicObject>, DynamicTypeIterator<DynamicObject> > GetObjects(void);
 
        template<typename T>
-       static std::pair<DynamicTypeIterator<T>, DynamicTypeIterator<T> > GetObjects(void)
+       static std::pair<DynamicTypeIterator<T>, DynamicTypeIterator<T> > GetObjectsByType(void)
        {
                DynamicType::Ptr type = GetByName(T::GetTypeName());
                return std::make_pair(
index 633c8159aeb4eb95bb86b17e47de0556d2dbde58..a2a9c6a9be41a0559b5a3184d880be5c58e34cfc 100644 (file)
 #include "base/exception.hpp"
 #include <boost/thread/tss.hpp>
 
-#ifndef _MSC_VER
+#ifdef HAVE_CXXABI_H
 #      include <cxxabi.h>
-#endif /* _MSC_VER */
+#endif /* HAVE_CXXABI_H */
 
 using namespace icinga;
 
 static boost::thread_specific_ptr<StackTrace> l_LastExceptionStack;
 static boost::thread_specific_ptr<ContextTrace> 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<void *> l_LastExceptionObj;
 static boost::thread_specific_ptr<TYPEINFO_TYPE *> l_LastExceptionPvtInfo;
 
@@ -46,18 +45,19 @@ static boost::thread_specific_ptr<DestCallback> 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)
 {
index c61e4a962c9e20e577a881bd267858bc4d70fc42..3f3d75d4ae8c61149616d42e94126c6231aaf71e 100644 (file)
@@ -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;
 }
 
index 123adeab7f92f7f775d35a61dbe1f3f75ac445c7..e075e8cb2a0f3a989b6fead81f696b37d7562afe 100644 (file)
@@ -33,7 +33,7 @@ Value FileLogger::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr&)
 {
        Dictionary::Ptr nodes = make_shared<Dictionary>();
 
-       BOOST_FOREACH(const FileLogger::Ptr& filelogger, DynamicType::GetObjects<FileLogger>()) {
+       BOOST_FOREACH(const FileLogger::Ptr& filelogger, DynamicType::GetObjectsByType<FileLogger>()) {
                nodes->Set(filelogger->GetName(), 1); //add more stats
        }
 
index c250bdd7bd6342954721f4fe84860745c8558caf..4f8002de2ca4421d573430dcf589820e5432c25f 100644 (file)
@@ -271,7 +271,7 @@ boost::function<Value (const std::vector<Value>& arguments)> WrapScriptFunction(
 template<typename TR>
 boost::function<TR (const std::vector<Value>& arguments)> WrapScriptFunction(TR (*function)(const std::vector<Value>&))
 {
-       return boost::bind(function, _1);
+       return boost::bind<TR>(function, _1);
 }
 
 inline boost::function<Value (const std::vector<Value>& arguments)> WrapScriptFunction(void (*function)(const std::vector<Value>&))
index 92fcc0e5891135ffd1a38e9df3e0cc6a60bf77a1..2938d7e0d09e937b3a5578345c5142dca95e52be 100644 (file)
@@ -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 */
index 80a69cd339f76b2f2d2e70b52408c683c8bf9425..01a9cff0dd0f1cb4819e4ed0061b540556651473 100644 (file)
@@ -32,7 +32,7 @@ Value SyslogLogger::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr&)
 {
        Dictionary::Ptr nodes = make_shared<Dictionary>();
 
-       BOOST_FOREACH(const SyslogLogger::Ptr& sysloglogger, DynamicType::GetObjects<SyslogLogger>()) {
+       BOOST_FOREACH(const SyslogLogger::Ptr& sysloglogger, DynamicType::GetObjectsByType<SyslogLogger>()) {
                nodes->Set(sysloglogger->GetName(), 1); //add more stats
        }
 
index c7adb9cd41bd6dc7521ebeec20ca6b0057514632..92fe9f4a16b76eaf7211a0660a4ca34c088f3cfa 100644 (file)
@@ -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;
 
index 86b0e0bd581c905fc94c18280dda06f61108f4ec..951389421a2486d547085da33bf1d5a35bd0e124 100644 (file)
@@ -35,9 +35,9 @@
 #      include <pthread_np.h>
 #endif /* __FreeBSD__ */
 
-#ifndef _MSC_VER
+#ifdef HAVE_CXXABI_H
 #      include <cxxabi.h>
-#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<String>& tokens)
        return result;
 }
 
-String Utility::FormatDuration(int duration)
+String Utility::FormatDuration(double duration)
 {
        std::vector<String> 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<int>(duration) % 86400;
        }
 
        if (duration >= 3600) {
                int hours = duration / 3600;
                tokens.push_back(Convert::ToString(hours) + (hours != 1 ? " hours" : " hour"));
-               duration %= 3600;
+               duration = static_cast<int>(duration) % 3600;
        }
 
        if (duration >= 60) {
                int minutes = duration / 60;
                tokens.push_back(Convert::ToString(minutes) + (minutes != 1 ? " minutes" : " minute"));
-               duration %= 60;
+               duration = static_cast<int>(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
index 361d17c4d2227af7387807541657794f58065be7..f9fa9eebb6771d415a8b03fe7b4e0913137056c3 100644 (file)
@@ -95,7 +95,7 @@ public:
 
        static String NaturalJoin(const std::vector<String>& tokens);
 
-       static String FormatDuration(int duration);
+       static String FormatDuration(double duration);
        static String FormatDateTime(const char *format, double ts);
        static String FormatErrorNumber(int code);
 
index 72e72b981bcc7ae66217030306042a2a411adc27..8eb689bd3b79470cbd821fd9e69edde30c786a11 100644 (file)
@@ -49,7 +49,7 @@ Value::operator String(void) const
                case ValueEmpty:
                        return String();
                case ValueNumber:
-                       fractional = modf(boost::get<double>(m_Value), &integral);
+                       fractional = std::modf(boost::get<double>(m_Value), &integral);
 
                        if (fractional != 0)
                                return boost::lexical_cast<std::string>(m_Value);
index 7b2c45229c1e036ee13cbd2197f1da0c3e9eb1f7..92dd437ffb4afdfb837dabf650ec7d0bc9aff7d3 100644 (file)
@@ -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<Service>().first, DynamicType::GetObjects<Service>().second));
-       InsertRuntimeVariable("total_scheduled_services", std::distance(DynamicType::GetObjects<Service>().first, DynamicType::GetObjects<Service>().second));
-       InsertRuntimeVariable("total_hosts", std::distance(DynamicType::GetObjects<Host>().first, DynamicType::GetObjects<Host>().second));
-       InsertRuntimeVariable("total_scheduled_hosts", std::distance(DynamicType::GetObjects<Host>().first, DynamicType::GetObjects<Host>().second));
+       InsertRuntimeVariable("total_services", std::distance(DynamicType::GetObjectsByType<Service>().first, DynamicType::GetObjectsByType<Service>().second));
+       InsertRuntimeVariable("total_scheduled_services", std::distance(DynamicType::GetObjectsByType<Service>().first, DynamicType::GetObjectsByType<Service>().second));
+       InsertRuntimeVariable("total_hosts", std::distance(DynamicType::GetObjectsByType<Host>().first, DynamicType::GetObjectsByType<Host>().second));
+       InsertRuntimeVariable("total_scheduled_hosts", std::distance(DynamicType::GetObjectsByType<Host>().first, DynamicType::GetObjectsByType<Host>().second));
 
        Dictionary::Ptr vars = IcingaApplication::GetInstance()->GetVars();
 
index ac8048af474ead0fc6e5a621112aa40bb451755b..e6801c9942c13a6b2fe4615c82de14ead6999229 100644 (file)
@@ -1403,7 +1403,7 @@ void ApiEvents::RepositoryTimerHandler(void)
 
        Dictionary::Ptr repository = make_shared<Dictionary>();
 
-       BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjects<Host>()) {
+       BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType<Host>()) {
                Array::Ptr services = make_shared<Array>();
 
                BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
index ce60b91c13cef422302734f3958f8594038e58e3..736398c5f8c242e0533d6da3768ff8974470a4a9 100644 (file)
@@ -234,11 +234,11 @@ void Checkable::RemoveExpiredComments(void)
 
 void Checkable::CommentsExpireTimerHandler(void)
 {
-       BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjects<Host>()) {
+       BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType<Host>()) {
                host->RemoveExpiredComments();
        }
 
-       BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjects<Service>()) {
+       BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType<Service>()) {
                service->RemoveExpiredComments();
        }
 }
index 735cfade47d5c87d7b3d76321a77ce2e3cae3273..d793cf847a4ba524b8437a9d9e8905f1f7a8898a 100644 (file)
@@ -295,11 +295,11 @@ void Checkable::RemoveExpiredDowntimes(void)
 
 void Checkable::DowntimesExpireTimerHandler(void)
 {
-       BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjects<Host>()) {
+       BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType<Host>()) {
                host->RemoveExpiredDowntimes();
        }
 
-       BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjects<Service>()) {
+       BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType<Service>()) {
                service->RemoveExpiredDowntimes();
        }
 }
index f0e2e8e6670ed5869bedd3d619e23796170c28cd..c6dcae7a3c8681c0c569d6895d834bc1e832ac6e 100644 (file)
@@ -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<Host>()) {
+       BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType<Host>()) {
                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<Service>()) {
+       BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType<Service>()) {
                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<Service>()) {
+       BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType<Service>()) {
                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<Host>()) {
+       BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType<Host>()) {
                ObjectLock olock(host);
 
                if (host->IsReachable()) {
index 9a2509e22752057328d93938bd3130a4f5fcb2ce..27d74f04a995751649f41ea67d515bc6ab31740a 100644 (file)
@@ -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<Host>()) {
+               BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType<Host>()) {
                        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<Service>()) {
+               BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType<Service>()) {
                        CONTEXT("Evaluating 'apply' rules for Service '" + service->GetName() + "'");
 
                        if (EvaluateApplyRuleOne(service, rule))
index cb6cd209ec8645f5a7c612fc2bb228394d683df5..dc4d95ccb7ad8e1d1dd68f9f491469858ffcd67e 100644 (file)
@@ -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<Host>()) {
+       BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType<Host>()) {
                CONTEXT("Evaluating group membership in '" + rule.GetName() + "' for host '" + host->GetName() + "'");
 
                EvaluateObjectRuleOne(host, rule);
index de8ee47e652462b205ae494af1740cb1d7047e6b..f6c51666530351c38352e3ebd1ad9a7b371e40be 100644 (file)
@@ -67,7 +67,7 @@ Value IcingaApplication::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& per
 {
        Dictionary::Ptr nodes = make_shared<Dictionary>();
 
-       BOOST_FOREACH(const IcingaApplication::Ptr& icingaapplication, DynamicType::GetObjects<IcingaApplication>()) {
+       BOOST_FOREACH(const IcingaApplication::Ptr& icingaapplication, DynamicType::GetObjectsByType<IcingaApplication>()) {
                Dictionary::Ptr stats = make_shared<Dictionary>();
                stats->Set("node_name", icingaapplication->GetNodeName());
                stats->Set("enable_notifications", icingaapplication->GetEnableNotifications());
index 9ab93b54f721fcc2d544960e237e52497ed85fb3..f3c8283dd92bdfe9f2bae8358c3f9112e5f2e537 100644 (file)
@@ -38,7 +38,7 @@ Value IcingaStatusWriter::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& pe
 {
        Dictionary::Ptr nodes = make_shared<Dictionary>();
 
-       BOOST_FOREACH(const IcingaStatusWriter::Ptr& icingastatuswriter, DynamicType::GetObjects<IcingaStatusWriter>()) {
+       BOOST_FOREACH(const IcingaStatusWriter::Ptr& icingastatuswriter, DynamicType::GetObjectsByType<IcingaStatusWriter>()) {
                nodes->Set(icingastatuswriter->GetName(), 1); //add more stats
        }
 
index 3af98fba942469f01cd978bffc2c2ee5cdb8b363..57d9c37bd558cc4ed93d0ded14d5253e5f0da7cd 100644 (file)
@@ -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<Host>()) {
+               BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType<Host>()) {
                        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<Service>()) {
+               BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType<Service>()) {
                        CONTEXT("Evaluating 'apply' rules for Service '" + service->GetName() + "'");
 
                        if (EvaluateApplyRuleOne(service, rule))
index 7d2ecae797496bd4e5b175a46cfeb1ae998ad990..778f2983334216c0ffad55440cf2fe8f17c02b96 100644 (file)
@@ -107,7 +107,7 @@ void ScheduledDowntime::EvaluateApplyRules(const std::vector<ApplyRule>& rules)
                if (rule.GetTargetType() == "Host") {
                        apply_count = 0;
 
-                       BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjects<Host>()) {
+                       BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType<Host>()) {
                                CONTEXT("Evaluating 'apply' rules for host '" + host->GetName() + "'");
 
                                if (EvaluateApplyRule(host, rule))
@@ -120,7 +120,7 @@ void ScheduledDowntime::EvaluateApplyRules(const std::vector<ApplyRule>& rules)
                } else if (rule.GetTargetType() == "Service") {
                        apply_count = 0;
 
-                       BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjects<Service>()) {
+                       BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType<Service>()) {
                                CONTEXT("Evaluating 'apply' rules for Service '" + service->GetName() + "'");
 
                                if(EvaluateApplyRule(service, rule))
index 09bb8ecaca106b7ff7fdafe436cf960f2c52adf8..43f4113aefb7d12567415fd8347be48bfe1356cd 100644 (file)
@@ -71,7 +71,7 @@ void ScheduledDowntime::Start(void)
 
 void ScheduledDowntime::TimerProc(void)
 {
-       BOOST_FOREACH(const ScheduledDowntime::Ptr& sd, DynamicType::GetObjects<ScheduledDowntime>()) {
+       BOOST_FOREACH(const ScheduledDowntime::Ptr& sd, DynamicType::GetObjectsByType<ScheduledDowntime>()) {
                sd->CreateNextDowntime();
        }
 }
index 3034b52d97d43028ff669ed4588b7cfc2c4893a4..65bc83faaaf2da1cae73b30269755c67eaf0d439 100644 (file)
@@ -94,7 +94,7 @@ void Service::EvaluateApplyRule(const ApplyRule& rule)
 {
        int apply_count = 0;
 
-       BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjects<Host>()) {
+       BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType<Host>()) {
                CONTEXT("Evaluating 'apply' rules for host '" + host->GetName() + "'");
 
                if (EvaluateApplyRuleOne(host, rule))
index 6a00651e9eda0c8b467dc3b9447e5d4b7958ce58..d4455761d6ce2195098812c0ac4dc6579f92cebe 100644 (file)
@@ -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<Service>()) {
+       BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType<Service>()) {
                CONTEXT("Evaluating group membership in '" + rule.GetName() + "' for service '" + service->GetName() + "'");
 
                EvaluateObjectRuleOne(service, rule);
index 085910266638cafbe7e8c29805354984218ae7dd..c977075645ad3196cb182be3ea3c51ee0a8e608d 100644 (file)
@@ -256,7 +256,7 @@ void TimePeriod::UpdateTimerHandler(void)
 {
        double now = Utility::GetTime();
 
-       BOOST_FOREACH(const TimePeriod::Ptr& tp, DynamicType::GetObjects<TimePeriod>()) {
+       BOOST_FOREACH(const TimePeriod::Ptr& tp, DynamicType::GetObjectsByType<TimePeriod>()) {
                double valid_end;
 
                {
index a9d5a96b3c2bc06dfefb44cdd94e3e02a7061f6a..9a6e8bbe05928d8d4b2212085f8f99b695788c58 100644 (file)
@@ -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<User>()) {
+       BOOST_FOREACH(const User::Ptr& user, DynamicType::GetObjectsByType<User>()) {
                CONTEXT("Evaluating group membership in '" + rule.GetName() + "' for user '" + user->GetName() + "'");
 
                EvaluateObjectRuleOne(user, rule);
index 2dad6d6d5f8e29ff6179256dce1f11b4eda60a6c..33fdc3535371d262a60760e3e131371cecf7c049 100644 (file)
@@ -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<Zone>()) {
+       BOOST_FOREACH(const Zone::Ptr& zone, DynamicType::GetObjectsByType<Zone>()) {
                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<Zone>()) {
+       BOOST_FOREACH(const Zone::Ptr& zone, DynamicType::GetObjectsByType<Zone>()) {
                String zoneDir = zonesDir + "/" + zone->GetName();
 
                if (!zone->IsChildOf(azone) && !zone->IsGlobal()) {
index a3b5b84752a62751e344800348c638ef058dab80..64474390ef099c20721a4e03f93ffe76bff8b5d6 100644 (file)
@@ -88,7 +88,7 @@ void ApiListener::OnConfigLoaded(void)
  */
 void ApiListener::Start(void)
 {
-       if (std::distance(DynamicType::GetObjects<ApiListener>().first, DynamicType::GetObjects<ApiListener>().second) > 1) {
+       if (std::distance(DynamicType::GetObjectsByType<ApiListener>().first, DynamicType::GetObjectsByType<ApiListener>().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<ApiListener>())
+       BOOST_FOREACH(const ApiListener::Ptr& listener, DynamicType::GetObjectsByType<ApiListener>())
                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<Endpoint>()) {
+               BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjectsByType<Endpoint>()) {
                        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<Zone>()) {
+               BOOST_FOREACH(const Zone::Ptr& zone, DynamicType::GetObjectsByType<Zone>()) {
                        /* 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<Endpoint>()) {
+       BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjectsByType<Endpoint>()) {
                if (!endpoint->IsConnected())
                        continue;
 
@@ -421,7 +421,7 @@ void ApiListener::ApiTimerHandler(void)
                Log(LogNotice, "ApiListener", "Current zone master: " + master->GetName());
 
        std::vector<String> names;
-       BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjects<Endpoint>())
+       BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjectsByType<Endpoint>())
                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<Endpoint::Ptr> skippedEndpoints;
        std::set<Zone::Ptr> finishedZones;
 
-       BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjects<Endpoint>()) {
+       BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjectsByType<Endpoint>()) {
                /* don't relay messages to ourselves or disconnected endpoints */
                if (endpoint->GetName() == GetIdentity() || !endpoint->IsConnected())
                        continue;
@@ -744,7 +744,7 @@ std::pair<Dictionary::Ptr, Dictionary::Ptr> ApiListener::GetStatus(void)
        Array::Ptr not_connected_endpoints = make_shared<Array>();
        Array::Ptr connected_endpoints = make_shared<Array>();
 
-       BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjects<Endpoint>()) {
+       BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjectsByType<Endpoint>()) {
                if (endpoint->GetName() == GetIdentity())
                        continue;
 
index fa05bb9cc09255a69a22005f1d8f383cd032bf63..59be361780c3de3fa14e904e6a1ad0641b22e324 100644 (file)
@@ -38,7 +38,7 @@ void Endpoint::OnConfigLoaded(void)
 {
        DynamicObject::OnConfigLoaded();
 
-       BOOST_FOREACH(const Zone::Ptr& zone, DynamicType::GetObjects<Zone>()) {
+       BOOST_FOREACH(const Zone::Ptr& zone, DynamicType::GetObjectsByType<Zone>()) {
                const std::set<Endpoint::Ptr> members = zone->GetEndpoints();
 
                if (members.empty())
index 64c0e86b22259a711e715b2082e2ed67be6d6513..705901df22e34d05f3cabb564c57433e69f4ab91 100644 (file)
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#ifdef __linux__
 #include <alloca.h>
-#endif /* __linux */
 #include <unistd.h>
 #include <stdarg.h>
 #include <stdbool.h>
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
-#include <paths.h>
 #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)
     {
index 1c45c4810071f29db0d0c78167cb2533cc055f96..5ab6621c02e71dd12a9592b34ef15accd9b624ae 100644 (file)
 #include "classcompiler.hpp"
 #include <iostream>
 #include <vector>
+#include <cstring>
+
+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<FieldAccessor>::const_iterator it;
@@ -333,7 +338,7 @@ field_accessors: /* empty */
 field_accessor: T_FIELD_ACCESSOR_TYPE T_STRING
        {
                $$ = new FieldAccessor(static_cast<FieldAccessorType>($1), $2);
-               free($2);
+               std::free($2);
        }
        ;