diff --git a/server/include/utils.h b/server/include/utils.h index bfe635099..833be9fb7 100644 --- a/server/include/utils.h +++ b/server/include/utils.h @@ -36,9 +36,8 @@ /* Alternate character set */ #define ACS(chr) "\e(0" chr "\e(B" -#define ACS_VERTICAL "|" #define ACS_HORIZONTAL ACS("\x71") -//#define ACS_VERTICAL ACS("\x78") +#define ACS_VERTICAL ACS("\x78") #define ACS_VERTRIGHT ACS("\x74") /* UTF-8 Line drawing characters */ @@ -77,7 +76,7 @@ extern pthread_t _mtid; */ int strap(char *dest, size_t size, const char *fmt, ...); -/** Variable arguments (stdarg) version of strap() */ +/** Variadic version of strap() */ int vstrap(char *dest, size_t size, const char *fmt, va_list va); /** Convert integer to cpu_set_t. @@ -105,9 +104,8 @@ void die(); /** Check assertion and exit if failed. */ #define assert(exp) do { \ if (EXPECT(!exp, 0)) { \ - print(ERROR, "Assertion failed: '%s' in %s, %s:%d", \ + error, "Assertion failed: '%s' in %s, %s:%d", \ #exp, __FUNCTION__, __BASE_FILE__, __LINE__); \ - exit(EXIT_FAILURE); \ } } while (0) #endif /* _UTILS_H_ */ diff --git a/server/src/hist.c b/server/src/hist.c index 9c4d3118c..dd89a1a56 100644 --- a/server/src/hist.c +++ b/server/src/hist.c @@ -125,7 +125,7 @@ void hist_plot(struct hist *h) } /* Print plot */ - info("%9s | %5s | %s", "Value", "Occur", "Histogram Plot:"); + info("%9s | %5s | %s", "Value", "Occur", "Plot"); line(); for (int i = 0; i < h->length; i++) { diff --git a/server/src/log.c b/server/src/log.c index ea41e7e0b..72fdd7c1d 100644 --- a/server/src/log.c +++ b/server/src/log.c @@ -142,7 +142,7 @@ void serror(const char *fmt, ...) vsnprintf(buf, sizeof(buf), fmt, ap); va_end(ap); - log_print(ERROR, "%s: %s", buf, strerror(errno)); + log_print(ERROR, "%s: %m (%u)", buf, errno); die(); } @@ -161,4 +161,4 @@ void cerror(config_setting_t *cfg, const char *fmt, ...) : "(stdio)", config_setting_source_line(cfg)); die(); -} \ No newline at end of file +} diff --git a/server/src/server.c b/server/src/server.c index e48be40f5..f070024d3 100644 --- a/server/src/server.c +++ b/server/src/server.c @@ -39,15 +39,15 @@ static config_t config; static void quit() { - info("Stopping paths:"); + info("Stopping paths"); FOREACH(&paths, it) path_stop(it->path); - info("Stopping nodes:"); + info("Stopping nodes"); FOREACH(&nodes, it) node_stop(it->node); - info("Stopping interfaces:"); + info("Stopping interfaces"); FOREACH(&interfaces, it) if_stop(it->interface); @@ -143,35 +143,34 @@ int main(int argc, char *argv[]) list_init(&paths, (dtor_cb_t) path_destroy); list_init(&interfaces, (dtor_cb_t) if_destroy); - info("Initialize real-time system:"); + info("Initialize real-time system"); realtime_init(); - info("Initialize signals:"); + info("Initialize signals"); signals_init(); - info("Initialize node types:"); + info("Initialize node types"); node_init(argc, argv); - info("Parsing configuration:"); + info("Parsing configuration"); config_init(&config); config_parse(configfile, &config, &settings, &nodes, &paths); /* Connect all nodes and start one thread per path */ - info("Starting nodes:"); + info("Starting nodes"); FOREACH(&nodes, it) node_start(it->node); - info("Starting interfaces:"); + info("Starting interfaces"); FOREACH(&interfaces, it) if_start(it->interface, settings.affinity); - info("Starting paths:"); + info("Starting paths"); FOREACH(&paths, it) path_start(it->path); /* Run! */ if (settings.stats > 0) { - info("Runtime Statistics:"); info("%-32s : %-8s %-8s %-8s %-8s %-8s", "Source " MAG("=>") " Destination", "#Sent", "#Recv", "#Drop", "#Skip", "#Inval"); line();