diff options
author | rwatson <rwatson@FreeBSD.org> | 2007-12-10 20:55:43 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2007-12-10 20:55:43 +0000 |
commit | 8bc41fcc02ff4a03b29c2a776d0866b0030bcdc2 (patch) | |
tree | d45a0b2693d7dfd7613ff915d2c1cc46c6ca0e8d /usr.bin/procstat/procstat_files.c | |
parent | 95c502771082069b023dca6ea4367751107e3d52 (diff) | |
download | FreeBSD-src-8bc41fcc02ff4a03b29c2a776d0866b0030bcdc2.zip FreeBSD-src-8bc41fcc02ff4a03b29c2a776d0866b0030bcdc2.tar.gz |
Add 'COMM' column to a few more output modes of procstat(1). The only
one it's missing from is the VM display, where there's really not room,
and the file output display is looking quite cramped.
Diffstat (limited to 'usr.bin/procstat/procstat_files.c')
-rw-r--r-- | usr.bin/procstat/procstat_files.c | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/usr.bin/procstat/procstat_files.c b/usr.bin/procstat/procstat_files.c index e36fc01..9fcb1fd 100644 --- a/usr.bin/procstat/procstat_files.c +++ b/usr.bin/procstat/procstat_files.c @@ -57,26 +57,28 @@ protocol_to_string(int domain, int type, int protocol) case IPPROTO_UDP: return ("UDP"); case IPPROTO_ICMP: - return ("ICMP"); + return ("ICM"); case IPPROTO_RAW: return ("RAW"); case IPPROTO_SCTP: - return ("SCTP"); + return ("SCT"); + case IPPROTO_DIVERT: + return ("IPD"); default: - return ("??"); + return ("IP?"); } case AF_LOCAL: switch (type) { case SOCK_STREAM: - return ("UDSS"); + return ("UDS"); case SOCK_DGRAM: - return ("UDSD"); + return ("UDD"); default: - return ("??"); + return ("UD?"); } default: - return ("??"); + return ("?"); } } @@ -125,7 +127,7 @@ print_address(struct sockaddr_storage *ss) char addr[PATH_MAX]; addr_to_string(ss, addr, sizeof(addr)); - printf("%-19s", addr); + printf("%s", addr); } void @@ -137,9 +139,9 @@ procstat_files(pid_t pid, struct kinfo_proc *kipp) size_t len; if (!hflag) - printf("%5s %3s %1s %1s %-8s %3s %7s %-4s %-35s\n", "PID", - "FD", "T", "V", "FLAGS", "REF", "OFFSET", "PROT", - "NAME"); + printf("%5s %-16s %3s %1s %1s %-8s %3s %7s %-3s %-12s\n", + "PID", "COMM", "FD", "T", "V", "FLAGS", "REF", "OFFSET", + "PRO", "NAME"); name[0] = CTL_KERN; name[1] = KERN_PROC; @@ -168,6 +170,7 @@ procstat_files(pid_t pid, struct kinfo_proc *kipp) if (kif->kf_structsize != sizeof(*kif)) errx(-1, "kinfo_file mismatch"); printf("%5d ", pid); + printf("%-16s ", kipp->ki_comm); printf("%3d ", kif->kf_fd); switch (kif->kf_type) { case KF_TYPE_VNODE: @@ -262,12 +265,12 @@ procstat_files(pid_t pid, struct kinfo_proc *kipp) switch (kif->kf_type) { case KF_TYPE_VNODE: case KF_TYPE_FIFO: - printf("%-4s ", "-"); - printf("%-35s", kif->kf_path); + printf("%-3s ", "-"); + printf("%-18s", kif->kf_path); break; case KF_TYPE_SOCKET: - printf("%-4s ", + printf("%-3s ", protocol_to_string(kif->kf_sock_domain, kif->kf_sock_type, kif->kf_sock_protocol)); /* @@ -293,8 +296,8 @@ procstat_files(pid_t pid, struct kinfo_proc *kipp) break; default: - printf("%-4s ", "-"); - printf("%-35s", "-"); + printf("%-3s ", "-"); + printf("%-18s", "-"); } printf("\n"); |