vmstat: Add root element to libxo output

Current libxo output does not have a root element. Valid XML requires a single
root element. This commit adds this root element.

The libxo output version bumped accordingly.

PR:		254635
MFC after:	1 week
Pull Request: https://github.com/freebsd/freebsd-src/pull/1330
This commit is contained in:
Bram Ton 2024-07-17 09:23:30 +02:00 committed by Xin LI
parent b162fc3f30
commit c7dd97ec99

View File

@ -66,7 +66,7 @@
#include <libutil.h>
#include <libxo/xo.h>
#define VMSTAT_XO_VERSION "1"
#define VMSTAT_XO_VERSION "2"
static char da[] = "da";
@ -282,6 +282,7 @@ main(int argc, char *argv[])
argv += optind;
xo_set_version(VMSTAT_XO_VERSION);
xo_open_container("vmstat");
if (!hflag)
xo_set_options(NULL, "no-humanize");
if (todo == 0)
@ -383,6 +384,7 @@ nlist_ok:
dointr(interval, reps);
if (todo & VMSTAT)
dovmstat(interval, reps);
xo_close_container("vmstat");
xo_finish();
exit(0);
}