diff options
| author | Michael Tuexen <tuexen@FreeBSD.org> | 2025-10-09 19:10:53 +0000 |
|---|---|---|
| committer | Michael Tuexen <tuexen@FreeBSD.org> | 2025-10-09 19:13:56 +0000 |
| commit | 98b2a2265f5ee47bd932347699e6117df2f41488 (patch) | |
| tree | 91ab7b394025f2d48d54eb673d57cb03bdf74234 | |
| parent | e9f7c3de111b9dda23e1763e030688d78a71d8ff (diff) | |
sockstat: improve output formatting
Fix the format when the output for a socket spans multiple lines.
Reviewed by: rrs
MFC after: 3 days
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D52984
| -rw-r--r-- | usr.bin/sockstat/main.c | 18 |
1 files 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 |
