author | Michael Krelin <hacker@klever.net> | 2011-10-10 21:26:52 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2011-10-12 19:22:51 (UTC) |
commit | 970337c91c02afa9b8d33ab5596270594ffe58e6 (patch) (side-by-side diff) | |
tree | 198e49630826aea7289f60635f52ccb2476d36cc /src/dudki.cc | |
parent | 6a68fcae465905e904eea248ffe6b1ed6b8297a4 (diff) | |
download | dudki-970337c91c02afa9b8d33ab5596270594ffe58e6.zip dudki-970337c91c02afa9b8d33ab5596270594ffe58e6.tar.gz dudki-970337c91c02afa9b8d33ab5596270594ffe58e6.tar.bz2 |
Some work in compiler happiness department.
Signed-off-by: Michael Krelin <hacker@klever.net>
-rw-r--r-- | src/dudki.cc | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/dudki.cc b/src/dudki.cc index 91a3342..1f95be4 100644 --- a/src/dudki.cc +++ b/src/dudki.cc @@ -1,55 +1,57 @@ #include <unistd.h> #include <signal.h> #include <syslog.h> #include <errno.h> #include <iostream> #include <fstream> #include <stdexcept> +#include <cstring> +#include <stdlib.h> using namespace std; #include "configuration.h" #include "util.h" #include "config.h" #ifdef HAVE_GETOPT_H # include <getopt.h> #endif #ifndef DEFAULT_CONF_FILE # define DEFAULT_CONF_FILE "/etc/dudki.conf" #endif #define PHEADER PACKAGE " Version " VERSION #define PCOPY "Copyright (c) 2004-2006 Klever Group" bool finishing = false; bool restarting = false; static char **_argv = NULL; static void lethal_signal_handler(int signum) { syslog(LOG_NOTICE,"Lethal signal received. Terminating."); finishing = true; } static void sighup_handler(int signum) { syslog(LOG_NOTICE,"SUGHUP received, reloading."); restarting = finishing = true; } void check_herd(configuration& config) { process::prepare_herd(); for(processes_t::iterator i=config.processes.begin();i!=config.processes.end();++i) i->second.check(i->first,config); process::unprepare_herd(); } void signal_self(const configuration& config,int signum) { ifstream pids(config.pidfile.c_str(),ios::in); if(!pids) throw runtime_error("Can't detect running instance"); pid_t pid = 0; pids >> pid; if(!pid) throw runtime_error("Can't detect running instance"); if(pid==getpid()) throw 0; if(kill(pid,signum)) throw runtime_error("Failed to signal running instance"); |