git: 78d3055bdb - main - Status/2025Q3/sockstat.adoc: Add report
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 16 Sep 2025 11:28:18 UTC
The branch main has been updated by salvadore: URL: https://cgit.FreeBSD.org/doc/commit/?id=78d3055bdb14102a9322a17348f36882052839f1 commit 78d3055bdb14102a9322a17348f36882052839f1 Author: Damin Rido <rido@freebsd.org> AuthorDate: 2025-08-22 16:24:20 +0000 Commit: Lorenzo Salvadore <salvadore@FreeBSD.org> CommitDate: 2025-09-16 11:27:45 +0000 Status/2025Q3/sockstat.adoc: Add report Co-authored-by: Alan Somers <asomers@gmail.com> Pull Request: https://github.com/freebsd/freebsd-doc/pull/540 --- .../en/status/report-2025-07-2025-09/sockstat.adoc | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/website/content/en/status/report-2025-07-2025-09/sockstat.adoc b/website/content/en/status/report-2025-07-2025-09/sockstat.adoc new file mode 100644 index 0000000000..88c583e14f --- /dev/null +++ b/website/content/en/status/report-2025-07-2025-09/sockstat.adoc @@ -0,0 +1,35 @@ +=== Sockstat UI Improvements + +Links: + +link:https://wiki.freebsd.org/SummerOfCode2025Projects/SockstatUIImprovements[Sockstat UI Improvements wiki] URL: https://wiki.freebsd.org/SummerOfCode2025Projects/SockstatUIImprovements[] + +link:https://github.com/freebsd/freebsd-src/pull/1720[Automatic column sizing PR] URL: https://github.com/freebsd/freebsd-src/pull/1720[] + +link:https://github.com/freebsd/freebsd-src/pull/1746[Reintroduced -w flag PR] URL: https://github.com/freebsd/freebsd-src/pull/1746[] + +link:https://github.com/freebsd/freebsd-src/pull/1753[Microoptimize cap-getnameinfo PR] URL: https://github.com/freebsd/freebsd-src/pull/1753[] + +link:https://github.com/freebsd/freebsd-src/pull/1770[Libxo support PR] URL: https://github.com/freebsd/freebsd-src/pull/1770[] + +link:https://github.com/freebsd/freebsd-src/pull/1799[Revert incorrect use of path-state for SCTP connections PR] URL: https://github.com/freebsd/freebsd-src/pull/1799[] + +link:https://github.com/freebsd/freebsd-src/pull/1806[Complete libxo integration PR] URL: https://github.com/freebsd/freebsd-src/pull/1806[] + +link:https://github.com/freebsd/freebsd-src/pull/1807[Fix port parsing after libxo integration PR] URL: https://github.com/freebsd/freebsd-src/pull/1807[] + + +Contact: Damin Rido <rido@FreeBSD.org> + +Sockstat is a command-line tool in FreeBSD that displays detailed information about open network sockets. +However, its traditional fixed-width formatting made the output hard to read, especially when handling long addresses. +This project improves sockstat by introducing dynamically sized columns and structured output support via libxo. +With these enhancements, users can more easily read output on the terminal or export the data in formats such as JSON, XML, or HTML for scripting and integration with external tools. + +The sockstat utility underwent improvements in two phases. +First, the fixed-width layout was replaced with dynamic column sizing using a two-pass algorithm to ensure proper alignment and readability, including cases with long socket addresses. +The `-w` option was redefined to enable wide, auto-sized output while maintaining compatibility with default terminal displays. +In the second phase, libxo support was integrated by replacing `printf()` calls with `xo_emit()`, applying appropriate field tagging, and validating the output using libxo's tools. +The manual pages were updated to document the libxo integration. +These changes provide machine-readable structured output while preserving traditional human-readable formatting. + +Following the sockstat conversion, the `parse_ports` function was identified as broken. +Due to its complexity, the function warranted the addition of unit tests to ensure correct behavior. +The issue was addressed by fixing the function and introducing a set of unit tests. +The codebase was refactored by renaming `sockstat.c` to `main.c` . + +This project was part of Google Summer of Code 2025. +It has modernized sockstat and made it both more user-friendly and better suited for integration into automated workflows. + +Sponsor: Google Summer of Code 2025 \ No newline at end of file