]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: Convert thread.c to use new error-code subsystem
authorDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 20 Aug 2018 13:45:06 +0000 (09:45 -0400)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Thu, 6 Sep 2018 20:50:58 +0000 (20:50 +0000)
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
lib/lib_errors.c
lib/lib_errors.h
lib/thread.c

index 5610a32cf14b6d15589c712f2f3a237f2d5f73da..01fa27e82cc49d9462fb307f3772f45ce511c63d 100644 (file)
@@ -40,6 +40,12 @@ static struct log_ref ferr_lib_warn[] = {
                .description = "During system startup an invalid parameter for the namesapce was give to FRR",
                .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,
        },
index 23f5468c7792e90e625e5d78eeabfb6b59d65795..d4581918c7a20a3098a65134e6fe41b106313b40 100644 (file)
@@ -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);
index 52bc79ffe6ba528ad81afb4df505baed8d394c04..b2740baf5da5e859ee313a5c75c1fc7f850f4f49 100644 (file)
@@ -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);