conf_stat shouldn't be global and organize more code.

This commit is contained in:
Christian Deacon
2025-02-23 07:26:51 -05:00
parent e5c11bb20c
commit 6298d7ee17
2 changed files with 7 additions and 4 deletions

View File

@@ -18,7 +18,6 @@
#include <loader/utils/helpers.h> #include <loader/utils/helpers.h>
int cont = 1; int cont = 1;
struct stat conf_stat;
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
@@ -74,7 +73,7 @@ int main(int argc, char *argv[])
if (ifidx < 0) if (ifidx < 0)
{ {
fprintf(stderr, "[ERROR] Failed to retrieve index of interface '%s'.\n", cfg.interface); fprintf(stderr, "[ERROR] Failed to retrieve index of network interface '%s'.\n", cfg.interface);
return EXIT_FAILURE; return EXIT_FAILURE;
} }
@@ -122,6 +121,7 @@ int main(int argc, char *argv[])
// Signal. // Signal.
signal(SIGINT, SignalHndl); signal(SIGINT, SignalHndl);
signal(SIGTERM, SignalHndl);
// Receive CPU count for stats map parsing. // Receive CPU count for stats map parsing.
int cpus = get_nprocs_conf(); int cpus = get_nprocs_conf();
@@ -134,6 +134,8 @@ int main(int argc, char *argv[])
unsigned int sleep_time = cfg.stdout_update_time * 1000; unsigned int sleep_time = cfg.stdout_update_time * 1000;
struct stat conf_stat;
while (cont) while (cont)
{ {
// Get current time. // Get current time.

View File

@@ -550,9 +550,10 @@ void PrintConfig(config__t* cfg)
fprintf(stdout, "\tGeneral Settings\n"); fprintf(stdout, "\tGeneral Settings\n");
fprintf(stdout, "\t\tInterface Name => %s\n", cfg->interface); fprintf(stdout, "\t\tInterface Name => %s\n", cfg->interface);
fprintf(stdout, "\t\tUpdate Time => %d\n", cfg->updatetime); fprintf(stdout, "\t\tUpdate Time => %d\n", cfg->updatetime);
fprintf(stdout, "\t\tStdout Update Time => %d\n\n", cfg->stdout_update_time); fprintf(stdout, "\t\tStdout Update Time => %d\n", cfg->stdout_update_time);
fprintf(stdout, "\t\tNo Stats => %d\n\n", cfg->nostats);
fprintf(stdout, "\tFiltes\n"); fprintf(stdout, "\tFilters\n");
for (int i = 0; i < MAX_FILTERS; i++) for (int i = 0; i < MAX_FILTERS; i++)
{ {