para_write: Return proper error code.
[paraslash.git] / daemon.h
1 /** \file daemon.h exported symbols from daemon.c */
2
3
4 void daemonize(void);
5 void daemon_open_log_or_die(void);
6 void daemon_close_log(void);
7 void log_welcome(const char *whoami);
8 void drop_privileges_or_die(const char *username, const char *groupname);
9 /** used for server_uptime() */
10 enum uptime {UPTIME_SET, UPTIME_GET};
11 time_t server_uptime(enum uptime set_or_get);
12 __malloc char *uptime_str(void);
13 void daemon_set_logfile(char *logfile_name);
14 void daemon_set_flag(unsigned flag);
15 void daemon_clear_flag(unsigned flag);
16 void daemon_set_loglevel(char *loglevel);
17 void daemon_set_default_log_colors(void);
18 void daemon_set_log_color_or_die(char const *arg);
19
20 /** Daemon log configuration flags. */
21 enum daemon_flags {
22         /** Whether the hostname should be logged. */
23         DF_LOG_HOSTNAME = 1,
24         /** Whether the PID should be logged. */
25         DF_LOG_PID = 2,
26         /** Prepend log message with date and time. */
27         DF_LOG_TIME = 4,
28         /** Also print the loglevel for each message. */
29         DF_LOG_LL = 8,
30         /** Use colored output. */
31         DF_COLOR_LOG = 16,
32         /** Include milliseconds in log output. */
33         DF_LOG_TIMING = 32
34 };