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