git.droids-corp.org
/
dpdk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
eal: fix x32 build
[dpdk.git]
/
lib
/
librte_eal
/
common
/
eal_common_log.c
diff --git
a/lib/librte_eal/common/eal_common_log.c
b/lib/librte_eal/common/eal_common_log.c
index
ff44d23
..
1ae8de7
100644
(file)
--- 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);
/* 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)
}
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);
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_LOG_HISTORY; i++) {
rte_spinlock_unlock(&log_list_lock);
for (i=0; i<RTE_LOG_HISTORY; i++) {
@@
-265,14
+269,15
@@
rte_log_dump_history(FILE *out)
* defined by the previous call to rte_openlog_stream().
*/
int
* defined by the previous call to rte_openlog_stream().
*/
int
-rte_vlog(__attribute__((unused)) uint32_t level,
- __attribute__((unused)) uint32_t logtype,
- const char *format, va_list ap)
+rte_vlog(uint32_t level, uint32_t logtype, const char *format, va_list ap)
{
int ret;
FILE *f = rte_logs.file;
unsigned lcore_id;
{
int ret;
FILE *f = rte_logs.file;
unsigned lcore_id;
+ if ((level > 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) {
/* 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().
/*
* 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, ...)
*/
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;
}
rte_openlog_stream(default_log);
return 0;
}
-