mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 12:54:27 +00:00
procstat auxv: widen COMM column to MAXCOMLEN
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. Reviewed by: markj Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D42202
This commit is contained in:
parent
248fe3d348
commit
8f9f7b4a42
|
@ -53,16 +53,16 @@ procstat_auxv(struct procstat *procstat, struct kinfo_proc *kipp)
|
|||
static char prefix[256];
|
||||
|
||||
if ((procstat_opts & PS_OPT_NOHEADER) == 0)
|
||||
xo_emit("{T:/%5s %-16s %-16s %-16s}\n", "PID", "COMM", "AUXV",
|
||||
xo_emit("{T:/%5s %-19s %-16s %-16s}\n", "PID", "COMM", "AUXV",
|
||||
"VALUE");
|
||||
|
||||
auxv = procstat_getauxv(procstat, kipp, &count);
|
||||
if (auxv == NULL)
|
||||
return;
|
||||
snprintf(prefix, sizeof(prefix), "%5d %-16s", kipp->ki_pid,
|
||||
snprintf(prefix, sizeof(prefix), "%5d %-19s", kipp->ki_pid,
|
||||
kipp->ki_comm);
|
||||
|
||||
xo_emit("{e:process_id/%5d/%d}{e:command/%-16s/%s}", kipp->ki_pid,
|
||||
xo_emit("{e:process_id/%5d/%d}{e:command/%-19s/%s}", kipp->ki_pid,
|
||||
kipp->ki_comm);
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
|
|
Loading…
Reference in a new issue