mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-23 21:55:03 +02:00
Fixed compilation errors with automake/gcc
This commit is contained in:
parent
4b093d9872
commit
43b38f5a85
@ -1,11 +1,12 @@
|
|||||||
## Process this file with automake to produce Makefile.in
|
## Process this file with automake to produce Makefile.in
|
||||||
## Created by Anjuta
|
## Created by Anjuta
|
||||||
|
|
||||||
SUBDIRS = base \
|
SUBDIRS = ltdl \
|
||||||
|
base \
|
||||||
|
jsonrpc \
|
||||||
configfilecomponent \
|
configfilecomponent \
|
||||||
configrpccomponent \
|
configrpccomponent \
|
||||||
icinga \
|
icinga \
|
||||||
jsonrpc \
|
|
||||||
miniapp
|
miniapp
|
||||||
|
|
||||||
icinga2docdir = ${prefix}/doc/icinga2
|
icinga2docdir = ${prefix}/doc/icinga2
|
||||||
|
@ -19,7 +19,7 @@ void ConfigHive::AddObject(ConfigObject::RefType object)
|
|||||||
|
|
||||||
ConfigHiveEventArgs::RefType ea = new_object<ConfigHiveEventArgs>();
|
ConfigHiveEventArgs::RefType ea = new_object<ConfigHiveEventArgs>();
|
||||||
ea->Source = shared_from_this();
|
ea->Source = shared_from_this();
|
||||||
ea->ConfigObject = object;
|
ea->Object = object;
|
||||||
OnObjectCreated(ea);
|
OnObjectCreated(ea);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ void ConfigHive::RemoveObject(ConfigObject::RefType object)
|
|||||||
|
|
||||||
ConfigHiveEventArgs::RefType ea = new_object<ConfigHiveEventArgs>();
|
ConfigHiveEventArgs::RefType ea = new_object<ConfigHiveEventArgs>();
|
||||||
ea->Source = shared_from_this();
|
ea->Source = shared_from_this();
|
||||||
ea->ConfigObject = object;
|
ea->Object = object;
|
||||||
OnObjectRemoved(ea);
|
OnObjectRemoved(ea);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ struct ConfigHiveEventArgs : public EventArgs
|
|||||||
typedef shared_ptr<ConfigHiveEventArgs> RefType;
|
typedef shared_ptr<ConfigHiveEventArgs> RefType;
|
||||||
typedef weak_ptr<ConfigHiveEventArgs> WeakRefType;
|
typedef weak_ptr<ConfigHiveEventArgs> WeakRefType;
|
||||||
|
|
||||||
ConfigObject::RefType ConfigObject;
|
ConfigObject::RefType Object;
|
||||||
string Property;
|
string Property;
|
||||||
string OldValue;
|
string OldValue;
|
||||||
};
|
};
|
||||||
|
@ -42,33 +42,33 @@ void ConfigObject::SetProperty(const string& name, const string& value)
|
|||||||
if (hive.get() != NULL) {
|
if (hive.get() != NULL) {
|
||||||
ConfigHiveEventArgs::RefType ea = new_object<ConfigHiveEventArgs>();
|
ConfigHiveEventArgs::RefType ea = new_object<ConfigHiveEventArgs>();
|
||||||
ea->Source = hive;
|
ea->Source = hive;
|
||||||
ea->ConfigObject = static_pointer_cast<ConfigObject>(shared_from_this());
|
ea->Object = static_pointer_cast<ConfigObject>(shared_from_this());
|
||||||
ea->Property = name;
|
ea->Property = name;
|
||||||
ea->OldValue = oldValue;
|
ea->OldValue = oldValue;
|
||||||
hive->OnPropertyChanged(ea);
|
hive->OnPropertyChanged(ea);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string ConfigObject::GetProperty(const string& name, const string& default) const
|
string ConfigObject::GetProperty(const string& name, const string& defaultValue) const
|
||||||
{
|
{
|
||||||
map<string, string>::const_iterator vi = Properties.find(name);
|
map<string, string>::const_iterator vi = Properties.find(name);
|
||||||
if (vi == Properties.end())
|
if (vi == Properties.end())
|
||||||
return default;
|
return defaultValue;
|
||||||
return vi->second;
|
return vi->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ConfigObject::GetPropertyInteger(const string& name, int default) const
|
int ConfigObject::GetPropertyInteger(const string& name, int defaultValue) const
|
||||||
{
|
{
|
||||||
string value = GetProperty(name);
|
string value = GetProperty(name);
|
||||||
if (value == string())
|
if (value == string())
|
||||||
return default;
|
return defaultValue;
|
||||||
return strtol(value.c_str(), NULL, 10);
|
return strtol(value.c_str(), NULL, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
double ConfigObject::GetPropertyDouble(const string& name, double default) const
|
double ConfigObject::GetPropertyDouble(const string& name, double defaultValue) const
|
||||||
{
|
{
|
||||||
string value = GetProperty(name);
|
string value = GetProperty(name);
|
||||||
if (value == string())
|
if (value == string())
|
||||||
return default;
|
return defaultValue;
|
||||||
return strtod(value.c_str(), NULL);
|
return strtod(value.c_str(), NULL);
|
||||||
}
|
}
|
||||||
|
@ -39,9 +39,9 @@ public:
|
|||||||
void SetPropertyInteger(const string& name, int value);
|
void SetPropertyInteger(const string& name, int value);
|
||||||
void SetPropertyDouble(const string& name, double value);
|
void SetPropertyDouble(const string& name, double value);
|
||||||
|
|
||||||
string GetProperty(const string& name, const string& default = string()) const;
|
string GetProperty(const string& name, const string& defaultValue = string()) const;
|
||||||
int GetPropertyInteger(const string& name, int default = 0) const;
|
int GetPropertyInteger(const string& name, int defaultValue = 0) const;
|
||||||
double GetPropertyDouble(const string& name, double default = 0.0f) const;
|
double GetPropertyDouble(const string& name, double defaultValue = 0.0f) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
#ifndef I2_BASE_H
|
#ifndef I2_BASE_H
|
||||||
#define I2_BASE_H
|
#define I2_BASE_H
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <cstdlib>
|
||||||
#include <string.h>
|
#include <cstdarg>
|
||||||
#include <assert.h>
|
#include <cstdio>
|
||||||
#include <errno.h>
|
#include <cstring>
|
||||||
|
#include <cassert>
|
||||||
|
#include <cerrno>
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -7,7 +7,7 @@ mutex::mutex(void)
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
InitializeCriticalSection(&m_Mutex);
|
InitializeCriticalSection(&m_Mutex);
|
||||||
#else /* _WIN32 */
|
#else /* _WIN32 */
|
||||||
pthread_mutex_init(&m_Mutex);
|
pthread_mutex_init(&m_Mutex, NULL);
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -16,7 +16,7 @@ mutex::~mutex(void)
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
DeleteCriticalSection(&m_Mutex);
|
DeleteCriticalSection(&m_Mutex);
|
||||||
#else /* _WIN32 */
|
#else /* _WIN32 */
|
||||||
pthread_mutex_init(&m_Mutex);
|
pthread_mutex_destroy(&m_Mutex);
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ bool mutex::tryenter(void)
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
return (TryEnterCriticalSection(&m_Mutex) == TRUE);
|
return (TryEnterCriticalSection(&m_Mutex) == TRUE);
|
||||||
#else /* _WIN32 */
|
#else /* _WIN32 */
|
||||||
return pthread_mutex_tryenter(&m_Mutex);
|
return pthread_mutex_trylock(&m_Mutex);
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ void mutex::enter(void)
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
EnterCriticalSection(&m_Mutex);
|
EnterCriticalSection(&m_Mutex);
|
||||||
#else /* _WIN32 */
|
#else /* _WIN32 */
|
||||||
pthread_mutex_enter(&m_Mutex);
|
pthread_mutex_lock(&m_Mutex);
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ void mutex::exit(void)
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
LeaveCriticalSection(&m_Mutex);
|
LeaveCriticalSection(&m_Mutex);
|
||||||
#else /* _WIN32 */
|
#else /* _WIN32 */
|
||||||
pthread_mutex_exit(&m_Mutex);
|
pthread_mutex_unlock(&m_Mutex);
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,8 +4,6 @@
|
|||||||
namespace icinga
|
namespace icinga
|
||||||
{
|
{
|
||||||
|
|
||||||
using std::function;
|
|
||||||
|
|
||||||
class thread
|
class thread
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
@ -4,10 +4,13 @@
|
|||||||
#include <execinfo.h>
|
#include <execinfo.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <fcntl.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
|
#include <pthread.h>
|
||||||
|
|
||||||
typedef int SOCKET;
|
typedef int SOCKET;
|
||||||
|
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
## Process this file with automake to produce Makefile.in
|
## Process this file with automake to produce Makefile.in
|
||||||
|
|
||||||
|
pkglib_LTLIBRARIES = \
|
||||||
|
libconfigfilecomponent.la
|
||||||
|
|
||||||
libconfigfilecomponent_la_SOURCES = \
|
libconfigfilecomponent_la_SOURCES = \
|
||||||
configfilecomponent.cpp \
|
configfilecomponent.cpp \
|
||||||
configfilecomponent.h \
|
configfilecomponent.h \
|
||||||
i2-configfilecomponent.h
|
i2-configfilecomponent.h
|
||||||
|
|
||||||
libconfigfilecomponent_la_CXXFLAGS = -I${top_srcdir}/base
|
libconfigfilecomponent_la_CXXFLAGS = -I${top_srcdir}/base -I${top_srcdir}/jsonrpc
|
||||||
|
@ -16,7 +16,7 @@ void ConfigFileComponent::Start(void)
|
|||||||
ifstream fp;
|
ifstream fp;
|
||||||
FIFO::RefType fifo = new_object<FIFO>();
|
FIFO::RefType fifo = new_object<FIFO>();
|
||||||
|
|
||||||
fp.open(GetConfig()->GetProperty("filename"), ifstream::in);
|
fp.open(GetConfig()->GetProperty("filename").c_str(), ifstream::in);
|
||||||
if (fp.fail())
|
if (fp.fail())
|
||||||
throw exception(/*"Could not open config file"*/);
|
throw exception(/*"Could not open config file"*/);
|
||||||
|
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
## Process this file with automake to produce Makefile.in
|
## Process this file with automake to produce Makefile.in
|
||||||
|
|
||||||
|
pkglib_LTLIBRARIES = \
|
||||||
|
libconfigrpccomponent.la
|
||||||
|
|
||||||
libconfigrpccomponent_la_SOURCES = \
|
libconfigrpccomponent_la_SOURCES = \
|
||||||
configrpccomponent.cpp \
|
configrpccomponent.cpp \
|
||||||
configrpccomponent.h \
|
configrpccomponent.h \
|
||||||
i2-configrpccomponent.h
|
i2-configrpccomponent.h
|
||||||
|
|
||||||
libconfigrpccomponent_la_CXXFLAGS = -I${top_srcdir}/base
|
libconfigrpccomponent_la_CXXFLAGS = -I${top_srcdir}/base -I${top_srcdir}/jsonrpc -I${top_srcdir}/icinga
|
||||||
|
@ -81,7 +81,7 @@ int ConfigRpcComponent::FetchObjectsHandler(NewMessageEventArgs::RefType ea)
|
|||||||
int ConfigRpcComponent::LocalObjectCreatedHandler(ConfigHiveEventArgs::RefType ea)
|
int ConfigRpcComponent::LocalObjectCreatedHandler(ConfigHiveEventArgs::RefType ea)
|
||||||
{
|
{
|
||||||
ConnectionManager::RefType connectionManager = GetIcingaApplication()->GetConnectionManager();
|
ConnectionManager::RefType connectionManager = GetIcingaApplication()->GetConnectionManager();
|
||||||
connectionManager->SendMessage(MakeObjectMessage(ea->ConfigObject, "config::ObjectCreated", true));
|
connectionManager->SendMessage(MakeObjectMessage(ea->Object, "config::ObjectCreated", true));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -89,17 +89,17 @@ int ConfigRpcComponent::LocalObjectCreatedHandler(ConfigHiveEventArgs::RefType e
|
|||||||
int ConfigRpcComponent::LocalObjectRemovedHandler(ConfigHiveEventArgs::RefType ea)
|
int ConfigRpcComponent::LocalObjectRemovedHandler(ConfigHiveEventArgs::RefType ea)
|
||||||
{
|
{
|
||||||
ConnectionManager::RefType connectionManager = GetIcingaApplication()->GetConnectionManager();
|
ConnectionManager::RefType connectionManager = GetIcingaApplication()->GetConnectionManager();
|
||||||
connectionManager->SendMessage(MakeObjectMessage(ea->ConfigObject, "config::ObjectRemoved", false));
|
connectionManager->SendMessage(MakeObjectMessage(ea->Object, "config::ObjectRemoved", false));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ConfigRpcComponent::LocalPropertyChangedHandler(ConfigHiveEventArgs::RefType ea)
|
int ConfigRpcComponent::LocalPropertyChangedHandler(ConfigHiveEventArgs::RefType ea)
|
||||||
{
|
{
|
||||||
JsonRpcMessage::RefType msg = MakeObjectMessage(ea->ConfigObject, "config::ObjectRemoved", false);
|
JsonRpcMessage::RefType msg = MakeObjectMessage(ea->Object, "config::ObjectRemoved", false);
|
||||||
cJSON *params = msg->GetParams();
|
cJSON *params = msg->GetParams();
|
||||||
cJSON_AddStringToObject(params, "property", ea->Property.c_str());
|
cJSON_AddStringToObject(params, "property", ea->Property.c_str());
|
||||||
string value = ea->ConfigObject->GetProperty(ea->Property);
|
string value = ea->Object->GetProperty(ea->Property);
|
||||||
cJSON_AddStringToObject(params, "value", value.c_str());
|
cJSON_AddStringToObject(params, "value", value.c_str());
|
||||||
|
|
||||||
ConnectionManager::RefType connectionManager = GetIcingaApplication()->GetConnectionManager();
|
ConnectionManager::RefType connectionManager = GetIcingaApplication()->GetConnectionManager();
|
||||||
|
@ -17,7 +17,8 @@ AC_PROG_CXX
|
|||||||
|
|
||||||
|
|
||||||
LT_INIT
|
LT_INIT
|
||||||
|
LT_CONFIG_LTDL_DIR([ltdl])
|
||||||
|
LTDL_INIT
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -26,6 +27,9 @@ LT_INIT
|
|||||||
AC_OUTPUT([
|
AC_OUTPUT([
|
||||||
Makefile
|
Makefile
|
||||||
base/Makefile
|
base/Makefile
|
||||||
|
configfilecomponent/Makefile
|
||||||
|
configrpccomponent/Makefile
|
||||||
|
icinga/Makefile
|
||||||
jsonrpc/Makefile
|
jsonrpc/Makefile
|
||||||
miniapp/Makefile
|
miniapp/Makefile
|
||||||
|
|
||||||
|
@ -4,12 +4,12 @@
|
|||||||
bin_PROGRAMS = \
|
bin_PROGRAMS = \
|
||||||
icinga
|
icinga
|
||||||
|
|
||||||
miniapp_SOURCES = \
|
icinga_SOURCES = \
|
||||||
icingaapplication.cpp \
|
icingaapplication.cpp \
|
||||||
icingaapplication.h
|
icingaapplication.h
|
||||||
|
|
||||||
miniapp_CXXFLAGS = -I${top_srcdir}/base \
|
icinga_CXXFLAGS = -I${top_srcdir}/base \
|
||||||
-I${top_srcdir}/jsonrpc
|
-I${top_srcdir}/jsonrpc
|
||||||
|
|
||||||
miniapp_LDFLAGS = $(top_builddir)/base/libbase.a \
|
icinga_LDFLAGS = $(top_builddir)/base/libbase.a \
|
||||||
$(top_builddir)/jsonrpc/libjsonrpc.a
|
$(top_builddir)/jsonrpc/libjsonrpc.a
|
||||||
|
@ -35,8 +35,8 @@ ConnectionManager::RefType IcingaApplication::GetConnectionManager(void)
|
|||||||
|
|
||||||
int IcingaApplication::ConfigObjectCreatedHandler(ConfigHiveEventArgs::RefType ea)
|
int IcingaApplication::ConfigObjectCreatedHandler(ConfigHiveEventArgs::RefType ea)
|
||||||
{
|
{
|
||||||
if (ea->ConfigObject->GetType() == "component") {
|
if (ea->Object->GetType() == "component") {
|
||||||
LoadComponent(ea->ConfigObject->GetName());
|
LoadComponent(ea->Object->GetName());
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -44,8 +44,8 @@ int IcingaApplication::ConfigObjectCreatedHandler(ConfigHiveEventArgs::RefType e
|
|||||||
|
|
||||||
int IcingaApplication::ConfigObjectRemovedHandler(ConfigHiveEventArgs::RefType ea)
|
int IcingaApplication::ConfigObjectRemovedHandler(ConfigHiveEventArgs::RefType ea)
|
||||||
{
|
{
|
||||||
if (ea->ConfigObject->GetType() == "component") {
|
if (ea->Object->GetType() == "component") {
|
||||||
UnloadComponent(ea->ConfigObject->GetName());
|
UnloadComponent(ea->Object->GetName());
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user