From 89d655566f3c9556768e83ab9e8cc4b272be2fc0 Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Thu, 24 Feb 2005 15:21:28 +0000 Subject: [PATCH] tviced-log-thread-at-high-loglevel-20050224 if loglevel > 999, log thread id as part of logging --- src/viced/viced.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/viced/viced.c b/src/viced/viced.c index e2251bc17..3cbe1fb51 100644 --- a/src/viced/viced.c +++ b/src/viced/viced.c @@ -88,6 +88,7 @@ RCSID #include "host.h" #ifdef AFS_PTHREAD_ENV #include "softsig.h" +char *(*threadNameProgram) (); #endif #if defined(AFS_SGI_ENV) #include "sys/schedctl.h" @@ -315,6 +316,18 @@ ResetCheckDescriptors(void) #endif } +#if defined(AFS_PTHREAD_ENV) +char * +threadName(void) +{ + char threadid[16]; + if (LogLevel > 999) { + afs_snprintf(threadid, 16, "%d", pthread_getspecific(rx_thread_id_key)); + return threadid; + } else + return NULL; +} +#endif /* proc called by rxkad module to get a key */ static int @@ -1703,6 +1716,10 @@ main(int argc, char *argv[]) V_BreakVolumeCallbacks = BreakVolumeCallBacksLater; } +#if defined(AFS_PTHREAD_ENV) + threadNameProgram = threadName; +#endif + /* initialize libacl routines */ acl_Initialize(ACL_VERSION); -- 2.39.5