From 325ee09f8fa61185efd6ec8b64b6432686170ac8 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 20 May 2009 20:04:09 +0200 Subject: Module wieder heil-gebastelt --- src/modules/CMakeLists.txt | 10 ++++++++++ src/modules/FileLogger/CMakeLists.txt | 5 +++++ src/modules/FileLogger/FileLogger.cpp | 7 ++----- src/modules/FileLogger/FileLogger.h | 1 - src/modules/SystemBackendProc/CMakeLists.txt | 5 +++++ src/modules/SystemBackendProc/SystemBackendProc.cpp | 15 ++++++--------- src/modules/UserBackendMysql/CMakeLists.txt | 7 +++++++ src/modules/UserBackendMysql/UserBackendMysql.cpp | 15 ++++++--------- 8 files changed, 41 insertions(+), 24 deletions(-) create mode 100644 src/modules/CMakeLists.txt create mode 100644 src/modules/FileLogger/CMakeLists.txt create mode 100644 src/modules/SystemBackendProc/CMakeLists.txt create mode 100644 src/modules/UserBackendMysql/CMakeLists.txt (limited to 'src/modules') diff --git a/src/modules/CMakeLists.txt b/src/modules/CMakeLists.txt new file mode 100644 index 0000000..ea05a95 --- /dev/null +++ b/src/modules/CMakeLists.txt @@ -0,0 +1,10 @@ +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${MAD_BINARY_DIR}/src/modules) +set(CMAKE_SHARED_MODULE_PREFIX "") + +add_subdirectory(FileLogger) +add_subdirectory(SystemBackendPosix) +add_subdirectory(SystemBackendProc) + +if(MYSQL_FOUND) +add_subdirectory(UserBackendMysql) +endif(MYSQL_FOUND) diff --git a/src/modules/FileLogger/CMakeLists.txt b/src/modules/FileLogger/CMakeLists.txt new file mode 100644 index 0000000..39459d3 --- /dev/null +++ b/src/modules/FileLogger/CMakeLists.txt @@ -0,0 +1,5 @@ +include_directories(${INCLUDES}) + +add_library(FileLogger MODULE + FileLogger.cpp +) diff --git a/src/modules/FileLogger/FileLogger.cpp b/src/modules/FileLogger/FileLogger.cpp index 5e0c021..4655002 100644 --- a/src/modules/FileLogger/FileLogger.cpp +++ b/src/modules/FileLogger/FileLogger.cpp @@ -21,9 +21,6 @@ #include -#define init FileLogger_LTX_init -#define deinit FileLogger_LTX_deinit - namespace Mad { namespace Modules { @@ -62,11 +59,11 @@ bool FileLogger::ConfigHelper::handleConfigEntry(const Common::ConfigEntry &entr extern "C" { -void init() { +void FileLogger_init() { Mad::Modules::FileLogger::registerConfigHelper(); } -void deinit() { +void FileLogger_deinit() { Mad::Modules::FileLogger::unregisterConfigHelper(); } diff --git a/src/modules/FileLogger/FileLogger.h b/src/modules/FileLogger/FileLogger.h index 404299b..2def986 100644 --- a/src/modules/FileLogger/FileLogger.h +++ b/src/modules/FileLogger/FileLogger.h @@ -58,7 +58,6 @@ class FileLogger : private Common::Logger, private Common::RemoteLogger { static void registerConfigHelper() { Common::ConfigManager::get()->registerConfigurable(&configHelper); - Logger::log("Registered!"); } static void unregisterConfigHelper() { diff --git a/src/modules/SystemBackendProc/CMakeLists.txt b/src/modules/SystemBackendProc/CMakeLists.txt new file mode 100644 index 0000000..b524265 --- /dev/null +++ b/src/modules/SystemBackendProc/CMakeLists.txt @@ -0,0 +1,5 @@ +include_directories(${INCLUDES}) + +add_library(SystemBackendProc MODULE + SystemBackendProc.cpp +) diff --git a/src/modules/SystemBackendProc/SystemBackendProc.cpp b/src/modules/SystemBackendProc/SystemBackendProc.cpp index 68f9cec..d238e07 100644 --- a/src/modules/SystemBackendProc/SystemBackendProc.cpp +++ b/src/modules/SystemBackendProc/SystemBackendProc.cpp @@ -19,16 +19,13 @@ #include "SystemBackendProc.h" -#include +#include #include #include #include -#define init SystemBackendProc_LTX_init -#define deinit SystemBackendProc_LTX_deinit - namespace Mad { namespace Modules { @@ -53,7 +50,7 @@ bool SystemBackendProc::getUptimeInfo(const boost::function2add(boost::bind(callback, uptime, idleTime)); + Net::ThreadManager::get()->pushWork(boost::bind(callback, uptime, idleTime)); return true; } @@ -90,7 +87,7 @@ bool SystemBackendProc::getMemoryInfo(const boost::function4add(boost::bind(callback, totalMem, freeMem, totalSwap, freeSwap)); + Net::ThreadManager::get()->pushWork(boost::bind(callback, totalMem, freeMem, totalSwap, freeSwap)); return true; } @@ -112,7 +109,7 @@ bool SystemBackendProc::getLoadInfo(const boost::function5add(boost::bind(callback, currentLoad, nProcesses, loadAvg1, loadAvg5, loadAvg15)); + Net::ThreadManager::get()->pushWork(boost::bind(callback, currentLoad, nProcesses, loadAvg1, loadAvg5, loadAvg15)); return true; } @@ -123,11 +120,11 @@ bool SystemBackendProc::getLoadInfo(const boost::function5 #include "UserBackendMysql.h" -#include #include #include #include +#include #include #include #include -#define init UserBackendMysql_LTX_init -#define deinit UserBackendMysql_LTX_deinit - namespace Mad { namespace Modules { @@ -155,7 +152,7 @@ bool UserBackendMysql::getUserList(const boost::function1add(boost::bind(callback, users)); + Net::ThreadManager::get()->pushWork(boost::bind(callback, users)); return true; } @@ -186,12 +183,12 @@ bool UserBackendMysql::getUserInfo(unsigned long uid, const boost::function1add(boost::bind(callback, user)); + Net::ThreadManager::get()->pushWork(boost::bind(callback, user)); while((row = mysql_fetch_row(result)) != 0) {} } else { - Common::ActionManager::get()->add(boost::bind(callback, Common::UserInfo())); + Net::ThreadManager::get()->pushWork(boost::bind(callback, Common::UserInfo())); } return true; @@ -222,11 +219,11 @@ void UserBackendMysql::unregisterBackend() { extern "C" { -void init() { +void UserBackendMysql_init() { Mad::Modules::UserBackendMysql::registerBackend(); } -void deinit() { +void UserBackendMysql_deinit() { Mad::Modules::UserBackendMysql::unregisterBackend(); } -- cgit v1.2.3