Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Oct 2025 20:43:28 GMT
From:      Michael Tuexen <tuexen@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 97e858f5b335 - main - sockstat: improve handling of path state
Message-ID:  <202510142043.59EKhSoe065154@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by tuexen:

URL: https://cgit.FreeBSD.org/src/commit/?id=97e858f5b335ae8f98619f9cee8ab9a0501cd06d

commit 97e858f5b335ae8f98619f9cee8ab9a0501cd06d
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2025-10-14 06:39:37 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2025-10-14 06:48:43 +0000

    sockstat: improve handling of path state
    
    Only suppress the path state column when producing traditional text
    output. When generating html output, always include the column.
    Please note that when generating json or xml output, optional fields
    like the path state are only generated if they is applicable. This
    has not been changed.
    The changes in this patch were suggested by asomers.
    
    Reviewed by:            asomers
    Fixes:                  746eadecaa7d ("sockstat: show path state column only when useful")
    MFC after:              3 days
    Sponsored by:           Netflix, Inc.
    Differential Revision:  https://reviews.freebsd.org/D53005
---
 usr.bin/sockstat/main.c     | 8 +++++---
 usr.bin/sockstat/sockstat.1 | 5 +++--
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/usr.bin/sockstat/main.c b/usr.bin/sockstat/main.c
index 7fedfd5b8724..d1ea6b1bc958 100644
--- a/usr.bin/sockstat/main.c
+++ b/usr.bin/sockstat/main.c
@@ -1789,9 +1789,11 @@ main(int argc, char *argv[])
 	argc = xo_parse_args(argc, argv);
 	if (argc < 0)
 		exit(1);
-	if (xo_get_style(NULL) != XO_STYLE_TEXT &&
-		xo_get_style(NULL) != XO_STYLE_HTML)
-		is_xo_style_encoding = true;
+	if (xo_get_style(NULL) != XO_STYLE_TEXT) {
+		show_path_state = true;
+		if (xo_get_style(NULL) != XO_STYLE_HTML)
+			is_xo_style_encoding = true;
+	}
 	opt_j = -1;
 	while ((o = getopt(argc, argv, "46AbCcfIij:Llnp:P:qSsUuvw")) != -1)
 		switch (o) {
diff --git a/usr.bin/sockstat/sockstat.1 b/usr.bin/sockstat/sockstat.1
index d14eb967ad0f..1498fb1d88f7 100644
--- a/usr.bin/sockstat/sockstat.1
+++ b/usr.bin/sockstat/sockstat.1
@@ -25,7 +25,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd October 9, 2025
+.Dd October 14, 2025
 .Dt SOCKSTAT 1
 .Os
 .Sh NAME
@@ -205,7 +205,8 @@ is specified (only for SCTP or TCP).
 The path state if
 .Fl s
 is specified (only for SCTP).
-This column is only shown when there is at least one path state shown.
+When using traditional text output, this column is only shown when there is at
+least one path state to show.
 .It Li CONN STATE
 The connection state if
 .Fl s



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202510142043.59EKhSoe065154>