git: 5c4f64bded0e - main - netstat: Add version information to libxo output
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 06 Sep 2024 18:35:17 UTC
The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=5c4f64bded0eb9453dc84bcce9a74f64adf57739 commit 5c4f64bded0eb9453dc84bcce9a74f64adf57739 Author: Bram <bram@cbbg.nl> AuthorDate: 2024-08-27 06:17:33 +0000 Commit: Warner Losh <imp@FreeBSD.org> CommitDate: 2024-09-06 18:34:31 +0000 netstat: Add version information to libxo output Add version information to libxo output so that libxo content consumers can track changes. Reviewed by: imp, markj Pull Request: https://github.com/freebsd/freebsd-src/pull/1350 --- usr.bin/netstat/main.c | 7 +++++++ usr.bin/netstat/netstat.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/usr.bin/netstat/main.c b/usr.bin/netstat/main.c index 2ed6eca4626e..6d19851b61fc 100644 --- a/usr.bin/netstat/main.c +++ b/usr.bin/netstat/main.c @@ -510,6 +510,7 @@ main(int argc, char *argv[]) #endif if (iflag && !sflag) { xo_open_container("statistics"); + xo_set_version(NETSTAT_XO_VERSION); intpr(NULL, af); xo_close_container("statistics"); xo_finish(); @@ -517,6 +518,7 @@ main(int argc, char *argv[]) } if (rflag) { xo_open_container("statistics"); + xo_set_version(NETSTAT_XO_VERSION); if (sflag) { if (live) { kresolve_list(nl); @@ -530,6 +532,7 @@ main(int argc, char *argv[]) } if (oflag) { xo_open_container("statistics"); + xo_set_version(NETSTAT_XO_VERSION); nhops_print(fib, af); xo_close_container("statistics"); xo_finish(); @@ -537,6 +540,7 @@ main(int argc, char *argv[]) } if (Oflag) { xo_open_container("statistics"); + xo_set_version(NETSTAT_XO_VERSION); nhgrp_print(fib, af); xo_close_container("statistics"); xo_finish(); @@ -547,6 +551,7 @@ main(int argc, char *argv[]) if (gflag) { xo_open_container("statistics"); + xo_set_version(NETSTAT_XO_VERSION); if (sflag) { if (af == AF_INET || af == AF_UNSPEC) mrt_stats(); @@ -569,6 +574,7 @@ main(int argc, char *argv[]) if (tp) { xo_open_container("statistics"); + xo_set_version(NETSTAT_XO_VERSION); printproto(tp, tp->pr_name, &first); if (!first) xo_close_list("socket"); @@ -578,6 +584,7 @@ main(int argc, char *argv[]) } xo_open_container("statistics"); + xo_set_version(NETSTAT_XO_VERSION); if (af == AF_INET || af == AF_UNSPEC) for (tp = protox; tp->pr_name; tp++) printproto(tp, tp->pr_name, &first); diff --git a/usr.bin/netstat/netstat.h b/usr.bin/netstat/netstat.h index c41862d9fbdd..7ebfc5180f44 100644 --- a/usr.bin/netstat/netstat.h +++ b/usr.bin/netstat/netstat.h @@ -31,6 +31,8 @@ #include <sys/cdefs.h> +#define NETSTAT_XO_VERSION "1" + #define satosin(sa) ((struct sockaddr_in *)(sa)) #define satosin6(sa) ((struct sockaddr_in6 *)(sa)) #define sin6tosa(sin6) ((struct sockaddr *)(sin6))