From: Andre Przywara Subject: [PATCHv2 2/4] libxl: add sched_get_id function Date: Wed, 21 Apr 2010 16:17:24 +0200 Message-ID: <1271859446-25892-3-git-send-email-andre.przywara@amd.com> References: <1271859446-25892-1-git-send-email-andre.przywara@amd.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: In-Reply-To: <1271859446-25892-1-git-send-email-andre.przywara@amd.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Ian.Jackson@eu.citrix.com, vincent.hanquez@eu.citrix.com, Keir.Fraser@eu.citrix.com Cc: Andre Przywara , xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org To get the name of the currently used scheduler, Xen provides a sched_id sysctl. Add a libxl wrapper around the libxc function to query this. Signed-off-by: Andre Przywara --- tools/libxl/libxl.c | 13 +++++++++++++ tools/libxl/libxl.h | 2 ++ 2 files changed, 15 insertions(+), 0 deletions(-) diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index 1ef4325..3db4249 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -2421,3 +2421,16 @@ int libxl_set_vcpucount(struct libxl_ctx *ctx, uint32_t domid, uint32_t count) } return 0; } + +/* + * returns one of the XEN_SCHEDULER_* constants from public/domctl.h + * or -1 if an error occured. + */ +int libxl_get_sched_id(struct libxl_ctx *ctx) +{ + int sched, ret; + + if ((ret = xc_sched_id(ctx->xch, &sched)) != 0) + return ret; + return sched; +} diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h index 8b9d869..b079613 100644 --- a/tools/libxl/libxl.h +++ b/tools/libxl/libxl.h @@ -438,5 +438,7 @@ struct libxl_vcpuinfo *libxl_list_vcpu(struct libxl_ctx *ctx, uint32_t domid, int libxl_set_vcpuaffinity(struct libxl_ctx *ctx, uint32_t domid, uint32_t vcpuid, uint64_t *cpumap, int cpusize); int libxl_set_vcpucount(struct libxl_ctx *ctx, uint32_t domid, uint32_t count); + +int libxl_get_sched_id(struct libxl_ctx *ctx); #endif /* LIBXL_H */ -- 1.6.4