summaryrefslogtreecommitdiffstats
path: root/lib/log.c
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2017-06-15 18:05:19 +0200
committerQuentin Young <qlyoung@cumulusnetworks.com>2017-06-30 01:32:15 +0200
commite0bebc7c223abf239b5ccda1c2de42a2b0410455 (patch)
treec8f3d876bc81c5d34c5966177bff2ccdeaec09c0 /lib/log.c
parentlib: un-static trash buffer for pipe poker (diff)
downloadfrr-e0bebc7c223abf239b5ccda1c2de42a2b0410455.tar.xz
frr-e0bebc7c223abf239b5ccda1c2de42a2b0410455.zip
lib: mt-safe tracebacks
can't be using them statics anymore sonny Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/log.c')
-rw-r--r--lib/log.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/lib/log.c b/lib/log.c
index a8b221fd6..1c61d7216 100644
--- a/lib/log.c
+++ b/lib/log.c
@@ -509,16 +509,18 @@ zlog_signal(int signo, const char *action
);
s = buf;
- if (!thread_current)
+ struct thread *tc;
+ tc = pthread_getspecific (thread_current);
+ if (!tc)
s = str_append (LOC, "no thread information available\n");
else
{
s = str_append (LOC, "in thread ");
- s = str_append (LOC, thread_current->funcname);
+ s = str_append (LOC, tc->funcname);
s = str_append (LOC, " scheduled from ");
- s = str_append (LOC, thread_current->schedfrom);
+ s = str_append (LOC, tc->schedfrom);
s = str_append (LOC, ":");
- s = num_append (LOC, thread_current->schedfrom_line);
+ s = num_append (LOC, tc->schedfrom_line);
s = str_append (LOC, "\n");
}
@@ -700,10 +702,13 @@ ZLOG_FUNC(zlog_debug, LOG_DEBUG)
void zlog_thread_info (int log_level)
{
- if (thread_current)
+ struct thread *tc;
+ tc = pthread_getspecific (thread_current);
+
+ if (tc)
zlog(log_level, "Current thread function %s, scheduled from "
- "file %s, line %u", thread_current->funcname,
- thread_current->schedfrom, thread_current->schedfrom_line);
+ "file %s, line %u", tc->funcname,
+ tc->schedfrom, tc->schedfrom_line);
else
zlog(log_level, "Current thread not known/applicable");
}