[ofa-general] [PATCH] uDAPL (v2.0) linux_osd: use pthread_self instead of getpid for debug messages

Arlin Davis arlin.r.davis at intel.com
Mon May 18 12:07:30 PDT 2009


getpid provides process ids which are not unique. Use unique thread
id's in debug messages to help isolate issues across many device
opens with multiple CM threads.

Signed-off-by: Arlin Davis <arlin.r.davis at intel.com>
---
 dapl/common/dapl_debug.c    |    2 +-
 dapl/udapl/linux/dapl_osd.h |    3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/dapl/common/dapl_debug.c b/dapl/common/dapl_debug.c
index ba33cfc..20ee405 100644
--- a/dapl/common/dapl_debug.c
+++ b/dapl/common/dapl_debug.c
@@ -49,7 +49,7 @@ void dapl_internal_dbg_log(DAPL_DBG_TYPE type, const char *fmt, ...)
 	if (type & g_dapl_dbg_type) {
 		if (DAPL_DBG_DEST_STDOUT & g_dapl_dbg_dest) {
 			va_start(args, fmt);
-			fprintf(stdout, "%s:%d: ", _ptr_host_,
+			fprintf(stdout, "%s:%lx: ", _ptr_host_,
 				dapl_os_getpid());
 			dapl_os_vprintf(fmt, args);
 			va_end(args);
diff --git a/dapl/udapl/linux/dapl_osd.h b/dapl/udapl/linux/dapl_osd.h
index 1c098c5..0378a70 100644
--- a/dapl/udapl/linux/dapl_osd.h
+++ b/dapl/udapl/linux/dapl_osd.h
@@ -572,8 +572,7 @@ dapl_os_strtol(const char *nptr, char **endptr, int base)
 #define dapl_os_vprintf(fmt,args)	vprintf(fmt,args)
 #define dapl_os_syslog(fmt,args)	vsyslog(LOG_USER|LOG_WARNING,fmt,args)
 
-#define dapl_os_getpid getpid
-
+#define dapl_os_getpid (long int)pthread_self 
 
 #endif /*  _DAPL_OSD_H_ */
 
-- 
1.5.2.5





More information about the general mailing list