diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-08-20 15:45:06 +0200 |
---|---|---|
committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2018-09-06 22:50:58 +0200 |
commit | 9ef9495e3a96e6d3ebcce46d716500ad396fe979 (patch) | |
tree | c0c99bcb2e0794043c0dd824f258db458c68e5ce /lib | |
parent | lib: Convert netns_linux.c to new error-code work (diff) | |
download | frr-9ef9495e3a96e6d3ebcce46d716500ad396fe979.tar.xz frr-9ef9495e3a96e6d3ebcce46d716500ad396fe979.zip |
lib: Convert thread.c to use new error-code subsystem
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/lib_errors.c | 6 | ||||
-rw-r--r-- | lib/lib_errors.h | 1 | ||||
-rw-r--r-- | lib/thread.c | 7 |
3 files changed, 12 insertions, 2 deletions
diff --git a/lib/lib_errors.c b/lib/lib_errors.c index 5610a32cf..01fa27e82 100644 --- a/lib/lib_errors.c +++ b/lib/lib_errors.c @@ -41,6 +41,12 @@ static struct log_ref ferr_lib_warn[] = { .suggestion = "Gather log data and open an Issue. restart FRR", }, { + .code = LIB_WARN_SLOW_THREAD, + .title = "The Event subsystem has detected a slow process", + .description = "The Event subsystem has detected a slow process, this typically indicates that FRR is having trouble completing work in a timely manner. This can be either a misconfiguration, bug, or some combination therof.", + .suggestion = "Gather log data and open an Issue", + }, + { .code = END_FERR, }, }; diff --git a/lib/lib_errors.h b/lib/lib_errors.h index 23f5468c7..d4581918c 100644 --- a/lib/lib_errors.h +++ b/lib/lib_errors.h @@ -41,6 +41,7 @@ enum lib_log_refs { LIB_WARN_SNMP, LIB_WARN_STREAM, LIB_WARN_LINUX_NS, + LIB_WARN_SLOW_THREAD, }; extern void lib_error_init(void); diff --git a/lib/thread.c b/lib/thread.c index 52bc79ffe..b2740baf5 100644 --- a/lib/thread.c +++ b/lib/thread.c @@ -33,6 +33,7 @@ #include "network.h" #include "jhash.h" #include "frratomic.h" +#include "lib_errors.h" DEFINE_MTYPE_STATIC(LIB, THREAD, "Thread") DEFINE_MTYPE_STATIC(LIB, THREAD_MASTER, "Thread master") @@ -1480,7 +1481,8 @@ struct thread *thread_fetch(struct thread_master *m, struct thread *fetch) } /* else die */ - zlog_warn("poll() error: %s", safe_strerror(errno)); + flog_err(LIB_ERR_SYSTEM_CALL, "poll() error: %s", + safe_strerror(errno)); pthread_mutex_unlock(&m->mtx); fetch = NULL; break; @@ -1617,7 +1619,8 @@ void thread_call(struct thread *thread) * Whinge about it now, so we're aware this is yet another task * to fix. */ - zlog_warn( + flog_warn( + LIB_WARN_SLOW_THREAD, "SLOW THREAD: task %s (%lx) ran for %lums (cpu time %lums)", thread->funcname, (unsigned long)thread->func, realtime / 1000, cputime / 1000); |