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

[Xen-devel] [PATCH 4/11] Add general trace() function to xenstore, for help in debugging in future.



# 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


 


Rackspace

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