git: 5297156047f2 - stable/14 - vmstat: Add root element to libxo output
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 10 Sep 2024 04:29:59 UTC
The branch stable/14 has been updated by delphij:
URL: https://cgit.FreeBSD.org/src/commit/?id=5297156047f29274c9b6e68a514e72a858059890
commit 5297156047f29274c9b6e68a514e72a858059890
Author: Bram Ton <bram@cbbg.nl>
AuthorDate: 2024-07-17 07:23:30 +0000
Commit: Xin LI <delphij@FreeBSD.org>
CommitDate: 2024-09-10 04:29:34 +0000
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
Pull Request: https://github.com/freebsd/freebsd-src/pull/1330
(cherry picked from commit c7dd97ec99687996de49ec0b1a23bf007e5199b9)
---
usr.bin/vmstat/vmstat.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/usr.bin/vmstat/vmstat.c b/usr.bin/vmstat/vmstat.c
index 48da1343a71c..c86c335087f5 100644
--- a/usr.bin/vmstat/vmstat.c
+++ b/usr.bin/vmstat/vmstat.c
@@ -79,7 +79,7 @@ static char sccsid[] = "@(#)vmstat.c 8.1 (Berkeley) 6/6/93";
#include <libutil.h>
#include <libxo/xo.h>
-#define VMSTAT_XO_VERSION "1"
+#define VMSTAT_XO_VERSION "2"
static char da[] = "da";
@@ -295,6 +295,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)
@@ -396,6 +397,7 @@ nlist_ok:
dointr(interval, reps);
if (todo & VMSTAT)
dovmstat(interval, reps);
+ xo_close_container("vmstat");
xo_finish();
exit(0);
}