diff options
author | Philip Guenthe <guenther@cvs.openbsd.org> | 2012-07-11 07:50:40 +0000 |
---|---|---|
committer | Philip Guenthe <guenther@cvs.openbsd.org> | 2012-07-11 07:50:40 +0000 |
commit | 035409520661e9017c0c796035dd5c4477607f54 (patch) | |
tree | d78a9d06e349ce5d767e6c7d3f62220426f72e6a | |
parent | 156a018a1068e24b3e4fe3c282d9f7c23218f83d (diff) |
Don't skip pipe, kqueue, crypto, or systrace files in pstat -f output
Also, cast to long to make printf formatting portable
with help from matthew; ok deraadt@
-rw-r--r-- | usr.sbin/pstat/pstat.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/usr.sbin/pstat/pstat.c b/usr.sbin/pstat/pstat.c index 6ad1c5fcc06..fadaa6f0156 100644 --- a/usr.sbin/pstat/pstat.c +++ b/usr.sbin/pstat/pstat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pstat.c,v 1.80 2012/07/09 22:41:45 deraadt Exp $ */ +/* $OpenBSD: pstat.c,v 1.81 2012/07/11 07:50:39 guenther Exp $ */ /* $NetBSD: pstat.c,v 1.27 1996/10/23 22:50:06 cgd Exp $ */ /*- @@ -983,7 +983,7 @@ filemode(void) { struct kinfo_file2 *kf; char flagbuf[16], *fbp; - static char *dtypes[] = { "???", "inode", "socket" }; + static char *dtypes[] = { "???", "inode", "socket", "pipe", "kqueue", "crypto", "systrace" }; int mib[2], maxfile, nfile; size_t len; @@ -1026,10 +1026,10 @@ filemode(void) (void)printf("%*s TYPE FLG CNT MSG %*s OFFSET\n", 2 * (int)sizeof(long), "LOC", 2 * (int)sizeof(long), "DATA"); for (; nfile-- > 0; kf++) { - if (kf->f_type > DTYPE_SOCKET) - continue; (void)printf("%0*llx ", 2 * (int)sizeof(long), kf->f_fileaddr); - (void)printf("%-8.8s", dtypes[kf->f_type]); + (void)printf("%-8.8s", dtypes[ + (kf->f_type >= (sizeof(dtypes)/sizeof(dtypes[0]))) + ? 0 : kf->f_type]); fbp = flagbuf; if (kf->f_flag & FREAD) *fbp++ = 'R'; @@ -1050,8 +1050,8 @@ filemode(void) *fbp++ = 'd'; *fbp = '\0'; - (void)printf("%6s %3ld", flagbuf, kf->f_count); - (void)printf(" %3ld", kf->f_msgcount); + (void)printf("%6s %3ld", flagbuf, (long)kf->f_count); + (void)printf(" %3ld", (long)kf->f_msgcount); (void)printf(" %0*lx", 2 * (int)sizeof(long), (long)kf->f_data); |