@@ -5215,6 +5215,7 @@ const libxl_version_info* libxl_get_version_info(libxl_ctx *ctx)
GC_INIT(ctx);
char *buf;
xen_version_op_val_t val = 0;
+ int r;
libxl_version_info *info = &ctx->version_info;
if (info->xen_version_extra != NULL)
@@ -5256,8 +5257,22 @@ const libxl_version_info* libxl_get_version_info(libxl_ctx *ctx)
goto out;
info->virt_start = val;
- (void)xc_version_wrapper(ctx, XEN_VERSION_OP_commandline, buf,
- info->pagesize, &info->commandline);
+ if (xc_version_wrapper(ctx, XEN_VERSION_OP_commandline, buf,
+ info->pagesize, &info->commandline) < 0)
+ goto out;
+
+ r = xc_version(ctx->xch, XEN_VERSION_OP_build_id, buf, info->pagesize);
+ if (r < 0)
+ info->build_id = libxl__strdup(NOGC, "");
+ else if (r > 0)
+ {
+ unsigned int i;
+
+ info->build_id = libxl__zalloc(NOGC, (r * 2) + 1);
+
+ for (i = 0; i < r; i++)
+ snprintf(&info->build_id[i * 2], 3, "%02hhx", buf[i]);
+ }
out:
GC_FREE;
return info;
@@ -218,6 +218,11 @@
#define LIBXL_HAVE_SOFT_RESET 1
/*
+ * LIBXL_HAVE_BUILD_ID means that libxl_version_info has the extra
+ * field for the hypervisor build_id.
+ */
+#define LIBXL_HAVE_BUILD_ID 1
+/*
* libxl ABI compatibility
*
* The only guarantee which libxl makes regarding ABI compatibility
@@ -362,6 +362,7 @@ libxl_version_info = Struct("version_info", [
("virt_start", uint64),
("pagesize", integer),
("commandline", string),
+ ("build_id", string),
], dir=DIR_OUT)
libxl_domain_create_info = Struct("domain_create_info",[
@@ -5566,6 +5566,7 @@ static void output_xeninfo(void)
printf("cc_compile_by : %s\n", info->compile_by);
printf("cc_compile_domain : %s\n", info->compile_domain);
printf("cc_compile_date : %s\n", info->compile_date);
+ printf("build_id : %s\n", info->build_id);
return;
}
If the hypervisor is built with we will display it. Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> --- Cc: Ian Jackson <ian.jackson@eu.citrix.com> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Cc: Wei Liu <wei.liu2@citrix.com> v2: Include HAVE_*, use libxl_zalloc, s/rc/ret/ v3: Retry with different size if 1020 is not enough. v4: Use VERSION_OP subops instead of the XENVER_ subops --- tools/libxl/libxl.c | 19 +++++++++++++++++-- tools/libxl/libxl.h | 5 +++++ tools/libxl/libxl_types.idl | 1 + tools/libxl/xl_cmdimpl.c | 1 + 4 files changed, 24 insertions(+), 2 deletions(-)