Page MenuHomeFreeBSD

procstat auxv: widen COMM column to MAXCOMLEN
ClosedPublic

Authored by brooks on Oct 13 2023, 6:46 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Sep 19, 4:49 AM
Unknown Object (File)
Wed, Sep 18, 5:35 AM
Unknown Object (File)
Wed, Sep 18, 3:13 AM
Unknown Object (File)
Sun, Sep 15, 6:28 PM
Unknown Object (File)
Mon, Sep 9, 1:39 PM
Unknown Object (File)
Sun, Sep 8, 12:39 PM
Unknown Object (File)
Sun, Sep 8, 5:10 AM
Unknown Object (File)
Thu, Sep 5, 6:47 PM
Subscribers

Details

Summary

For reasons unknown, procstat subcommands typically display the command
in a 16+overflow column format. However, the command may be up to
MAXCOMLEN (19) characters long causing the column to spill into the next
one. Since there's plenty of room in the auxv case, bump the column
width up to 19 to avoid this issue. While this is a format change 1)
users who want to parse the data should use libxo output and 2) this
makes it possible to parse reliably with cut.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

markj added inline comments.
usr.bin/procstat/procstat_auxv.c
56

Hmm, can you write "%-*s" and pass MAXCOMLEN as a parameter? It's just a suggestion, I'm not sure it's worth the effort.

This revision is now accepted and ready to land.Oct 13 2023, 6:58 PM
usr.bin/procstat/procstat_auxv.c
56

My conclusion was "no" or at least not usefully because of the e:command/%-19s/%s below where one case would consume it and another not. Maybe I could stringify the macro value, but that doesn't seem super readable :(

This revision was automatically updated to reflect the committed changes.