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

Davis, Arlin R arlin.r.davis at intel.com
Mon May 18 14:33:08 PDT 2009


 
>
>That's fine - what about Windows?  :)
>
>

Yes, I do windows. Please verify following patch:

diff --git a/dapl/common/dapl_debug.c b/dapl/common/dapl_debug.c
index 20ee405..6723217 100644
--- a/dapl/common/dapl_debug.c
+++ b/dapl/common/dapl_debug.c
@@ -49,8 +49,8 @@ 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:%lx: ", _ptr_host_,
-				dapl_os_getpid());
+			fprintf(stdout, "%s:%x: ", _ptr_host_,
+				dapl_os_gettid());
 			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 0378a70..cb61cae 100644
--- a/dapl/udapl/linux/dapl_osd.h
+++ b/dapl/udapl/linux/dapl_osd.h
@@ -572,7 +572,8 @@ 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 (long int)pthread_self 
+#define dapl_os_getpid (DAT_UINT32)getpid 
+#define dapl_os_gettid (DAT_UINT32)pthread_self 
 
 #endif /*  _DAPL_OSD_H_ */
 
diff --git a/dapl/udapl/windows/dapl_osd.h b/dapl/udapl/windows/dapl_osd.h
index cdfeb24..416a24b 100644
--- a/dapl/udapl/windows/dapl_osd.h
+++ b/dapl/udapl/windows/dapl_osd.h
@@ -501,11 +501,8 @@ dapl_os_strtol(const char *nptr, char **endptr, int base)
     return strtol(nptr, endptr, base);
 }
 
-STATIC __inline int
-dapl_os_getpid(void)
-{
-	return (int)GetCurrentProcessId();
-}
+#define dapl_os_getpid	(DAT_UINT32)GetCurrentProcessId()
+#define dapl_os_gettid	(DAT_UINT32)GetCurrentThreadId()
 
 /*
  *  Debug Helper Functions





More information about the general mailing list