[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-4.2-testing] libxl: properly handle errors from page sharing hypercalls
# HG changeset patch # User Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx> # Date 1351791764 0 # Node ID 9d2ad9218dcc5a541ca09f47f60d7c3fec1039eb # Parent 4727c234198d51fdd248c3ba92560faa147b2ac6 libxl: properly handle errors from page sharing hypercalls 25886:051e2a30e3fb (25894:95a971c8058f in xen-unstable) is wrong because it assumes that xc_sharing_freed_pages etc. return -errnoval on error. However, like other libxc calls they return -1 setting errno. Correct this, checking for l<0 and then testing errno against ENOSYS, and also log the correct errno value. Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> --- diff -r 4727c234198d -r 9d2ad9218dcc tools/libxl/libxl.c --- a/tools/libxl/libxl.c Fri Oct 26 17:03:13 2012 +0100 +++ b/tools/libxl/libxl.c Thu Nov 01 17:42:44 2012 +0000 @@ -3653,21 +3653,25 @@ int libxl_get_physinfo(libxl_ctx *ctx, l physinfo->free_pages = xcphysinfo.free_pages; physinfo->scrub_pages = xcphysinfo.scrub_pages; l = xc_sharing_freed_pages(ctx->xch); - if (l == -ENOSYS) { - l = 0; - } else if (l < 0) { - LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, l, - "getting sharing freed pages"); - return ERROR_FAIL; + if (l < 0) { + if (errno == ENOSYS) { + l = 0; + } else { + LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, + "getting sharing freed pages"); + return ERROR_FAIL; + } } physinfo->sharing_freed_pages = l; l = xc_sharing_used_frames(ctx->xch); - if (l == -ENOSYS) { - l = 0; - } else if (l < 0) { - LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, l, - "getting sharing used frames"); - return ERROR_FAIL; + if (l < 0) { + if (errno == ENOSYS) { + l = 0; + } else { + LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, + "getting sharing used frames"); + return ERROR_FAIL; + } } physinfo->sharing_used_frames = l; physinfo->nr_nodes = xcphysinfo.nr_nodes; _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |