[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[win-pv-devel] [PATCH 2/2] Log messages to dom0 log (if possible)



IoctlLog will strip any trailing newline and insert a single
newline to enforce log file consistancy

Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>
---
 src/xenagent/service.cpp | 6 ++++++
 src/xeniface/ioctls.c    | 6 ++++++
 2 files changed, 12 insertions(+)

diff --git a/src/xenagent/service.cpp b/src/xenagent/service.cpp
index 55dc8ca..182752f 100644
--- a/src/xenagent/service.cpp
+++ b/src/xenagent/service.cpp
@@ -81,6 +81,12 @@ static CXenAgent s_service;
     va_end(args);
 
     OutputDebugString(message);
+
+    // if possible, send to xeniface to forward to logs
+    CCritSec crit(&s_service.m_crit);
+    if (s_service.m_device) {
+        s_service.m_device->Log(message);
+    }
 }
 
 /*static*/ int CXenAgent::ServiceInstall()
diff --git a/src/xeniface/ioctls.c b/src/xeniface/ioctls.c
index ca94658..f6a389f 100644
--- a/src/xeniface/ioctls.c
+++ b/src/xeniface/ioctls.c
@@ -113,6 +113,7 @@ IoctlLog(
     )
 {
     NTSTATUS    status;
+       PCHAR           ptr;
 
     status = STATUS_INVALID_BUFFER_SIZE;
     if (InLen == 0 || InLen > XENIFACE_LOG_MAX_LENGTH || OutLen != 0)
@@ -122,6 +123,11 @@ IoctlLog(
     if (!__IsValidStr(Buffer, InLen))
         goto fail2;
 
+       // remove newlines from end of buffer
+       for (ptr = Buffer + InLen - 1;
+                ptr != Buffer && *ptr != 0 && *ptr != '\n';
+                --ptr)
+                       *ptr = 0;
     XenIfaceDebugPrint(INFO, "USER: %s\n", Buffer);
     return STATUS_SUCCESS;
 
-- 
1.9.4.msysgit.1


_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.