X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Utils%2FDaemon%2FDaemon.hh;h=89e2d53fe27273ae931c5102e93f0720d6ce56c5;hb=40fa3e3f1e0f639c68bd15bf469e35045f94abee;hp=d0ba4a7cead310352f9c6598b0c46221cedb6ec1;hpb=d5ba3d7759212c90a5f4a25baf0dc38e290c3b64;p=senf.git diff --git a/Utils/Daemon/Daemon.hh b/Utils/Daemon/Daemon.hh index d0ba4a7..89e2d53 100644 --- a/Utils/Daemon/Daemon.hh +++ b/Utils/Daemon/Daemon.hh @@ -28,6 +28,7 @@ // Custom includes #include +#include "../Logger/SenfLog.hh" //#include "Daemon.mpp" ///////////////////////////////hh.p//////////////////////////////////////// @@ -103,6 +104,8 @@ namespace senf { class Daemon : boost::noncopyable { public: + SENF_LOG_CLASS_AREA(); + /////////////////////////////////////////////////////////////////////////// // Types @@ -155,15 +158,22 @@ namespace senf { int argc(); ///< Access command line parameter count char ** argv(); ///< Access command line parameters + void removeDaemonArgs(); ///< Remove the daemon arguments from argc()/argv() static void exit(unsigned code=0); ///< Terminate daemon with failure + void logReopen(); ///< Reopen the log files + /**< This is used when rotating the logs. By default, + SIGHUP calls logReopen. */ + ///\} int start(int argc, char ** argv); ///< Called from main() to launch daemon. /**< Normally not called directly but from the \ref SENF_DAEMON_MAIN macro. */ + static Daemon & instance(); ///< Return the Daemon instance + protected: Daemon(); @@ -212,6 +222,8 @@ namespace senf { bool pidfileCreated_; bool detached_; + + static Daemon * instance_; }; /** \brief Provide \c main() function