Skip to content

Commit

Permalink
Properly space/align "-" if no c18n information; handle P_SYSTM.
Browse files Browse the repository at this point in the history
  • Loading branch information
rwatson committed Apr 9, 2024
1 parent b32e6c1 commit 8b2f98b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion usr.bin/procstat/procstat_cheri.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ procstat_cheri(struct procstat *procstat, struct kinfo_proc *kipp)
xo_emit(" {:revoker_epoch/%34s/%s}", abi_cheri == 'P' ?
get_revoker_epoch(procstat, kipp) : "-");
}
xo_emit(" {:compartments/%s/%s}", get_c18n(procstat, kipp));
xo_emit(" {:compartments/%5s/%s}", get_c18n(procstat, kipp));
xo_emit("\n");
}

Expand Down Expand Up @@ -193,6 +193,8 @@ get_c18n(struct procstat *procstat, struct kinfo_proc *kipp)
if (errno != ESRCH && errno != EPERM && errno != ENOEXEC)
warn("procstat_get_c18n");
snprintf(c18n_buf, sizeof(c18n_buf), "-");
} else if (len < sizeof(*rcsp)) {
snprintf(c18n_buf, sizeof(c18n_buf), "-");
} else {
snprintf(c18n_buf, sizeof(c18n_buf), "%5lu",
rcsp->rcs_compartments);
Expand Down

0 comments on commit 8b2f98b

Please sign in to comment.