xen/libxc-logging.diff

112 lines
3.6 KiB
Diff

debug: log libxc output to /var/log/xen/libxc.log
sledge hammer patch ;)
---
tools/libxc/xc_dom_compat_linux.c | 2 ++
tools/libxc/xc_hvm_build.c | 2 ++
tools/libxc/xc_linux_build.c | 2 ++
tools/libxc/xc_private.c | 9 +++++++++
tools/libxc/xc_private.h | 11 +++++++----
5 files changed, 22 insertions(+), 4 deletions(-)
Index: build-64-release304-13087/tools/libxc/xc_hvm_build.c
===================================================================
--- build-64-release304-13087.orig/tools/libxc/xc_hvm_build.c
+++ build-64-release304-13087/tools/libxc/xc_hvm_build.c
@@ -310,6 +310,8 @@ static int xc_hvm_build_internal(int xc_
vcpu_guest_context_t ctxt;
int rc;
+ log_kraxel();
+
if ( (image == NULL) || (image_size == 0) )
{
ERROR("Image required");
Index: build-64-release304-13087/tools/libxc/xc_linux_build.c
===================================================================
--- build-64-release304-13087.orig/tools/libxc/xc_linux_build.c
+++ build-64-release304-13087/tools/libxc/xc_linux_build.c
@@ -1099,6 +1099,8 @@ static int xc_linux_build_internal(int x
unsigned long vstartinfo_start, vkern_entry, vstack_start;
uint32_t features_bitmap[XENFEAT_NR_SUBMAPS] = { 0, };
+ log_kraxel();
+
if ( features != NULL )
{
if ( !parse_features(features, features_bitmap, NULL) )
Index: build-64-release304-13087/tools/libxc/xc_private.c
===================================================================
--- build-64-release304-13087.orig/tools/libxc/xc_private.c
+++ build-64-release304-13087/tools/libxc/xc_private.c
@@ -88,6 +88,15 @@ void xc_set_error(int code, const char *
error_handler(&last_error);
}
+FILE *kraxel;
+
+void log_kraxel(void)
+{
+ kraxel = fopen("/var/log/xen/libxc.log", "a");
+ setvbuf(kraxel, NULL, _IONBF, 0);
+ fprintf(kraxel, "--- started ---\n");
+}
+
int lock_pages(void *addr, size_t len)
{
int e = 0;
Index: build-64-release304-13087/tools/libxc/xc_private.h
===================================================================
--- build-64-release304-13087.orig/tools/libxc/xc_private.h
+++ build-64-release304-13087/tools/libxc/xc_private.h
@@ -39,22 +39,25 @@
#define DEBUG 1
#define INFO 1
-#define PROGRESS 0
+#define PROGRESS 1
+
+extern FILE *kraxel;
+void log_kraxel(void);
#if INFO
-#define IPRINTF(_f, _a...) printf(_f , ## _a)
+#define IPRINTF(_f, _a...) fprintf(kraxel, _f , ## _a)
#else
#define IPRINTF(_f, _a...) ((void)0)
#endif
#if DEBUG
-#define DPRINTF(_f, _a...) fprintf(stderr, _f , ## _a)
+#define DPRINTF(_f, _a...) fprintf(kraxel, _f , ## _a)
#else
#define DPRINTF(_f, _a...) ((void)0)
#endif
#if PROGRESS
-#define PPRINTF(_f, _a...) fprintf(stderr, _f , ## _a)
+#define PPRINTF(_f, _a...) fprintf(kraxel, _f , ## _a)
#else
#define PPRINTF(_f, _a...)
#endif
Index: build-64-release304-13087/tools/libxc/xc_dom_compat_linux.c
===================================================================
--- build-64-release304-13087.orig/tools/libxc/xc_dom_compat_linux.c
+++ build-64-release304-13087/tools/libxc/xc_dom_compat_linux.c
@@ -74,6 +74,7 @@ int xc_linux_build_mem(int xc_handle, ui
int rc;
xc_dom_loginit();
+ log_kraxel();
dom = xc_dom_allocate(cmdline, features);
if (0 != (rc = xc_dom_kernel_mem(dom, image_buffer, image_size)))
goto out;
@@ -106,6 +107,7 @@ int xc_linux_build(int xc_handle, uint32
int rc;
xc_dom_loginit();
+ log_kraxel();
dom = xc_dom_allocate(cmdline, features);
if (0 != (rc = xc_dom_kernel_file(dom, image_name)))
goto out;