Skip to content

Commit

Permalink
Emit version number on startup
Browse files Browse the repository at this point in the history
Also configure syslog before logging.  References #163.
  • Loading branch information
gaul committed Oct 31, 2019
1 parent 1243d7d commit 0ae5721
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions src/global.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit 0ae5721

Please sign in to comment.