1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

made debug level not compiled-in

git-svn-id: https://zerberus.eonerc.rwth-aachen.de:8443/svn/s2ss/trunk@209 8ec27952-4edc-4aab-86aa-e87bb2611832
This commit is contained in:
Steffen Vogel 2014-09-07 16:28:50 +00:00
parent 7096f974bb
commit dfc3f77c35
7 changed files with 20 additions and 8 deletions

View file

@ -18,7 +18,7 @@ RM = rm -f
DOXY = doxygen
# Debug level (if not set via 'make V=?')
V ?= 5
V ?= 2
# Some details about the compiled version
GIT_TAG = $(shell git describe --tags --abbrev=0)

View file

@ -2,6 +2,7 @@
affinity = 0x02; # Mask of cores the server should run on
priority = 50; # Scheduler priority for the server
debug = 5; # The level of verbosity for debug messages
nodes = {
acs = {

View file

@ -26,6 +26,8 @@ struct settings {
int priority;
/** Process affinity of the server and all created threads */
int affinity;
/** Debug log level */
int debug;
/** A libconfig object pointing to the root of the config file */
config_setting_t *cfg;

View file

@ -38,6 +38,8 @@ struct settings;
struct sockaddr_in;
struct sockaddr;
extern int debug;
/** Logs variadic messages to stdout.
*
* @param lvl The log level
@ -84,7 +86,7 @@ struct timespec timespec_rate(double rate);
/** Printf alike debug message with level. */
#define debug(lvl, msg, ...) do { \
if (lvl <= V) \
if (lvl <= debug) \
print(DEBUG, msg, ##__VA_ARGS__); \
} while (0)

View file

@ -67,6 +67,9 @@ int config_parse_global(config_setting_t *cfg, struct settings *set)
{
config_setting_lookup_int(cfg, "affinity", &set->affinity);
config_setting_lookup_int(cfg, "priority", &set->priority);
config_setting_lookup_int(cfg, "debug", &set->debug);
debug = set->debug;
set->cfg = cfg;

View file

@ -144,13 +144,8 @@ int main(int argc, char *argv[])
}
info("This is %s %s", BLU("s2ss"), BLU(VERSION));
debug(1, "Running with debug level: %u", V);
/* Check priviledges */
if (getuid() != 0)
error("The server requires superuser privileges!");
/* Setup signals */
/* Setup exit handler */
struct sigaction sa_quit = {
.sa_flags = SA_SIGINFO,
.sa_sigaction = quit
@ -165,6 +160,12 @@ int main(int argc, char *argv[])
config_init(&config);
config_parse(argv[1], &config, &settings, &nodes, &paths);
debug(1, "Running with debug level: %u", settings.debug);
/* Check priviledges */
if (getuid() != 0)
error("The server requires superuser privileges!");
/* Check for realtime kernel patch */
struct stat st;
if (stat("/sys/kernel/realtime", &st))

View file

@ -21,6 +21,9 @@
#include "cfg.h"
#include "utils.h"
/* This global variable contains the debug level for debug() and assert() macros */
int debug = V;
void print(enum log_level lvl, const char *fmt, ...)
{
struct timespec ts;