Scheduler: Implement new file descriptor event API
[senf.git] / Utils / Daemon / Daemon.hh
index d0ba4a7..f0c45c0 100644 (file)
@@ -28,6 +28,7 @@
 
 // Custom includes
 #include <boost/utility.hpp>
+#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
@@ -231,7 +243,7 @@ namespace senf {
 }
 
 ///////////////////////////////hh.e////////////////////////////////////////
-//#include "Daemon.cci"
+#include "Daemon.cci"
 //#include "Daemon.ct"
 //#include "Daemon.cti"
 #endif