summaryrefslogtreecommitdiffstats
path: root/src/modules/SystemBackendPosix
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/SystemBackendPosix')
-rw-r--r--src/modules/SystemBackendPosix/SystemBackendPosix.cpp18
-rw-r--r--src/modules/SystemBackendPosix/SystemBackendPosix.h6
2 files changed, 13 insertions, 11 deletions
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> SystemBackendPosix::backend;
-bool SystemBackendPosix::getFSInfo(std::vector<Common::SystemManager::FSInfo> *fsInfo) {
+void SystemBackendPosix::getFSInfo(std::vector<Common::SystemManager::FSInfo> *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<Common::SystemManager::FSInfo> *f
pclose(pipe);
if(!fsInfo)
- return true;
+ return;
fsInfo->clear();
@@ -75,19 +75,21 @@ bool SystemBackendPosix::getFSInfo(std::vector<Common::SystemManager::FSInfo> *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<SystemBackendPosix> backend;
protected:
- virtual bool getFSInfo(std::vector<Common::SystemManager::FSInfo> *fsInfo);
+ virtual void getFSInfo(std::vector<Common::SystemManager::FSInfo> *fsInfo) throw(Net::Exception);
- virtual bool shutdown();
- virtual bool reboot();
+ virtual void shutdown() throw(Net::Exception);
+ virtual void reboot() throw(Net::Exception);
public:
~SystemBackendPosix();