From nobody Thu Oct 9 20:25:53 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4cjLxC6MDSz6C4qK for ; Thu, 09 Oct 2025 20:26:07 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-ed1-f43.google.com (mail-ed1-f43.google.com [209.85.208.43]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cjLxB50Jgz3XGs for ; Thu, 09 Oct 2025 20:26:06 +0000 (UTC) (envelope-from asomers@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-ed1-f43.google.com with SMTP id 4fb4d7f45d1cf-62f24b7be4fso2531297a12.0 for ; Thu, 09 Oct 2025 13:26:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760041565; x=1760646365; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=H64XBxdiKRY2qgDNdxcWGTn8JWxCXAhAtOZBEhqHn/A=; b=ChzIplLdNsohJUsLvuBZsw5YLlcdVkdVU1AHF9u7ynIPpJRMX02g+9VXSFle+ddpWt ldrwKGNFBRfcqWP55dxh5N6xojmW3ufvlZb1u7/q5JoYngfHNTpwj8bvA1ZZ56xa0DCm T87bu5+8YW1NNZYedJNkiyn5xdbOgO7Oca924iTDX32Ii0Ex07WCrwlsk2XYAbTCg8bR qsNUZhdWTi9QYWEZ++m6TtGZmJzCCrfmBHeedR/sco8Qty2lCXkDIBHKHr7aI0st6fs8 2JP+NFNl7jH9OIsYOTzBZ8szevZufTBWK0d+Yn0v9Tsu8qwTiVCedy7hy3HpBYdN3kZV feRA== X-Forwarded-Encrypted: i=1; AJvYcCU8ZkOCJ4dXf1/y2uuqxWMvv0LCcxBSpsh0CPd394RY0FY6v9PE5ZoXuENJuKiJHXJczJuLyrVgWWmw+4bGkMojhBCs@freebsd.org X-Gm-Message-State: AOJu0YwGRR9VEhA0chwZnEc7ByzLLCQVuRUBfvycqSojMyXCRmLPnJLJ dGW4IxmeA5wniZ0RtK4v8rSc6vwHY5rRx1TPoKFs1wL0mqtltySrkEfhRcopsNIUFgeB8jSRw6z 6WCsZ3ZVQFEfj7BJICrFFbd+QYi+4cXXJKihPPWk= X-Gm-Gg: ASbGncvNUBL10VcQxu4PHoTD/bDNSI1NwJMyBC8A60E1lGHP5Ab2bBNzTdPhX1zPBJC fbLtNDoOdkhj1EITd5ZHVvvNCNxm3y0y24ym4jF/kY622EWcgwgElBccci4xMgNCrsMNsZXKIP5 wpNYz4C5YpCvbEdoz5hYHJzC/8vM0DoA6iL/RuTgPiPFLUN+abeHqEFuDm6GfFmrii3/y84nQPW QihJfnrHYPjUCGEpKRa93SCz/AS8lfOssNkUG+4SEw= X-Google-Smtp-Source: AGHT+IHUJYYnMks5RYAPbnMV1nu+hQqfOcqKLgschiWpXBFcHk0bw7d3SBCBSLAWtUsWctI5HG209gNdK85Gy03HVfU= X-Received: by 2002:a05:6402:84d:b0:632:67ba:f9b3 with SMTP id 4fb4d7f45d1cf-639d5b6ae4dmr7669028a12.11.1760041565094; Thu, 09 Oct 2025 13:26:05 -0700 (PDT) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 References: <202510091919.599JJ5dd028526@gitrepo.freebsd.org> <995AAC96-FFE6-4D25-90C5-1BE9B6BF3729@FreeBSD.org> In-Reply-To: <995AAC96-FFE6-4D25-90C5-1BE9B6BF3729@FreeBSD.org> From: Alan Somers Date: Thu, 9 Oct 2025 14:25:53 -0600 X-Gm-Features: AS18NWCr89WIa8rxqry9GvADkDDV4MQ8xJN4B_Y6f1kiWkFLdcBJP79Pc9Fqkf4 Message-ID: Subject: Re: git: 746eadecaa7d - main - sockstat: show path state column only when useful To: Michael Tuexen Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: multipart/alternative; boundary="00000000000047068c0640bf9c22" X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Rspamd-Queue-Id: 4cjLxB50Jgz3XGs --00000000000047068c0640bf9c22 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Oct 9, 2025 at 2:22=E2=80=AFPM Michael Tuexen = wrote: > > On 9. Oct 2025, at 22:01, Alan Somers wrote: > > > > It looks like this change will cause sockstat to skip output path state > even in JSON output mode. Is that deliberate? I would think that it wou= ld > be better for machine-readable formats if the output were predictable. > I haven't used it in that setup. So you would prefer to only drop the > column > when generating plain text? > Yes > > Also, the English in the man page is awkward. I think you mean "at > least one path to show". > Would "at least one path state to show" be acceptable? > Yes, that would be good. > Best regards > Michael > > > > On Thu, Oct 9, 2025 at 1:19=E2=80=AFPM Michael Tuexen > wrote: > > The branch main has been updated by tuexen: > > > > URL: > https://cgit.FreeBSD.org/src/commit/?id=3D746eadecaa7dc8913721cbaa9be4e60= 3bd36ea49 > > > > commit 746eadecaa7dc8913721cbaa9be4e603bd36ea49 > > Author: Michael Tuexen > > AuthorDate: 2025-10-09 19:16:38 +0000 > > Commit: Michael Tuexen > > CommitDate: 2025-10-09 19:16:38 +0000 > > > > sockstat: show path state column only when useful > > > > Showing the path state column is only useful, if there is at least > one > > SCTP endpoint shown, which is not in the state CLOSED or LISTEN. > > Don't show it when it is not useful. > > > > Reviewed by: rrs > > MFC after: 3 days > > Sponsored by: Netflix, Inc. > > Differential Revision: https://reviews.freebsd.org/D52986 > > --- > > usr.bin/sockstat/main.c | 8 ++++++-- > > usr.bin/sockstat/sockstat.1 | 3 ++- > > 2 files changed, 8 insertions(+), 3 deletions(-) > > > > diff --git a/usr.bin/sockstat/main.c b/usr.bin/sockstat/main.c > > index f0eb83eb3e9f..7fedfd5b8724 100644 > > --- a/usr.bin/sockstat/main.c > > +++ b/usr.bin/sockstat/main.c > > @@ -103,6 +103,7 @@ static bool opt_u; /* Show Unix domain > sockets */ > > static u_int opt_v; /* Verbose mode */ > > static bool opt_w; /* Automatically size the columns */ > > static bool is_xo_style_encoding; > > +static bool show_path_state =3D false; > > > > /* > > * Default protocols to use if no -P was defined. > > @@ -584,6 +585,7 @@ gather_sctp(void) > > !(local_all_loopback || > > foreign_all_loopback))) { > > RB_INSERT(socks_t, &socks, sock= ); > > + show_path_state =3D true; > > } else { > > free_socket(sock); > > } > > @@ -1485,7 +1487,7 @@ display_sock(struct sock *s, struct col_widths > *cw, char *buf, size_t bufsize) > > } else if (!is_xo_style_encoding) > > xo_emit(" {:encaps/%*s}", cw->encaps, > "??"); > > } > > - if (opt_s) { > > + if (opt_s && show_path_state) { > > if (faddr !=3D NULL && > > s->proto =3D=3D IPPROTO_SCTP && > > s->state !=3D SCTP_CLOSED && > > @@ -1632,7 +1634,9 @@ display(void) > > if (opt_U) > > xo_emit(" {T:/%*s}", cw.encaps, "ENCAPS"); > > if (opt_s) { > > - xo_emit(" {T:/%-*s}", cw.path_state, "PATH > STATE"); > > + if (show_path_state) > > + xo_emit(" {T:/%-*s}", cw.path_state, > > + "PATH STATE"); > > xo_emit(" {T:/%-*s}", cw.conn_state, "CONN > STATE"); > > } > > if (opt_b) > > diff --git a/usr.bin/sockstat/sockstat.1 b/usr.bin/sockstat/sockstat.1 > > index dabb3042bfd4..d14eb967ad0f 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 7, 2025 > > +.Dd October 9, 2025 > > .Dt SOCKSTAT 1 > > .Os > > .Sh NAME > > @@ -205,6 +205,7 @@ 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. > > .It Li CONN STATE > > The connection state if > > .Fl s > > --00000000000047068c0640bf9c22 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Thu, Oct 9, 2025 at 2:22=E2=80=AFPM Michae= l Tuexen <tuexen@freebsd.org&g= t; wrote:
> O= n 9. Oct 2025, at 22:01, Alan Somers <asomers@FreeBSD.org> wrote:
>
> It looks like this change will cause sockstat to skip output path stat= e even in JSON output mode.=C2=A0 Is that deliberate?=C2=A0 I would think t= hat it would be better for machine-readable formats if the output were pred= ictable.
I haven't used it in that setup. So you would prefer to only drop the c= olumn
when generating plain text?

Yes
=C2=A0
> Also, the English in the man page is awkward.=C2=A0 I think you mean &= quot;at least one path to show".
Would "at least one path state to show" be acceptable?

Yes, that would be good.
=C2=A0
Best regards
Michael
>
> On Thu, Oct 9, 2025 at 1:19=E2=80=AFPM Michael Tuexen <tuexen@freebsd.org> wrot= e:
> The branch main has been updated by tuexen:
>
> URL: https://= cgit.FreeBSD.org/src/commit/?id=3D746eadecaa7dc8913721cbaa9be4e603bd36ea49<= /a>
>
> commit 746eadecaa7dc8913721cbaa9be4e603bd36ea49
> Author:=C2=A0 =C2=A0 =C2=A0Michael Tuexen <tuexen@FreeBSD.org> > AuthorDate: 2025-10-09 19:16:38 +0000
> Commit:=C2=A0 =C2=A0 =C2=A0Michael Tuexen <tuexen@FreeBSD.org> > CommitDate: 2025-10-09 19:16:38 +0000
>
>=C2=A0 =C2=A0 =C2=A0sockstat: show path state column only when useful >
>=C2=A0 =C2=A0 =C2=A0Showing the path state column is only useful, if th= ere is at least one
>=C2=A0 =C2=A0 =C2=A0SCTP endpoint shown, which is not in the state CLOS= ED or LISTEN.
>=C2=A0 =C2=A0 =C2=A0Don't show it when it is not useful.
>
>=C2=A0 =C2=A0 =C2=A0Reviewed by:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 rrs
>=C2=A0 =C2=A0 =C2=A0MFC after:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 3 days
>=C2=A0 =C2=A0 =C2=A0Sponsored by:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0Netflix, Inc.
>=C2=A0 =C2=A0 =C2=A0Differential Revision:=C2=A0
https://revie= ws.freebsd.org/D52986
> ---
>=C2=A0 usr.bin/sockstat/main.c=C2=A0 =C2=A0 =C2=A0| 8 ++++++--
>=C2=A0 usr.bin/sockstat/sockstat.1 | 3 ++-
>=C2=A0 2 files changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/usr.bin/sockstat/main.c b/usr.bin/sockstat/main.c
> index f0eb83eb3e9f..7fedfd5b8724 100644
> --- a/usr.bin/sockstat/main.c
> +++ b/usr.bin/sockstat/main.c
> @@ -103,6 +103,7 @@ static bool=C2=A0 opt_u;=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0/* Show Unix domain sockets */
>=C2=A0 static u_int=C2=A0 =C2=A0 opt_v;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0/* Verbose mode */
>=C2=A0 static bool=C2=A0 =C2=A0 =C2=A0opt_w;=C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0/* Automatically size the columns */
>=C2=A0 static bool=C2=A0 =C2=A0 =C2=A0is_xo_style_encoding;
> +static bool=C2=A0 =C2=A0 =C2=A0show_path_state =3D false;
>
>=C2=A0 /*
>=C2=A0 =C2=A0* Default protocols to use if no -P was defined.
> @@ -584,6 +585,7 @@ gather_sctp(void)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 !(local_all_= loopback ||
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 foreign_all_= loopback))) {
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0RB_INSERT(socks_t, &socks, sock);
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0show_= path_state =3D true;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0} else {
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0free_socket(sock);
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}
> @@ -1485,7 +1487,7 @@ display_sock(struct sock *s, struct col_widths *= cw, char *buf, size_t bufsize)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0} else if (!is_xo_style_encoding)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0xo_emit(" {:encaps/%*s= }", cw->encaps, "??");
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (opt_s) { > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (opt_s &= ;& show_path_state) {
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0if (faddr !=3D NULL &&
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0s->proto =3D=3D IPPROTO_SCTP &&= ;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0s->state !=3D SCTP_CLOSED && > @@ -1632,7 +1634,9 @@ display(void)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (opt_U= )
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0xo_emit(" {T:/%*s}", cw.encaps, "ENCAPS&= quot;);
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (opt_s= ) {
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0xo_emit(" {T:/%-*s}", cw.path_state, "PATH STA= TE");
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0if (show_path_state)
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0xo_emit(" {T:/%-*s}", c= w.path_state,
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"PATH STATE&qu= ot;);
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0xo_emit(" {T:/%-*s}", cw.conn_state, "CO= NN STATE");
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (opt_b= )
> diff --git a/usr.bin/sockstat/sockstat.1 b/usr.bin/sockstat/sockstat.1=
> index dabb3042bfd4..d14eb967ad0f 100644
> --- a/usr.bin/sockstat/sockstat.1
> +++ b/usr.bin/sockstat/sockstat.1
> @@ -25,7 +25,7 @@
>=C2=A0 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY = OUT OF THE USE OF
>=C2=A0 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SU= CH DAMAGE.
>=C2=A0 .\"
> -.Dd October 7, 2025
> +.Dd October 9, 2025
>=C2=A0 .Dt SOCKSTAT 1
>=C2=A0 .Os
>=C2=A0 .Sh NAME
> @@ -205,6 +205,7 @@ is specified (only for SCTP or TCP).
>=C2=A0 The path state if
>=C2=A0 .Fl s
>=C2=A0 is specified (only for SCTP).
> +This column is only shown when there is at least one path state shown= .
>=C2=A0 .It Li CONN STATE
>=C2=A0 The connection state if
>=C2=A0 .Fl s

--00000000000047068c0640bf9c22--