Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Oct 2025 06:08:53 GMT
From:      Colin Percival <cperciva@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: a9ffe497c864 - releng/15.0 - sockstat: improve output formatting
Message-ID:  <202510150608.59F68riK023260@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch releng/15.0 has been updated by cperciva:

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

commit a9ffe497c864775e4979a7190ad3feb7884aec66
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2025-10-09 19:10:53 +0000
Commit:     Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2025-10-15 06:08:09 +0000

    sockstat: improve output formatting
    
    Fix the format when the output for a socket spans multiple lines.
    
    Approved by:    re (cperciva)
    Reviewed by:            rrs
    Sponsored by:           Netflix, Inc.
    Differential Revision:  https://reviews.freebsd.org/D52984
    
    (cherry picked from commit 98b2a2265f5ee47bd932347699e6117df2f41488)
    (cherry picked from commit 7e567f51ff59d169b5fd0bc350d0c7dfc9fc2609)
---
 usr.bin/sockstat/main.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/usr.bin/sockstat/main.c b/usr.bin/sockstat/main.c
index a917672120d5..f0eb83eb3e9f 100644
--- a/usr.bin/sockstat/main.c
+++ b/usr.bin/sockstat/main.c
@@ -1545,18 +1545,30 @@ display_sock(struct sock *s, struct col_widths *cw, char *buf, size_t bufsize)
 				else if (!is_xo_style_encoding)
 					xo_emit(" {:cc/%-*s}", cw->cc, "??");
 			}
+		} else if (!is_xo_style_encoding) {
+			if (opt_s)
+				xo_emit(" {:conn-state/%-*s}", cw->conn_state,
+				    "??");
+			if (opt_b)
+				xo_emit(" {:bblog-state/%-*s}", cw->bblog_state,
+				    "??");
+			if (opt_S)
+				xo_emit(" {:stack/%-*s}", cw->stack, "??");
+			if (opt_C)
+				xo_emit(" {:cc/%-*s}", cw->cc, "??");
 		}
 		if (laddr != NULL)
 			laddr = laddr->next;
 		if (faddr != NULL)
 			faddr = faddr->next;
+		xo_emit("\n");
 		if (!is_xo_style_encoding && (laddr != NULL || faddr != NULL))
 			xo_emit("{:user/%-*s} {:command/%-*s} {:pid/%*s}"
-			    " {:fd/%*s}", cw->user, "??", cw->command, "??",
-			    cw->pid, "??", cw->fd, "??");
+			    " {:fd/%*s} {:proto/%-*s}", cw->user, "??",
+			    cw->command, "??", cw->pid, "??", cw->fd, "??",
+			    cw->proto, "??");
 		first = false;
 	}
-	xo_emit("\n");
 }
 
 static void



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