/** \file daemon.h exported symbols from daemon.c */ void daemonize(bool parent_waits); void daemon_open_log_or_die(void); void daemon_close_log(void); void log_welcome(const char *whoami); void drop_privileges_or_die(const char *username, const char *groupname); /** used for server_uptime() */ void set_server_start_time(const struct timeval *startuptime); time_t get_server_uptime(const struct timeval *current_time); __malloc char *get_server_uptime_str(const struct timeval *current_time); void daemon_set_logfile(char *logfile_name); void daemon_set_flag(unsigned flag); void daemon_clear_flag(unsigned flag); void daemon_set_loglevel(char *loglevel); void daemon_set_default_log_colors(void); void daemon_set_log_color_or_die(char const *arg); __printf_2_3 void daemon_log(int ll, const char* fmt,...); /** Daemon log configuration flags. */ enum daemon_flags { /** Whether the hostname should be logged. */ DF_LOG_HOSTNAME = 1, /** Whether the PID should be logged. */ DF_LOG_PID = 2, /** Prepend log message with date and time. */ DF_LOG_TIME = 4, /** Also print the loglevel for each message. */ DF_LOG_LL = 8, /** Use colored output. */ DF_COLOR_LOG = 16, /** Include milliseconds in log output. */ DF_LOG_TIMING = 32 };