aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xcutils
diff options
context:
space:
mode:
authorcl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk>2005-05-23 22:34:18 +0000
committercl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk>2005-05-23 22:34:18 +0000
commit35db9d71b6f65c80fce40a110d0e8a58af8437b5 (patch)
tree9f765d6fd0353c76c8f13cf4459471e671eea95a /tools/xcutils
parentdad197b071e41ba1a969fe10fc6fda20d5b46fef (diff)
downloadxen-35db9d71b6f65c80fce40a110d0e8a58af8437b5.tar.gz
xen-35db9d71b6f65c80fce40a110d0e8a58af8437b5.tar.bz2
xen-35db9d71b6f65c80fce40a110d0e8a58af8437b5.zip
bitkeeper revision 1.1513.1.1 (42925a6aSZSwfyaVsNzV4psPmpZwZg)
Execute xc_linux_restore in a seperate process so that it can't crash xend. Also handle errors passed from xc_linux_restore and log info messages from xc_linux_restore. XendDomain.py: Popen xc_restore instead of calling xc_linux_restore directly. xc.c: Add pyxc_handle exporting the file descriptor to the control interface. Remove xc_linux_restore -- replaced by popen of xc_restore directly from python. xc_linux_restore.c: Enable debug output. xpopen.py: Add xpopen functionality: Optionally exclude a list of file descriptors from being closed, allowing access to those file descriptors from the command. Remove unused parts. xpopen.py, Makefile, xc_restore.c: new file Makefile: Add xcutils subdir. ignore: Add tools/xcutils/xc_restore. Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
Diffstat (limited to 'tools/xcutils')
-rw-r--r--tools/xcutils/Makefile62
-rw-r--r--tools/xcutils/xc_restore.c30
2 files changed, 92 insertions, 0 deletions
diff --git a/tools/xcutils/Makefile b/tools/xcutils/Makefile
new file mode 100644
index 0000000000..dbdc45d496
--- /dev/null
+++ b/tools/xcutils/Makefile
@@ -0,0 +1,62 @@
+#
+# tools/xcutils/Makefile
+#
+# This file is subject to the terms and conditions of the GNU General
+# Public License. See the file "COPYING" in the main directory of
+# this archive for more details.
+#
+# Copyright (C) 2005 by Christian Limpach
+#
+
+INSTALL = install
+INSTALL_PROG = $(INSTALL) -m0755
+INSTALL_DIR = $(INSTALL) -d -m0755
+
+XEN_ROOT = ../..
+include $(XEN_ROOT)/tools/Rules.mk
+
+PROGRAMS_INSTALL_DIR = /usr/libexec/xen
+
+vpath %.h $(XEN_LIBXC)
+INCLUDES += -I $(XEN_LIBXC)
+
+CC := gcc
+
+CFLAGS += -Wall -Werror -O3 -fno-strict-aliasing
+CFLAGS += $(INCLUDES)
+
+# Make gcc generate dependencies.
+CFLAGS += -Wp,-MD,.$(@F).d
+PROG_DEP = .*.d
+
+PROGRAMS = xc_restore
+
+xc_restore_OBJS = xc_restore.o
+xc_restore_LIBS = xc
+
+.PHONY: all
+all: build
+build: $(PROGRAMS)
+
+define PROGRAM_template
+ $(1): $$($(1)_OBJS) $$($(1)_LIBS:%=-l%)
+ ALL_OBJS += $$($(1)_OBJS)
+endef
+
+$(foreach prog,$(PROGRAMS),$(eval $(call PROGRAM_template,$(prog))))
+
+$(PROGRAMS):
+ $(LINK.o) $^ $(LDLIBS) -o $@
+
+.PHONY: install
+install: build
+ [ -d $(DESTDIR)$(PROGRAMS_INSTALL_DIR) ] || \
+ $(INSTALL_DIR) $(DESTDIR)$(PROGRAMS_INSTALL_DIR)
+ $(INSTALL_PROG) $(PROGRAMS) $(DESTDIR)$(PROGRAMS_INSTALL_DIR)
+
+
+clean:
+ $(RM) $(ALL_OBJS) $(PROGRAMS)
+ $(RM) $(PROG_DEP)
+
+-include $(PROG_DEP)
diff --git a/tools/xcutils/xc_restore.c b/tools/xcutils/xc_restore.c
new file mode 100644
index 0000000000..ebba6d698f
--- /dev/null
+++ b/tools/xcutils/xc_restore.c
@@ -0,0 +1,30 @@
+/*
+ * This file is subject to the terms and conditions of the GNU General
+ * Public License. See the file "COPYING" in the main directory of
+ * this archive for more details.
+ *
+ * Copyright (C) 2005 by Christian Limpach
+ *
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <err.h>
+
+#include <xc.h>
+
+int
+main(int argc, char **argv)
+{
+ unsigned int xc_fd, io_fd, domid, nr_pfns;
+
+ if (argc != 5)
+ errx(1, "usage: %s xcfd iofd domid nr_pfns", argv[0]);
+
+ xc_fd = atoi(argv[1]);
+ io_fd = atoi(argv[2]);
+ domid = atoi(argv[3]);
+ nr_pfns = atoi(argv[4]);
+
+ return xc_linux_restore(xc_fd, io_fd, domid, nr_pfns);
+}