[ofw] DAPL debug mods

Stan C. Smith stan.smith at intel.com
Thu Feb 14 16:23:11 PST 2008


Keeping in sync with Linux DAPL: assist debug, hostname & pid prefixed to mesg output.

Signed-off by: Stan Smith (stan.smith at intel.com)

Index: gen1\trunk\ulp\dapl2\dapl\udapl\windows\dapl_osd.h
===================================================================
--- dapl_osd.h	(revision 943)
+++ dapl_osd.h	(working copy)
@@ -56,6 +56,8 @@
 #include <string.h>
 #include <winsock2.h>
 #include <Ws2tcpip.h>
+#include <process.h>
+#define getpid _getpid
 #include <stdlib.h>
 #pragma warning ( pop )
 
@@ -524,7 +526,6 @@
 #define dapl_os_vprintf(fmt,args)	vprintf(fmt,args)
 #define dapl_os_syslog(fmt,args)	/* XXX Need log routine call */
 
-
 #endif /*  _DAPL_OSD_H_ */
 
 /*


Index: gen1\trunk\ulp\dapl2\dapl\common\dapl_debug.c
===================================================================
--- dapl_debug.c	(revision 943)
+++ dapl_debug.c	(working copy)
@@ -36,16 +36,26 @@
 DAPL_DBG_TYPE g_dapl_dbg_type;		/* initialized in dapl_init.c */
 DAPL_DBG_DEST g_dapl_dbg_dest;		/* initialized in dapl_init.c */
 
+static char *_ptr_host_ = NULL;
+static char _hostname_[ 128 ];
+
 void dapl_internal_dbg_log ( DAPL_DBG_TYPE type, const char *fmt, ...)
 {
     va_list args;
 
+    if ( _ptr_host_ == NULL )
+    {
+	    gethostname(_hostname_, sizeof(_hostname_));
+         _ptr_host_ = _hostname_;
+    }
+
     if ( type & g_dapl_dbg_type )
     {
 	va_start (args, fmt);
 
 	if ( DAPL_DBG_DEST_STDOUT & g_dapl_dbg_dest )
 	{
+         fprintf(stdout, "%s:%d: ", _ptr_host_, getpid());
 	    dapl_os_vprintf (fmt, args);
 	}
 




More information about the ofw mailing list