Index: src/domain_conf.c
===================================================================
RCS file: /data/cvs/libvirt/src/domain_conf.c,v
retrieving revision 1.17
diff -u -r1.17 domain_conf.c
--- src/domain_conf.c	8 Aug 2008 15:03:00 -0000	1.17
+++ src/domain_conf.c	12 Aug 2008 00:37:42 -0000
@@ -24,6 +24,7 @@
 #include <config.h>
 
 #include <sys/types.h>
+#include <sys/stat.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <dirent.h>
Index: src/domain_conf.h
===================================================================
RCS file: /data/cvs/libvirt/src/domain_conf.h,v
retrieving revision 1.6
diff -u -r1.6 domain_conf.h
--- src/domain_conf.h	8 Aug 2008 15:03:00 -0000	1.6
+++ src/domain_conf.h	12 Aug 2008 00:37:43 -0000
@@ -444,9 +444,9 @@
 typedef struct _virDomainObj virDomainObj;
 typedef virDomainObj *virDomainObjPtr;
 struct _virDomainObj {
-    int stdin;
-    int stdout;
-    int stderr;
+    int vmstdin;
+    int vmstdout;
+    int vmstderr;
     int monitor;
     int logfile;
     int pid;
Index: src/network_conf.c
===================================================================
RCS file: /data/cvs/libvirt/src/network_conf.c,v
retrieving revision 1.5
diff -u -r1.5 network_conf.c
--- src/network_conf.c	6 Aug 2008 12:08:49 -0000	1.5
+++ src/network_conf.c	12 Aug 2008 00:37:43 -0000
@@ -27,6 +27,7 @@
 
 #include <arpa/inet.h>
 #include <sys/types.h>
+#include <sys/stat.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <dirent.h>
Index: src/qemu_driver.c
===================================================================
RCS file: /data/cvs/libvirt/src/qemu_driver.c,v
retrieving revision 1.104
diff -u -r1.104 qemu_driver.c
--- src/qemu_driver.c	8 Aug 2008 15:43:38 -0000	1.104
+++ src/qemu_driver.c	12 Aug 2008 00:37:44 -0000
@@ -636,7 +636,7 @@
                                virDomainObjPtr vm) {
     char buf[1024]; /* Plenty of space to get startup greeting */
     int ret = qemudReadMonitorOutput(conn,
-                                     driver, vm, vm->stderr,
+                                     driver, vm, vm->vmstderr,
                                      buf, sizeof(buf),
                                      qemudFindCharDevicePTYs,
                                      "console");
@@ -950,7 +950,7 @@
                  errno, strerror(errno));
 
     ret = virExecNonBlock(conn, argv, &vm->pid,
-                          vm->stdin, &vm->stdout, &vm->stderr);
+                          vm->vmstdin, &vm->vmstdout, &vm->vmstderr);
     if (ret == 0) {
         vm->def->id = driver->nextvmid++;
         vm->state = migrateFrom ? VIR_DOMAIN_PAUSED : VIR_DOMAIN_RUNNING;
@@ -968,11 +968,11 @@
     }
 
     if (ret == 0) {
-        if ((virEventAddHandle(vm->stdout,
+        if ((virEventAddHandle(vm->vmstdout,
                                POLLIN | POLLERR | POLLHUP,
                                qemudDispatchVMEvent,
                                driver) < 0) ||
-            (virEventAddHandle(vm->stderr,
+            (virEventAddHandle(vm->vmstderr,
                                POLLIN | POLLERR | POLLHUP,
                                qemudDispatchVMEvent,
                                driver) < 0) ||
@@ -1025,22 +1025,22 @@
 
     kill(vm->pid, SIGTERM);
 
-    qemudVMData(driver, vm, vm->stdout);
-    qemudVMData(driver, vm, vm->stderr);
+    qemudVMData(driver, vm, vm->vmstdout);
+    qemudVMData(driver, vm, vm->vmstderr);
 
-    virEventRemoveHandle(vm->stdout);
-    virEventRemoveHandle(vm->stderr);
+    virEventRemoveHandle(vm->vmstdout);
+    virEventRemoveHandle(vm->vmstderr);
 
     if (close(vm->logfile) < 0)
         qemudLog(QEMUD_WARN, _("Unable to close logfile %d: %s\n"),
                  errno, strerror(errno));
-    close(vm->stdout);
-    close(vm->stderr);
+    close(vm->vmstdout);
+    close(vm->vmstderr);
     if (vm->monitor != -1)
         close(vm->monitor);
     vm->logfile = -1;
-    vm->stdout = -1;
-    vm->stderr = -1;
+    vm->vmstdout = -1;
+    vm->vmstderr = -1;
     vm->monitor = -1;
 
     if (waitpid(vm->pid, NULL, WNOHANG) != vm->pid) {
@@ -1613,8 +1613,8 @@
 
     while (vm) {
         if (virDomainIsActive(vm) &&
-            (vm->stdout == fd ||
-             vm->stderr == fd))
+            (vm->vmstdout == fd ||
+             vm->vmstderr == fd))
             break;
 
         vm = vm->next;
@@ -2754,10 +2754,10 @@
     }
 
     /* Set the migration source and start it up. */
-    vm->stdin = fd;
+    vm->vmstdin = fd;
     ret = qemudStartVMDaemon(conn, driver, vm, "stdio");
     close(fd);
-    vm->stdin = -1;
+    vm->vmstdin = -1;
     if (ret < 0) {
         qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
                          "%s", _("failed to start VM"));
Index: src/util.c
===================================================================
RCS file: /data/cvs/libvirt/src/util.c,v
retrieving revision 1.45
diff -u -r1.45 util.c
--- src/util.c	8 Aug 2008 15:43:38 -0000	1.45
+++ src/util.c	12 Aug 2008 00:37:44 -0000
@@ -262,7 +262,7 @@
 
 int
 virExec(virConnectPtr conn,
-        char **argv ATTRIBUTE_UNUSED,
+        const char *const*argv ATTRIBUTE_UNUSED,
         int *retpid ATTRIBUTE_UNUSED,
         int infd ATTRIBUTE_UNUSED,
         int *outfd ATTRIBUTE_UNUSED,
@@ -274,7 +274,7 @@
 
 int
 virExecNonBlock(virConnectPtr conn,
-                char **argv ATTRIBUTE_UNUSED,
+                const char *const*argv ATTRIBUTE_UNUSED,
                 int *retpid ATTRIBUTE_UNUSED,
                 int infd ATTRIBUTE_UNUSED,
                 int *outfd ATTRIBUTE_UNUSED,
Index: src/virsh.c
===================================================================
RCS file: /data/cvs/libvirt/src/virsh.c,v
retrieving revision 1.160
diff -u -r1.160 virsh.c
--- src/virsh.c	1 Aug 2008 14:30:41 -0000	1.160
+++ src/virsh.c	12 Aug 2008 00:37:46 -0000
@@ -80,6 +80,9 @@
 #define LVL_WARNING   "WARNING"
 #define LVL_ERROR     "ERROR"
 
+#ifndef WEXITSTATUS
+# define WEXITSTATUS(x) ((x) & 0xff)
+#endif
 /**
  * vshErrorLevel:
  *
Index: tests/testutilsxen.c
===================================================================
RCS file: /data/cvs/libvirt/tests/testutilsxen.c,v
retrieving revision 1.1
diff -u -r1.1 testutilsxen.c
--- tests/testutilsxen.c	25 Jul 2008 13:17:27 -0000	1.1
+++ tests/testutilsxen.c	12 Aug 2008 00:37:46 -0000
@@ -1,5 +1,6 @@
 #include <config.h>
 
+#ifdef WITH_XEN
 #include <sys/utsname.h>
 #include <stdlib.h>
 
@@ -51,3 +52,4 @@
     virCapabilitiesFree(caps);
     return NULL;
 }
+#endif
