Emit version number on startup

Also configure syslog before logging.  References #163.
This commit is contained in:
Andrew Gaul 2019-10-30 21:04:52 -07:00
parent 1243d7df6c
commit 0ae57217f7
3 changed files with 4 additions and 2 deletions

View file

@ -147,8 +147,6 @@ void go_daemon(void (*fan_control)())
signal(SIGQUIT, signal_handler);
signal(SIGINT, signal_handler);
syslog(LOG_INFO, "%s starting up", PROGRAM_NAME);
// Setup syslog logging - see SETLOGMASK(3)
if(verbose) {
setlogmask(LOG_UPTO(LOG_DEBUG));
@ -159,6 +157,8 @@ void go_daemon(void (*fan_control)())
openlog(PROGRAM_NAME, LOG_CONS, LOG_USER);
}
mbp_log(LOG_INFO, "%s %s starting up", PROGRAM_NAME, PROGRAM_VERSION);
// configure timer slack
int err = prctl(PR_SET_TIMERSLACK, 1000 * 1000 * 1000, 0, 0, 0);
if (err == -1) {

View file

@ -5,6 +5,7 @@ extern int daemonize;
extern int verbose;
extern const char* PROGRAM_NAME;
extern const char* PROGRAM_VERSION;
extern const char* PROGRAM_PID;
struct s_sensors {

View file

@ -37,6 +37,7 @@ int daemonize = 1;
int verbose = 0;
const char *PROGRAM_NAME = "mbpfan";
const char *PROGRAM_VERSION = "2.2.0";
const char *PROGRAM_PID = "/var/run/mbpfan.pid";
const char *CORETEMP_PATH = "/sys/devices/platform/coretemp.0";