ia64/xen-unstable

view tools/xcutils/xc_save.c @ 7238:971e7c7411b3

Raise an exception if an error appears on the pipes to our children, and make
sure that the child's pipes are closed even under that exception. Move the
handling of POLLHUP to the end of the loop, so that we guarantee to read any
remaining data from the child if POLLHUP and POLLIN appear at the same time.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author emellor@ewan
date Thu Oct 06 10:13:11 2005 +0100 (2005-10-06)
parents 06d84bf87159
children a51fcb5de470
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 <xenguest.h>
17 int
18 main(int argc, char **argv)
19 {
20 unsigned int xc_fd, io_fd, domid, maxit, max_f, flags;
22 if (argc != 7)
23 errx(1, "usage: %s xcfd iofd domid maxit maxf flags", argv[0]);
25 xc_fd = atoi(argv[1]);
26 io_fd = atoi(argv[2]);
27 domid = atoi(argv[3]);
28 maxit = atoi(argv[4]);
29 max_f = atoi(argv[5]);
30 flags = atoi(argv[6]);
32 return xc_linux_save(xc_fd, io_fd, domid, maxit, max_f, flags);
33 }