From 0480576d43fb7ddcc16de9dab0619a1424f129fd Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Fri, 22 May 2009 14:21:06 +0200 Subject: SystemBackend ?berarbeitet --- src/modules/SystemBackendPosix/SystemBackendPosix.cpp | 18 ++++++++++-------- src/modules/SystemBackendPosix/SystemBackendPosix.h | 6 +++--- 2 files changed, 13 insertions(+), 11 deletions(-) (limited to 'src/modules/SystemBackendPosix') diff --git a/src/modules/SystemBackendPosix/SystemBackendPosix.cpp b/src/modules/SystemBackendPosix/SystemBackendPosix.cpp index a215c86..35e6c4f 100644 --- a/src/modules/SystemBackendPosix/SystemBackendPosix.cpp +++ b/src/modules/SystemBackendPosix/SystemBackendPosix.cpp @@ -29,12 +29,12 @@ namespace Modules { boost::shared_ptr SystemBackendPosix::backend; -bool SystemBackendPosix::getFSInfo(std::vector *fsInfo) { +void SystemBackendPosix::getFSInfo(std::vector *fsInfo) throw(Net::Exception) { Net::ThreadManager::get()->detach(); FILE *pipe = popen("/bin/df -P -k", "r"); if(!pipe) - return false; + throw(Net::Exception(Net::Exception::NOT_AVAILABLE)); char buffer[1024]; std::string output; @@ -47,7 +47,7 @@ bool SystemBackendPosix::getFSInfo(std::vector *f pclose(pipe); if(!fsInfo) - return true; + return; fsInfo->clear(); @@ -75,19 +75,21 @@ bool SystemBackendPosix::getFSInfo(std::vector *f delete [] mountedOn; } - return true; + return; } -bool SystemBackendPosix::shutdown() { +void SystemBackendPosix::shutdown() throw(Net::Exception) { Net::ThreadManager::get()->detach(); - return (system("/sbin/halt") == 0); + if(system("/sbin/halt") != 0) + throw(Net::Exception(Net::Exception::NOT_AVAILABLE)); } -bool SystemBackendPosix::reboot() { +void SystemBackendPosix::reboot() throw(Net::Exception) { Net::ThreadManager::get()->detach(); - return (system("/sbin/reboot") == 0); + if(system("/sbin/reboot") != 0) + throw(Net::Exception(Net::Exception::NOT_AVAILABLE)); } } diff --git a/src/modules/SystemBackendPosix/SystemBackendPosix.h b/src/modules/SystemBackendPosix/SystemBackendPosix.h index 2ec026d..3cdb43c 100644 --- a/src/modules/SystemBackendPosix/SystemBackendPosix.h +++ b/src/modules/SystemBackendPosix/SystemBackendPosix.h @@ -38,10 +38,10 @@ class SystemBackendPosix : public Common::SystemBackend { static boost::shared_ptr backend; protected: - virtual bool getFSInfo(std::vector *fsInfo); + virtual void getFSInfo(std::vector *fsInfo) throw(Net::Exception); - virtual bool shutdown(); - virtual bool reboot(); + virtual void shutdown() throw(Net::Exception); + virtual void reboot() throw(Net::Exception); public: ~SystemBackendPosix(); -- cgit v1.2.3