ia64/xen-unstable

view tools/xcutils/xc_save.c @ 8740:3d7ea7972b39

Update patches for linux 2.6.15.

Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
author cl349@firebug.cl.cam.ac.uk
date Thu Feb 02 17:16:00 2006 +0000 (2006-02-02)
parents a51fcb5de470
children bb37d167c82e
line source
1 /*
2 * This file is subject to the terms and conditions of the GNU General
3 * Public License. See the file "COPYING" in the main directory of
4 * this archive for more details.
5 *
6 * Copyright (C) 2005 by Christian Limpach
7 *
8 */
10 #include <err.h>
11 #include <stdlib.h>
12 #include <stdint.h>
13 #include <string.h>
14 #include <stdio.h>
16 #include <xenguest.h>
19 /**
20 * Issue a suspend request through stdout, and receive the acknowledgement
21 * from stdin. This is handled by XendCheckpoint in the Python layer.
22 */
23 static int suspend(int domid)
24 {
25 char ans[30];
27 printf("suspend\n");
28 fflush(stdout);
30 return (fgets(ans, sizeof(ans), stdin) != NULL &&
31 !strncmp(ans, "done\n", 5));
32 }
35 int
36 main(int argc, char **argv)
37 {
38 unsigned int xc_fd, io_fd, domid, maxit, max_f, flags;
40 if (argc != 7)
41 errx(1, "usage: %s xcfd iofd domid maxit maxf flags", argv[0]);
43 xc_fd = atoi(argv[1]);
44 io_fd = atoi(argv[2]);
45 domid = atoi(argv[3]);
46 maxit = atoi(argv[4]);
47 max_f = atoi(argv[5]);
48 flags = atoi(argv[6]);
50 return xc_linux_save(xc_fd, io_fd, domid, maxit, max_f, flags, &suspend);
51 }