From: Derrick Brashear Date: Thu, 24 Feb 2005 15:23:41 +0000 (+0000) Subject: STABLE14-tviced-log-thread-at-high-loglevel-20050224 X-Git-Tag: openafs-devel-1_3_80~38 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=37fd01705f221b6baddf1f2759ac9af686c666d7;p=packages%2Fo%2Fopenafs.git STABLE14-tviced-log-thread-at-high-loglevel-20050224 if loglevel > 999, log thread id as part of logging (cherry picked from commit 89d655566f3c9556768e83ab9e8cc4b272be2fc0) --- diff --git a/src/viced/viced.c b/src/viced/viced.c index e2251bc17..6d64762ca 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 @@ -381,7 +394,6 @@ CheckAdminName() } /*CheckAdminName */ - static void setThreadId(char *s) { @@ -1703,6 +1715,10 @@ main(int argc, char *argv[]) V_BreakVolumeCallbacks = BreakVolumeCallBacksLater; } +#if defined(AFS_PTHREAD_ENV) + threadNameProgram = threadName; +#endif + /* initialize libacl routines */ acl_Initialize(ACL_VERSION);