diff options
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/CMakeLists.txt | 10 | ||||
-rw-r--r-- | src/modules/FileLogger/CMakeLists.txt | 5 | ||||
-rw-r--r-- | src/modules/FileLogger/FileLogger.cpp | 7 | ||||
-rw-r--r-- | src/modules/FileLogger/FileLogger.h | 1 | ||||
-rw-r--r-- | src/modules/SystemBackendProc/CMakeLists.txt | 5 | ||||
-rw-r--r-- | src/modules/SystemBackendProc/SystemBackendProc.cpp | 15 | ||||
-rw-r--r-- | src/modules/UserBackendMysql/CMakeLists.txt | 7 | ||||
-rw-r--r-- | src/modules/UserBackendMysql/UserBackendMysql.cpp | 15 |
8 files changed, 41 insertions, 24 deletions
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 <Common/ConfigEntry.h> -#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 <Common/ActionManager.h> +#include <Net/ThreadManager.h> #include <cstdio> #include <cstring> #include <boost/bind.hpp> -#define init SystemBackendProc_LTX_init -#define deinit SystemBackendProc_LTX_deinit - namespace Mad { namespace Modules { @@ -53,7 +50,7 @@ bool SystemBackendProc::getUptimeInfo(const boost::function2<void, unsigned long if(uptimeFile.good()) idleTime = (unsigned long)f; - Common::ActionManager::get()->add(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::function4<void, unsigned long break; } - Common::ActionManager::get()->add(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::function5<void, unsigned long, std::sscanf(line.c_str(), "%f %f %f %lu/%lu", &loadAvg1, &loadAvg5, &loadAvg15, ¤tLoad, &nProcesses); - Common::ActionManager::get()->add(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<void, unsigned long, extern "C" { -void init() { +void SystemBackendProc_init() { Mad::Modules::SystemBackendProc::registerBackend(); } -void deinit() { +void SystemBackendProc_deinit() { Mad::Modules::SystemBackendProc::unregisterBackend(); } diff --git a/src/modules/UserBackendMysql/CMakeLists.txt b/src/modules/UserBackendMysql/CMakeLists.txt new file mode 100644 index 0000000..5af1f1d --- /dev/null +++ b/src/modules/UserBackendMysql/CMakeLists.txt @@ -0,0 +1,7 @@ +include_directories(${INCLUDES} ${MYSQL_INCLUDE_DIR}) + +add_library(UserBackendMysql MODULE + UserBackendMysql.cpp +) + +target_link_libraries(UserBackendMysql ${MYSQL_LIBRARIES})
\ No newline at end of file diff --git a/src/modules/UserBackendMysql/UserBackendMysql.cpp b/src/modules/UserBackendMysql/UserBackendMysql.cpp index af25f5b..ebea4dc 100644 --- a/src/modules/UserBackendMysql/UserBackendMysql.cpp +++ b/src/modules/UserBackendMysql/UserBackendMysql.cpp @@ -20,19 +20,16 @@ #include <config.h> #include "UserBackendMysql.h" -#include <Common/ActionManager.h> #include <Common/ConfigEntry.h> #include <Common/ConfigManager.h> #include <Common/Logger.h> +#include <Net/ThreadManager.h> #include <sstream> #include <boost/bind.hpp> #include <boost/regex.hpp> -#define init UserBackendMysql_LTX_init -#define deinit UserBackendMysql_LTX_deinit - namespace Mad { namespace Modules { @@ -155,7 +152,7 @@ bool UserBackendMysql::getUserList(const boost::function1<void, const std::map<u users.insert(std::make_pair(user.getUid(), user)); } - Common::ActionManager::get()->add(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::function1<voi user.setGid(strtoul(row[1], 0, 10)); user.setFullName(row[3]); - Common::ActionManager::get()->add(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(); } |