[openib-general] [PATCH 11/13] osm: port to WinIB stack : opensm/osm_log.c

Eitan Zahavi eitan at mellanox.co.il
Sun Sep 17 09:00:12 PDT 2006


Hi Hal

1. function mappings for stat, fstat and fileno
2. Currently no imp for log file truncation 

Thanks

Eitan

Signed-off-by:  Eitan Zahavi <eitan at mellanox.co.il>

Index: opensm/osm_log.c
===================================================================
--- opensm/osm_log.c	(revision 9502)
+++ opensm/osm_log.c	(working copy)
@@ -60,6 +60,8 @@
 #include <sys/stat.h>
 #include <errno.h>
 
+static int log_exit_count = 0;
+
 #ifndef WIN32
 #include <sys/time.h>
 #include <unistd.h>
@@ -79,9 +81,6 @@ static char *month_str[] = {
   "Nov",
   "Dec"
 };
-#endif /* ndef WIN32 */
-
-static int log_exit_count = 0;
 
 static void truncate_log_file(osm_log_t* const p_log)
 {
@@ -95,6 +94,19 @@ static void truncate_log_file(osm_log_t*
 	p_log->count = 0;
 }
 
+#else /* Windows */
+
+#define fstat _fstat
+#define stat _stat
+#define fileno _fileno
+static void truncate_log_file(osm_log_t* const p_log)
+{
+	fprintf(stderr, "truncate_log_file: cannot truncate on windows system (yet)\n");
+}
+
+#endif /* ndef WIN32 */
+
+
 void
 osm_log(
   IN osm_log_t* const p_log,





More information about the general mailing list