direct-io.hg

view tools/xcutils/xc_restore.c @ 11133:bb37d167c82e

[XEND] xc_save/xc_restore open the libxc interface independently
of their parent. This is required now that the interface fd is
marked for close-on-exec.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Tue Aug 15 19:04:43 2006 +0100 (2006-08-15)
parents 06d84bf87159
children 1e590ddb1277
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 <stdio.h>
15 #include <xenctrl.h>
16 #include <xenguest.h>
18 int
19 main(int argc, char **argv)
20 {
21 unsigned int xc_fd, io_fd, domid, nr_pfns, store_evtchn, console_evtchn;
22 int ret;
23 unsigned long store_mfn, console_mfn;
25 if (argc != 6)
26 errx(1,
27 "usage: %s iofd domid nr_pfns store_evtchn console_evtchn",
28 argv[0]);
30 xc_fd = xc_interface_open();
31 if (xc_fd < 0)
32 errx(1, "failed to open control interface");
34 io_fd = atoi(argv[1]);
35 domid = atoi(argv[2]);
36 nr_pfns = atoi(argv[3]);
37 store_evtchn = atoi(argv[4]);
38 console_evtchn = atoi(argv[5]);
40 ret = xc_linux_restore(xc_fd, io_fd, domid, nr_pfns, store_evtchn,
41 &store_mfn, console_evtchn, &console_mfn);
42 if (ret == 0) {
43 printf("store-mfn %li\n", store_mfn);
44 printf("console-mfn %li\n", console_mfn);
45 fflush(stdout);
46 }
48 xc_interface_close(xc_fd);
50 return ret;
51 }