git: 71b1f005a56e - stable/15 - sockstat: improve consistency

From: Michael Tuexen <tuexen_at_FreeBSD.org>
Date: Fri, 23 Oct 2026 17:15:14 UTC
The branch stable/15 has been updated by tuexen:

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

commit 71b1f005a56ea11bea1588f2b215f8714a36e71b
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2026-08-23 19:55:51 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2026-10-23 17:13:57 +0000

    sockstat: improve consistency
    
    Include the entries of the BBLOG STATE column in the computation
    of the column width as done also for other columns.
    Also set first to falso only when needed.
    
    Sponsored by:   Netflix, Inc.
    
    (cherry picked from commit 732c8d2a1a0e169bad1c02b1e54a4306861bde4a)
---
 usr.bin/sockstat/main.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/usr.bin/sockstat/main.c b/usr.bin/sockstat/main.c
index df09245a8f0d..0664e38b89ff 100644
--- a/usr.bin/sockstat/main.c
+++ b/usr.bin/sockstat/main.c
@@ -1318,12 +1318,16 @@ calculate_sock_column_widths(struct col_widths *cw, struct sock *s)
 				len = strlen(s->cc);
 				cw->cc = MAX(cw->cc, len);
 			}
+			if (opt_b && s->proto == &protos[TCP]) {
+				len = strlen(bblog_state(s->bblog_state));
+				cw->bblog_state = MAX(cw->bblog_state, len);
+			}
+			first = false;
 		}
 		if (laddr != NULL)
 			laddr = laddr->next;
 		if (faddr != NULL)
 			faddr = faddr->next;
-		first = false;
 	}
 }