ia64/xen-unstable

view tools/libxc/xc_bvtsched.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 1ac7603a60bd
children b3a255e88810
line source
1 /******************************************************************************
2 * xc_bvtsched.c
3 *
4 * API for manipulating parameters of the Borrowed Virtual Time scheduler.
5 *
6 * Copyright (c) 2003, K A Fraser.
7 */
9 #include "xc_private.h"
11 int xc_bvtsched_global_set(int xc_handle,
12 unsigned long ctx_allow)
13 {
14 dom0_op_t op;
16 op.cmd = DOM0_SCHEDCTL;
17 op.u.schedctl.sched_id = SCHED_BVT;
18 op.u.schedctl.direction = SCHED_INFO_PUT;
19 op.u.schedctl.u.bvt.ctx_allow = ctx_allow;
21 return do_dom0_op(xc_handle, &op);
22 }
24 int xc_bvtsched_global_get(int xc_handle,
25 unsigned long *ctx_allow)
26 {
27 dom0_op_t op;
28 int ret;
30 op.cmd = DOM0_SCHEDCTL;
31 op.u.schedctl.sched_id = SCHED_BVT;
32 op.u.schedctl.direction = SCHED_INFO_GET;
34 ret = do_dom0_op(xc_handle, &op);
36 *ctx_allow = op.u.schedctl.u.bvt.ctx_allow;
38 return ret;
39 }
41 int xc_bvtsched_domain_set(int xc_handle,
42 u32 domid,
43 u32 mcuadv,
44 int warpback,
45 s32 warpvalue,
46 long long warpl,
47 long long warpu)
48 {
49 dom0_op_t op;
50 struct bvt_adjdom *bvtadj = &op.u.adjustdom.u.bvt;
52 op.cmd = DOM0_ADJUSTDOM;
53 op.u.adjustdom.domain = (domid_t)domid;
54 op.u.adjustdom.sched_id = SCHED_BVT;
55 op.u.adjustdom.direction = SCHED_INFO_PUT;
57 bvtadj->mcu_adv = mcuadv;
58 bvtadj->warpback = warpback;
59 bvtadj->warpvalue = warpvalue;
60 bvtadj->warpl = warpl;
61 bvtadj->warpu = warpu;
62 return do_dom0_op(xc_handle, &op);
63 }
66 int xc_bvtsched_domain_get(int xc_handle,
67 u32 domid,
68 u32 *mcuadv,
69 int *warpback,
70 s32 *warpvalue,
71 long long *warpl,
72 long long *warpu)
73 {
75 dom0_op_t op;
76 int ret;
77 struct bvt_adjdom *adjptr = &op.u.adjustdom.u.bvt;
79 op.cmd = DOM0_ADJUSTDOM;
80 op.u.adjustdom.domain = (domid_t)domid;
81 op.u.adjustdom.sched_id = SCHED_BVT;
82 op.u.adjustdom.direction = SCHED_INFO_GET;
84 ret = do_dom0_op(xc_handle, &op);
86 *mcuadv = adjptr->mcu_adv;
87 *warpback = adjptr->warpback;
88 *warpvalue = adjptr->warpvalue;
89 *warpl = adjptr->warpl;
90 *warpu = adjptr->warpu;
91 return ret;
92 }