#include "common.h"
-bool daemon_process = true;
-int log_level = LOG_INFO;
-bool log_syslog = false;
+bool daemon_process = true;
+int log_level = LOG_INFO;
+bool log_syslog = false;
+const char *log_state = "";
static FILE *pidfile = NULL;
static A(exitcall_t) __exit = ARRAY_INIT;
-void common_register_exit(exitcall_t _exit)
+void common_register_exit(exitcall_t exitcall)
{
- array_add(__exit, _exit);
+ array_add(__exit, exitcall);
}
static void common_shutdown(void)
{
+ log_state = "stopping ";
if (daemon_process && log_syslog) {
- info("stopping...");
+ info("");
}
pidfile_close();
for (int i = array_len(__exit) - 1 ; i >= 0 ; --i) {
if (__ran) {
return;
}
+ log_state = "starting ";
if (atexit(common_shutdown)) {
fputs("Cannot hook my atexit function, quitting !\n", stderr);
abort();