aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xcutils/xc_save.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/xcutils/xc_save.c')
-rw-r--r--tools/xcutils/xc_save.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/tools/xcutils/xc_save.c b/tools/xcutils/xc_save.c
index eac8d1ad2b..44c4701379 100644
--- a/tools/xcutils/xc_save.c
+++ b/tools/xcutils/xc_save.c
@@ -10,10 +10,28 @@
#include <err.h>
#include <stdlib.h>
#include <stdint.h>
+#include <string.h>
#include <stdio.h>
#include <xenguest.h>
+
+/**
+ * Issue a suspend request through stdout, and receive the acknowledgement
+ * from stdin. This is handled by XendCheckpoint in the Python layer.
+ */
+static int suspend(int domid)
+{
+ char ans[30];
+
+ printf("suspend\n");
+ fflush(stdout);
+
+ return (fgets(ans, sizeof(ans), stdin) != NULL &&
+ !strncmp(ans, "done\n", 5));
+}
+
+
int
main(int argc, char **argv)
{
@@ -29,5 +47,5 @@ main(int argc, char **argv)
max_f = atoi(argv[5]);
flags = atoi(argv[6]);
- return xc_linux_save(xc_fd, io_fd, domid, maxit, max_f, flags);
+ return xc_linux_save(xc_fd, io_fd, domid, maxit, max_f, flags, &suspend);
}