summaryrefslogtreecommitdiffstats
path: root/src/modules/SystemBackendPosix.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/SystemBackendPosix.cpp')
-rw-r--r--src/modules/SystemBackendPosix.cpp30
1 files changed, 14 insertions, 16 deletions
diff --git a/src/modules/SystemBackendPosix.cpp b/src/modules/SystemBackendPosix.cpp
index 21e5c75..4969c6d 100644
--- a/src/modules/SystemBackendPosix.cpp
+++ b/src/modules/SystemBackendPosix.cpp
@@ -33,8 +33,6 @@
#include <sys/wait.h>
#include <unistd.h>
-#include <sigc++/bind.h>
-
#define init SystemBackendPosix_LTX_init
#define deinit SystemBackendPosix_LTX_deinit
@@ -43,8 +41,8 @@ namespace Modules {
SystemBackendPosix *SystemBackendPosix::backend = 0;
-std::map<pid_t, sigc::slot<void, int> > SystemBackendPosix::processes;
-std::map<pid_t, sigc::slot<void, int, const std::string&> > SystemBackendPosix::processesWithOutput;
+std::map<pid_t, boost::function1<void, int> > SystemBackendPosix::processes;
+std::map<pid_t, boost::function2<void, int, const std::string&> > SystemBackendPosix::processesWithOutput;
std::map<pid_t, int> SystemBackendPosix::processesWOHandles;
std::map<pid_t, std::string > SystemBackendPosix::processesWOOutput;
@@ -70,7 +68,7 @@ SystemBackendPosix::~SystemBackendPosix() {
}
-void SystemBackendPosix::fsInfoCallback(int, const std::string &output, const sigc::slot<void, const std::vector<Common::SystemManager::FSInfo>& > &callback) {
+void SystemBackendPosix::fsInfoCallback(int, const std::string &output, const boost::function1<void, const std::vector<Common::SystemManager::FSInfo>& > &callback) {
std::vector<Common::SystemManager::FSInfo> ret;
std::istringstream stream(output);
std::string str;
@@ -99,14 +97,14 @@ void SystemBackendPosix::fsInfoCallback(int, const std::string &output, const si
callback(ret);
}
-bool SystemBackendPosix::getFSInfo(const sigc::slot<void, const std::vector<Common::SystemManager::FSInfo>& > &callback) {
+bool SystemBackendPosix::getFSInfo(const boost::function1<void, const std::vector<Common::SystemManager::FSInfo>& > &callback) {
std::vector<std::string> argv;
argv.push_back("/bin/df");
argv.push_back("-P");
argv.push_back("-k");
- return execWithOutput(sigc::bind(sigc::mem_fun(this, &SystemBackendPosix::fsInfoCallback), callback), "/bin/df", argv);
+ return execWithOutput(boost::bind(&SystemBackendPosix::fsInfoCallback, this, _1, _2, callback), "/bin/df", argv);
}
@@ -115,14 +113,14 @@ void SystemBackendPosix::childHandler(int) {
pid_t pid;
while((pid = waitpid(-1, &status, WNOHANG)) > 0) {
- std::map<pid_t, sigc::slot<void, int> >::iterator it = processes.find(pid);
+ std::map<pid_t, boost::function1<void, int> >::iterator it = processes.find(pid);
if(it != processes.end()) {
- Common::ActionManager::get()->add(sigc::bind(it->second, status));
+ Common::ActionManager::get()->add(boost::bind(it->second, status));
processes.erase(it);
}
else {
- std::map<pid_t, sigc::slot<void, int, const std::string&> >::iterator it2 = processesWithOutput.find(pid);
+ std::map<pid_t, boost::function2<void, int, const std::string&> >::iterator it2 = processesWithOutput.find(pid);
if(it2 != processesWithOutput.end()) {
char buffer[1024];
@@ -133,10 +131,10 @@ void SystemBackendPosix::childHandler(int) {
while((n = read(handle, buffer, sizeof(buffer))) > 0)
output += std::string(buffer, n);
- Net::FdManager::get()->unregisterFd(handle);
- close(handle);
+ //Net::FdManager::get()->unregisterFd(handle);
+ //close(handle);
- Common::ActionManager::get()->add(sigc::bind(it2->second, status, output));
+ //Common::ActionManager::get()->add(boost::bind(it2->second, status, output));
processesWithOutput.erase(it2);
processesWOHandles.erase(pid);
processesWOOutput.erase(pid);
@@ -218,7 +216,7 @@ void SystemBackendPosix::destroyArgs(std::pair<char**, char**> args) {
}
}
-bool SystemBackendPosix::exec(const sigc::slot<void, int> &resultHandler, const std::string &filename, const std::vector<std::string> &argv, const std::vector<std::string> &env) {
+bool SystemBackendPosix::exec(const boost::function1<void, int> &resultHandler, const std::string &filename, const std::vector<std::string> &argv, const std::vector<std::string> &env) {
pid_t pid;
std::pair<char**, char**> args = makeArgs(filename, argv, env);
@@ -239,7 +237,7 @@ bool SystemBackendPosix::exec(const sigc::slot<void, int> &resultHandler, const
return ret;
}
-bool SystemBackendPosix::execWithOutput(const sigc::slot<void, int, const std::string&> &resultHandler, const std::string &filename, const std::vector<std::string> &argv, const std::vector<std::string> &env) {
+bool SystemBackendPosix::execWithOutput(const boost::function2<void, int, const std::string&> &resultHandler, const std::string &filename, const std::vector<std::string> &argv, const std::vector<std::string> &env) {
pid_t pid;
std::pair<char**, char**> args = makeArgs(filename, argv, env);
@@ -268,7 +266,7 @@ bool SystemBackendPosix::execWithOutput(const sigc::slot<void, int, const std::s
processesWOHandles.insert(std::make_pair(pid, pipeHandles[0]));
processesWOOutput.insert(std::make_pair(pid, std::string()));
- Net::FdManager::get()->registerFd(pipeHandles[0], sigc::bind(sigc::ptr_fun(&SystemBackendPosix::outputHandler), pid), POLLIN);
+ Net::FdManager::get()->registerFd(pipeHandles[0], boost::bind(&SystemBackendPosix::outputHandler, _1, pid), POLLIN);
}
dup2(saveStdout, STDOUT_FILENO); // restore old stdout