WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 4/11] Add general trace() function to xenstore, for h

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 4/11] Add general trace() function to xenstore, for help in debugging in future.
From: Rusty Russell <rusty@xxxxxxxxxxxxxxx>
Date: Thu, 04 Aug 2005 22:31:28 +1000
Delivery-date: Thu, 04 Aug 2005 12:31:03 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Rusty Russell <rusty@xxxxxxxxxxxxxxx>
# Node ID d4ab9ac93104a13a09ebfaa2384281c4e3392e3f
# Parent  70ea61257cebc00212defe1dbed6de26c2edcf30
Add general trace() function to xenstore, for help in debugging in future.

Signed-off-by: Rusty Russell <rusty@xxxxxxxxxxxxxxx>

diff -r 70ea61257ceb -r d4ab9ac93104 tools/xenstore/xenstored_core.c
--- a/tools/xenstore/xenstored_core.c   Thu Aug  4 09:28:24 2005
+++ b/tools/xenstore/xenstored_core.c   Thu Aug  4 10:34:26 2005
@@ -111,6 +111,8 @@
        str = talloc_vasprintf(NULL, fmt, arglist);
        va_end(arglist);
 
+       trace("xenstored corruption: connection id %i: err %s: %s",
+               conn ? (int)conn->id : -1, strerror(saved_errno), str);
        eprintf("xenstored corruption: connection id %i: err %s: %s",
                conn ? (int)conn->id : -1, strerror(saved_errno), str);
 #ifdef TESTING
@@ -228,6 +230,21 @@
        write(tracefd, sockmsg_string(data->hdr.msg.type),
              strlen(sockmsg_string(data->hdr.msg.type)));
        write(tracefd, ")\n", 2);
+}
+
+void trace(const char *fmt, ...)
+{
+       va_list arglist;
+       char *str;
+
+       if (tracefd < 0)
+               return;
+
+       va_start(arglist, fmt);
+       str = talloc_vasprintf(NULL, fmt, arglist);
+       va_end(arglist);
+       write(tracefd, str, strlen(str));
+       talloc_free(str);
 }
 
 static bool write_message(struct connection *conn)
diff -r 70ea61257ceb -r d4ab9ac93104 tools/xenstore/xenstored_core.h
--- a/tools/xenstore/xenstored_core.h   Thu Aug  4 09:28:24 2005
+++ b/tools/xenstore/xenstored_core.h   Thu Aug  4 10:34:26 2005
@@ -147,5 +147,6 @@
 void trace_create(const void *data, const char *type);
 void trace_destroy(const void *data, const char *type);
 void trace_watch_timeout(const struct connection *conn, const char *node, 
const char *token);
+void trace(const char *fmt, ...);
 
 #endif /* _XENSTORED_CORE_H */


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH 4/11] Add general trace() function to xenstore, for help in debugging in future., Rusty Russell <=