diff options
Diffstat (limited to 'src/Common/Backends')
-rw-r--r-- | src/Common/Backends/SystemBackendPosix.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/Common/Backends/SystemBackendPosix.h b/src/Common/Backends/SystemBackendPosix.h index aa2b9be..9efd59f 100644 --- a/src/Common/Backends/SystemBackendPosix.h +++ b/src/Common/Backends/SystemBackendPosix.h @@ -33,7 +33,7 @@ namespace Mad { namespace Common { namespace Backends { -class SystemBackendPosix { +class SystemBackendPosix : public SystemBackend { private: static SystemBackendPosix backend; static std::map<pid_t, sigc::slot<void, int> > processes; @@ -46,9 +46,21 @@ class SystemBackendPosix { setChildHandler(); } + protected: + virtual bool doShutdown() {return exec(sigc::slot<void, int>(), "/sbin/halt");} + virtual bool doReboot() {return exec(sigc::slot<void, int>(), "/sbin/reboot");} + public: ~SystemBackendPosix(); + static void registerBackend() { + SystemBackend::registerBackend(&backend); + } + + static void unregisterBackend() { + SystemBackend::unregisterBackend(&backend); + } + static bool exec(sigc::slot<void, int> resultHandler, const std::string &filename, const std::vector<std::string> &argv = std::vector<std::string>(), const std::vector<std::string> &env = std::vector<std::string>()); }; |