diff --git a/server/src/if.c b/server/src/if.c index 64e7caf27..01eb104df 100644 --- a/server/src/if.c +++ b/server/src/if.c @@ -31,7 +31,7 @@ struct interface * if_create(int index) { i->index = index; if_indextoname(index, i->name); - debug(3, "Created interface '%s'", i->name, i->index, i->refcnt); + debug(3, "Created interface '%s' (index=%u)", i->name, i->index); list_init(&i->sockets, NULL); list_push(&interfaces, i); diff --git a/server/src/opal.c b/server/src/opal.c index f97e06c0c..b7783aa05 100644 --- a/server/src/opal.c +++ b/server/src/opal.c @@ -152,7 +152,7 @@ int opal_read(struct node *n, struct msg *m) if ((ret = OpalWaitForAsyncSendRequest(&id)) != EOK) { state = OpalGetAsyncModelState(); if ((state == STATE_RESET) || (state == STATE_STOP)) { - info("OpalGetAsyncModelState(): Model stopped or resetted!"); + warn("OpalGetAsyncModelState(): Model stopped or resetted!"); die(); } @@ -194,7 +194,7 @@ int opal_read(struct node *n, struct msg *m) * has not been stopped. If it has, we quit. */ state = OpalGetAsyncModelState(); if ((state == STATE_RESET) || (state == STATE_STOP)) { - info("OpalGetAsyncModelState(): Model stopped or resetted!"); + warn("OpalGetAsyncModelState(): Model stopped or resetted!"); die(); } @@ -212,7 +212,7 @@ int opal_write(struct node *n, struct msg *m) state = OpalGetAsyncModelState(); if ((state == STATE_RESET) || (state == STATE_STOP)) { - info("OpalGetAsyncModelState(): Model stopped or resetted!"); + warn("OpalGetAsyncModelState(): Model stopped or resetted!"); die(); } diff --git a/server/src/random.c b/server/src/random.c index 9350e4f2d..e169e4983 100644 --- a/server/src/random.c +++ b/server/src/random.c @@ -40,6 +40,7 @@ int main(int argc, char *argv[]) printf("Simulator2Simulator Server %s (built on %s %s)\n", BLU(VERSION), MAG(__DATE__), MAG(__TIME__)); printf(" Copyright 2014, Institute for Automation of Complex Power Systems, EONERC\n"); printf(" Steffen Vogel \n"); + exit(EXIT_FAILURE); } diff --git a/server/src/server.c b/server/src/server.c index f352f4b86..5da2a3167 100644 --- a/server/src/server.c +++ b/server/src/server.c @@ -34,8 +34,8 @@ extern struct list paths; extern struct list interfaces; /** The global configuration */ -struct settings settings; -config_t config; +static struct settings settings; +static config_t config; static void quit() { @@ -61,18 +61,13 @@ static void quit() list_destroy(&interfaces); config_destroy(&config); + info("Goodbye!"); + _exit(EXIT_SUCCESS); } void realtime_init() { INDENT - /* Check for realtime kernel patch */ - struct stat st; - if (stat("/sys/kernel/realtime", &st)) - warn("Use a RT-preempt patched Linux for lower latencies!"); - else - info("Server is running on a realtime patched kernel"); - /* Use FIFO scheduler with real time priority */ if (settings.priority) { struct sched_param param = { .sched_priority = settings.priority }; @@ -144,7 +139,7 @@ int main(int argc, char *argv[]) list_init(&paths, (dtor_cb_t) path_destroy); list_init(&interfaces, (dtor_cb_t) if_destroy); - /* Start initialization */ + info("Initialize realtime system:"); realtime_init(); diff --git a/server/src/test.c b/server/src/test.c index 18768f6b7..6a8fbb6e1 100644 --- a/server/src/test.c +++ b/server/src/test.c @@ -122,9 +122,9 @@ int main(int argc, char *argv[]) error("Unknown option '-%c'.", optopt); else error("Unknown option character '\\x%x'.", optopt); - exit(1); + exit(EXIT_FAILURE); default: - abort (); + abort(); } continue;