Skip to content

Commit 0ae5721

Browse files
committed
Emit version number on startup
Also configure syslog before logging. References #163.
1 parent 1243d7d commit 0ae5721

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

src/daemon.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,6 @@ void go_daemon(void (*fan_control)())
147147
signal(SIGQUIT, signal_handler);
148148
signal(SIGINT, signal_handler);
149149

150-
syslog(LOG_INFO, "%s starting up", PROGRAM_NAME);
151-
152150
// Setup syslog logging - see SETLOGMASK(3)
153151
if(verbose) {
154152
setlogmask(LOG_UPTO(LOG_DEBUG));
@@ -159,6 +157,8 @@ void go_daemon(void (*fan_control)())
159157
openlog(PROGRAM_NAME, LOG_CONS, LOG_USER);
160158
}
161159

160+
mbp_log(LOG_INFO, "%s %s starting up", PROGRAM_NAME, PROGRAM_VERSION);
161+
162162
// configure timer slack
163163
int err = prctl(PR_SET_TIMERSLACK, 1000 * 1000 * 1000, 0, 0, 0);
164164
if (err == -1) {

src/global.h

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ extern int daemonize;
55
extern int verbose;
66

77
extern const char* PROGRAM_NAME;
8+
extern const char* PROGRAM_VERSION;
89
extern const char* PROGRAM_PID;
910

1011
struct s_sensors {

src/main.c

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ int daemonize = 1;
3737
int verbose = 0;
3838

3939
const char *PROGRAM_NAME = "mbpfan";
40+
const char *PROGRAM_VERSION = "2.2.0";
4041
const char *PROGRAM_PID = "/var/run/mbpfan.pid";
4142

4243
const char *CORETEMP_PATH = "/sys/devices/platform/coretemp.0";

0 commit comments

Comments
 (0)