blob: 4a27f2b3418f6a282c9a424ec4fd4b3e3be1cc87 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
/* SPDX-License-Identifier: GPL-2.0 */
/** \file daemon.h exported symbols from daemon.c */
int daemonize(bool parent_waits);
void daemon_open_log_or_die(void);
void daemon_close_log(void);
void daemon_log_welcome(const char *whoami);
void daemon_set_priority(int prio);
void daemon_drop_privileges_or_die(const char *username, const char *groupname);
void daemon_set_start_time(void);
time_t daemon_get_uptime(const struct timeval *current_time);
__malloc char *daemon_get_uptime_str(const struct timeval *current_time);
void daemon_set_logfile(const char *logfile_name);
void daemon_set_hooks(void (*pre_log_hook)(void), void (*post_log_hook)(void));
void daemon_set_flag(unsigned flag);
int daemon_get_loglevel(void);
void daemon_set_loglevel(int loglevel);
bool daemon_init_colors_or_die(int color_arg, int color_arg_auto,
int color_arg_no, bool logfile_given);
void daemon_set_log_color_or_die(const char *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
};
|