X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_eal%2Fcommon%2Feal_common_log.c;h=1ae8de708058acd4133c568f6aebba0f37e7bc76;hb=0ea73979aabdbf2ab26fc354479035485873a4e3;hp=ff44d23cb1a9227365f4d7fc85f115aaea0363f4;hpb=ff708facfcbf42f3dcb3c62d82ecd93e7b8c2506;p=dpdk.git diff --git a/lib/librte_eal/common/eal_common_log.c b/lib/librte_eal/common/eal_common_log.c index ff44d23cb1..1ae8de7080 100644 --- a/lib/librte_eal/common/eal_common_log.c +++ b/lib/librte_eal/common/eal_common_log.c @@ -119,7 +119,10 @@ rte_log_add_in_history(const char *buf, size_t size) /* get a buffer for adding in history */ if (log_history_size > RTE_LOG_HISTORY) { hist_buf = STAILQ_FIRST(&log_history); - STAILQ_REMOVE_HEAD(&log_history, next); + if (hist_buf) { + STAILQ_REMOVE_HEAD(&log_history, next); + log_history_size--; + } } else { if (rte_mempool_mc_get(log_history_mp, &obj) < 0) @@ -234,6 +237,7 @@ rte_log_dump_history(FILE *out) rte_spinlock_lock(&log_list_lock); tmp_log_history = log_history; STAILQ_INIT(&log_history); + log_history_size = 0; rte_spinlock_unlock(&log_list_lock); for (i=0; i rte_logs.level) || !(logtype & rte_logs.type)) + return 0; + /* save loglevel and logtype in a global per-lcore variable */ lcore_id = rte_lcore_id(); if (lcore_id < RTE_MAX_LCORE) { @@ -288,6 +293,7 @@ rte_vlog(__attribute__((unused)) uint32_t level, /* * Generates a log message The message will be sent in the stream * defined by the previous call to rte_openlog_stream(). + * No need to check level here, done by rte_vlog(). */ int rte_log(uint32_t level, uint32_t logtype, const char *format, ...) @@ -329,4 +335,3 @@ rte_eal_common_log_init(FILE *default_log) rte_openlog_stream(default_log); return 0; } -