[openib-general] [PATCH 1/2] opensm: sigusr1: syslog() fixes

Sasha Khapyorsky sashak at voltaire.com
Sun Jan 7 18:42:11 PST 2007


Following Ira's log file reopening patch this fixes potential syslog
other apps compatibility issues.

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 osm/complib/cl_log.c         |    1 +
 osm/include/opensm/osm_log.h |    5 ++---
 osm/opensm/osm_log.c         |    2 +-
 osm/opensm/osm_subnet.c      |    1 +
 4 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/osm/complib/cl_log.c b/osm/complib/cl_log.c
index 87cda06..dd3a4c6 100644
--- a/osm/complib/cl_log.c
+++ b/osm/complib/cl_log.c
@@ -124,4 +124,5 @@ cl_log_event(
 	{
 		syslog( priority, "%s\n", message );
 	}
+	closelog();
 }
diff --git a/osm/include/opensm/osm_log.h b/osm/include/opensm/osm_log.h
index a119d4f..7197439 100644
--- a/osm/include/opensm/osm_log.h
+++ b/osm/include/opensm/osm_log.h
@@ -51,7 +51,6 @@
 #ifndef __WIN__
 #include <syslog.h>
 #endif
-#include <complib/cl_log.h>
 #include <complib/cl_spinlock.h>
 #include <opensm/osm_base.h>
 #include <iba/ib_types.h>
@@ -128,8 +127,8 @@ typedef struct _osm_log
 	unsigned long                   max_size;
 	boolean_t			flush;
 	FILE*				out_port;
-  	boolean_t                       accum_log_file;
-        char *                          log_file_name;
+	boolean_t			accum_log_file;
+	char *				log_file_name;
 } osm_log_t;
 /*********/
 
diff --git a/osm/opensm/osm_log.c b/osm/opensm/osm_log.c
index 0c6de36..56c6482 100644
--- a/osm/opensm/osm_log.c
+++ b/osm/opensm/osm_log.c
@@ -164,7 +164,7 @@ osm_log(
     /* this is a call to the syslog */
     if (verbosity & OSM_LOG_SYS)
     {
-      cl_log_event("OpenSM", LOG_INFO, buffer , NULL, 0);
+      syslog(LOG_INFO, "%s\n", buffer);
 
       /* SYSLOG should go to stdout too */
       if (p_log->out_port != stdout)
diff --git a/osm/opensm/osm_subnet.c b/osm/opensm/osm_subnet.c
index aec4ff2..90802b4 100644
--- a/osm/opensm/osm_subnet.c
+++ b/osm/opensm/osm_subnet.c
@@ -52,6 +52,7 @@
 #include <string.h>
 #include <stdio.h>
 #include <complib/cl_debug.h>
+#include <complib/cl_log.h>
 #include <opensm/osm_subnet.h>
 #include <opensm/osm_opensm.h>
 #include <opensm/osm_log.h>
-- 
1.5.0.rc0.g2484-dirty





More information about the general mailing list