Project

General

Profile

Feature #247 » 0001-Fix-compiler-warnings-cleanup-counters-config-code.patch

Victor Julien, 12/17/2010 03:31 AM

View differences:

src/alert-fastlog.c
struct tm *t = (struct tm *)localtime_r(&time, &local_tm);
snprintf(str, size, "%02d/%02d/%02d-%02d:%02d:%02d.%06u",
t->tm_mon + 1, t->tm_mday, 1, t->tm_year + 1900, t->tm_hour,
t->tm_mon + 1, t->tm_mday, t->tm_year + 1900, t->tm_hour,
t->tm_min, t->tm_sec, (uint32_t) ts->tv_usec);
}
src/counters.c
static SCPerfOPIfaceContext *sc_perf_op_ctx = NULL;
static time_t sc_start_time;
static uint32_t sc_counter_int = SC_PERF_MGMTT_TTS;
static const char *enabled = "yes";
/** refresh interval in seconds */
static uint32_t sc_counter_tts = SC_PERF_MGMTT_TTS;
/** is the stats counter enabled? */
static char sc_counter_enabled = TRUE;
/**
* \brief Adds a value of type uint64_t to the local counter.
......
}
/* Check if the stats module is enabled or not */
if (stats != NULL) {
enabled = ConfNodeLookupChildValue(stats, "enabled");
if (strncmp(enabled, "no", 2) == 0) {
const char *enabled = ConfNodeLookupChildValue(stats, "enabled");
if (strcasecmp(enabled, "no") == 0) {
sc_counter_enabled = FALSE;
SCLogDebug("Stats module has been disabled");
SCReturn;
}
const char *interval = ConfNodeLookupChildValue(stats, "interval");
if (interval != NULL)
sc_counter_int = (uint32_t) atoi(interval);
sc_counter_tts = (uint32_t) atoi(interval);
}
/* Store the engine start time */
......
while (run) {
TmThreadTestThreadUnPaused(tv_local);
cond_time.tv_sec = time(NULL) + sc_counter_int;
cond_time.tv_sec = time(NULL) + sc_counter_tts;
cond_time.tv_nsec = 0;
SCMutexLock(tv_local->m);
......
*/
void SCPerfSpawnThreads(void)
{
if (strncmp(enabled, "no", 2) == 0) {
return;
SCEnter();
if (!sc_counter_enabled) {
SCReturn;
}
ThreadVars *tv_wakeup = NULL;
......
exit(EXIT_FAILURE);
}
return;
SCReturn;
}
/**
suricata.yaml
# on the log file.
- stats:
enabled: yes
filename: stats1.log
interval: 40
filename: stats.log
interval: 8
defrag:
max-frags: 65535
(2-2/2)