CVS commit: src/usr.sbin/pstat
Module Name:src Committed By: mrg Date: Mon Apr 12 05:11:10 UTC 2021 Modified Files: src/usr.sbin/pstat: pstat.c Log Message: fix a buffer size (off by one), and fix all the comments for the 3 other correctly sized buffers with the same comment/context. To generate a diff of this commit: cvs rdiff -u -r1.131 -r1.132 src/usr.sbin/pstat/pstat.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/pstat/pstat.c diff -u src/usr.sbin/pstat/pstat.c:1.131 src/usr.sbin/pstat/pstat.c:1.132 --- src/usr.sbin/pstat/pstat.c:1.131 Sat Oct 3 14:01:16 2020 +++ src/usr.sbin/pstat/pstat.c Mon Apr 12 05:11:09 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pstat.c,v 1.131 2020/10/03 14:01:16 christos Exp $ */ +/* $NetBSD: pstat.c,v 1.132 2021/04/12 05:11:09 mrg Exp $ */ /*- * Copyright (c) 1980, 1991, 1993, 1994 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19 #if 0 static char sccsid[] = "@(#)pstat.c 8.16 (Berkeley) 5/9/95"; #else -__RCSID("$NetBSD: pstat.c,v 1.131 2020/10/03 14:01:16 christos Exp $"); +__RCSID("$NetBSD: pstat.c,v 1.132 2021/04/12 05:11:09 mrg Exp $"); #endif #endif /* not lint */ @@ -481,7 +481,7 @@ ufs_print(struct vnode *vp, int ovflw) } dip; struct ufsmount ump; char flags[sizeof(ufs_flags) / sizeof(ufs_flags[0])]; - char dev[4 + 1 + 7 + 1]; /* 12bit marjor + 20bit minor */ + char dev[4 + 1 + 7 + 1]; /* 12bit major + 20bit minor */ char *name; mode_t type; dev_t rdev; @@ -526,7 +526,7 @@ ext2fs_print(struct vnode *vp, int ovflw struct inode inode, *ip = struct ext2fs_dinode dip; char flags[sizeof(ufs_flags) / sizeof(ufs_flags[0])]; - char dev[4 + 1 + 7 + 1]; /* 12bit marjor + 20bit minor */ + char dev[4 + 1 + 7 + 1]; /* 12bit major + 20bit minor */ char *name; mode_t type; @@ -577,7 +577,7 @@ nfs_print(struct vnode *vp, int ovflw) { struct nfsnode nfsnode, *np = char flags[sizeof(nfs_flags) / sizeof(nfs_flags[0])]; - char dev[4 + 1 + 7 + 1]; /* 12bit marjor + 20bit minor */ + char dev[4 + 1 + 7 + 1]; /* 12bit major + 20bit minor */ struct vattr va; char *name; mode_t type; @@ -835,7 +835,7 @@ void ttyprt(struct tty *tp) { char state[sizeof(ttystates) / sizeof(ttystates[0]) + 1]; - char dev[2 + 3 + 1 + 5 + 1]; /* 12bit major + 20bit minor */ + char dev[4 + 1 + 7 + 1]; /* 12bit major + 20bit minor */ struct linesw t_linesw; const char *name; char buffer;
CVS commit: src/usr.sbin/pstat
Module Name:src Committed By: christos Date: Sat Oct 3 14:01:16 UTC 2020 Modified Files: src/usr.sbin/pstat: pstat.c Log Message: Filter out the VUSECOUNT_GATE bit To generate a diff of this commit: cvs rdiff -u -r1.130 -r1.131 src/usr.sbin/pstat/pstat.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/pstat/pstat.c diff -u src/usr.sbin/pstat/pstat.c:1.130 src/usr.sbin/pstat/pstat.c:1.131 --- src/usr.sbin/pstat/pstat.c:1.130 Wed Dec 11 14:51:36 2019 +++ src/usr.sbin/pstat/pstat.c Sat Oct 3 10:01:16 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: pstat.c,v 1.130 2019/12/11 19:51:36 ad Exp $ */ +/* $NetBSD: pstat.c,v 1.131 2020/10/03 14:01:16 christos Exp $ */ /*- * Copyright (c) 1980, 1991, 1993, 1994 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19 #if 0 static char sccsid[] = "@(#)pstat.c 8.16 (Berkeley) 5/9/95"; #else -__RCSID("$NetBSD: pstat.c,v 1.130 2019/12/11 19:51:36 ad Exp $"); +__RCSID("$NetBSD: pstat.c,v 1.131 2020/10/03 14:01:16 christos Exp $"); #endif #endif /* not lint */ @@ -444,8 +444,9 @@ vnode_print(struct vnode *avnode, struct PRWORD(ovflw, "%*lx", PTRSTRWIDTH, 0, (long)avnode); PRWORD(ovflw, " %*s", 4, 1, type); PRWORD(ovflw, " %*s", 6, 1, flags); - PRWORD(ovflw, " %*ld", 5, 1, (long)vp->v_usecount); - PRWORD(ovflw, " %*ld", 5, 1, (long)vp->v_holdcnt); +#define VUSECOUNT_MASK 0x7fff /* XXX: kernel private */ + PRWORD(ovflw, " %*d", 5, 1, vp->v_usecount & VUSECOUNT_MASK); + PRWORD(ovflw, " %*d", 5, 1, vp->v_holdcnt); PRWORD(ovflw, " %*d", 4, 1, vp->v_tag); PRWORD(ovflw, " %*d", 6, 1, vp->v_uobj.uo_npages); return (ovflw);
CVS commit: src/usr.sbin/pstat
Module Name:src Committed By: wiz Date: Thu Dec 12 05:00:33 UTC 2019 Modified Files: src/usr.sbin/pstat: pstat.8 Log Message: Comment out xref to tb(4), it does not exist. XXX: I don't see it mentioned in amd64/GENERIC nor DEVNAMES To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 src/usr.sbin/pstat/pstat.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/pstat/pstat.8 diff -u src/usr.sbin/pstat/pstat.8:1.43 src/usr.sbin/pstat/pstat.8:1.44 --- src/usr.sbin/pstat/pstat.8:1.43 Wed Dec 11 19:51:36 2019 +++ src/usr.sbin/pstat/pstat.8 Thu Dec 12 05:00:33 2019 @@ -1,4 +1,4 @@ -.\" $NetBSD: pstat.8,v 1.43 2019/12/11 19:51:36 ad Exp $ +.\" $NetBSD: pstat.8,v 1.44 2019/12/12 05:00:33 wiz Exp $ .\" .\" Copyright (c) 1980, 1991, 1993, 1994 .\" The Regents of the University of California. All rights reserved. @@ -209,8 +209,9 @@ for TTYDISC (see .Xr termios 4 ) , .Ql tab -for TABLDISC (see -.Xr tb 4 ) , +for TABLDISC , +.\" (see +.\".Xr tb 4 ) , .Ql slip for SLIPDISC (see .Xr sl 4 ) , @@ -277,7 +278,6 @@ VI_ONWORKLST vnode is on syncer work-lis .It M VV_MPSAFE file system is multithreaded .El -.Pp .It USE The number of references to this vnode. .It HOLD
CVS commit: src/usr.sbin/pstat
Module Name:src Committed By: ad Date: Wed Dec 11 19:51:36 UTC 2019 Modified Files: src/usr.sbin/pstat: pstat.8 pstat.c Log Message: Report on whether vnodes are MPSAFE. For diagnosing perf problems. To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 src/usr.sbin/pstat/pstat.8 cvs rdiff -u -r1.129 -r1.130 src/usr.sbin/pstat/pstat.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/pstat/pstat.8 diff -u src/usr.sbin/pstat/pstat.8:1.42 src/usr.sbin/pstat/pstat.8:1.43 --- src/usr.sbin/pstat/pstat.8:1.42 Mon Jul 3 21:35:31 2017 +++ src/usr.sbin/pstat/pstat.8 Wed Dec 11 19:51:36 2019 @@ -1,4 +1,4 @@ -.\" $NetBSD: pstat.8,v 1.42 2017/07/03 21:35:31 wiz Exp $ +.\" $NetBSD: pstat.8,v 1.43 2019/12/11 19:51:36 ad Exp $ .\" .\" Copyright (c) 1980, 1991, 1993, 1994 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" from: @(#)pstat.8 8.5 (Berkeley) 5/13/94 .\" -.Dd March 24, 2014 +.Dd December 11, 2019 .Dt PSTAT 8 .Os .Sh NAME @@ -261,19 +261,21 @@ A list of letters representing vnode fla .Pp .Bl -tag -width indent -compact .It R -VROOT root of its file system. +VV_ROOT root of its file system. .It T -VTEXT pure text prototype. +VI_TEXT pure text prototype. .It S -VSYSTEM vnode being used by kernel. +VV_SYSTEM vnode being used by kernel. .It I -VISTTY vnode is a tty. +VV_ISTTY vnode is a tty. .It E -VEXECMAP vnode has PROT_EXEC mappings. +VI_EXECMAP vnode has PROT_EXEC mappings. .It D -VDIROP lfs vnode involved in directory op. +VU_DIROP lfs vnode involved in directory op. .It O -VONWORKLST vnode is on syncer work-list. +VI_ONWORKLST vnode is on syncer work-list. +.It M +VV_MPSAFE file system is multithreaded .El .Pp .It USE Index: src/usr.sbin/pstat/pstat.c diff -u src/usr.sbin/pstat/pstat.c:1.129 src/usr.sbin/pstat/pstat.c:1.130 --- src/usr.sbin/pstat/pstat.c:1.129 Sun Dec 1 14:04:52 2019 +++ src/usr.sbin/pstat/pstat.c Wed Dec 11 19:51:36 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: pstat.c,v 1.129 2019/12/01 14:04:52 ad Exp $ */ +/* $NetBSD: pstat.c,v 1.130 2019/12/11 19:51:36 ad Exp $ */ /*- * Copyright (c) 1980, 1991, 1993, 1994 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19 #if 0 static char sccsid[] = "@(#)pstat.c 8.16 (Berkeley) 5/9/95"; #else -__RCSID("$NetBSD: pstat.c,v 1.129 2019/12/01 14:04:52 ad Exp $"); +__RCSID("$NetBSD: pstat.c,v 1.130 2019/12/11 19:51:36 ad Exp $"); #endif #endif /* not lint */ @@ -390,6 +390,7 @@ const struct flagbit_desc vnode_flags[] { VI_EXECMAP, 'E' }, { VU_DIROP, 'D' }, { VI_ONWORKLST, 'O' }, + { VV_MPSAFE,'M' }, { 0, '\0' }, };
CVS commit: src/usr.sbin/pstat
Module Name:src Committed By: ad Date: Sun Dec 1 14:04:52 UTC 2019 Modified Files: src/usr.sbin/pstat: pstat.c Log Message: Update to match change in layout of vnode LRU lists. To generate a diff of this commit: cvs rdiff -u -r1.128 -r1.129 src/usr.sbin/pstat/pstat.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/pstat/pstat.c diff -u src/usr.sbin/pstat/pstat.c:1.128 src/usr.sbin/pstat/pstat.c:1.129 --- src/usr.sbin/pstat/pstat.c:1.128 Thu May 4 16:26:09 2017 +++ src/usr.sbin/pstat/pstat.c Sun Dec 1 14:04:52 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: pstat.c,v 1.128 2017/05/04 16:26:09 sevan Exp $ */ +/* $NetBSD: pstat.c,v 1.129 2019/12/01 14:04:52 ad Exp $ */ /*- * Copyright (c) 1980, 1991, 1993, 1994 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19 #if 0 static char sccsid[] = "@(#)pstat.c 8.16 (Berkeley) 5/9/95"; #else -__RCSID("$NetBSD: pstat.c,v 1.128 2017/05/04 16:26:09 sevan Exp $"); +__RCSID("$NetBSD: pstat.c,v 1.129 2019/12/01 14:04:52 ad Exp $"); #endif #endif /* not lint */ @@ -85,23 +85,19 @@ __RCSID("$NetBSD: pstat.c,v 1.128 2017/0 #include "swapctl.h" struct nlist nl[] = { -#define V_LRU_FREE_LIST 0 - { "_lru_free_list", 0, 0, 0, 0 }, /* address of lru free list. */ -#define V_LRU_HOLD_LIST 1 - { "_lru_hold_list", 0, 0, 0, 0 }, /* address of lru hold list. */ -#define V_LRU_VRELE_LIST 2 - { "_lru_vrele_list", 0, 0, 0, 0 }, /* address of lru vrele list. */ -#define V_NUMV 3 +#define V_LRU_LIST 0 + { "_lru_list", 0, 0, 0, 0 } , /* address of lru lists. */ +#define V_NUMV 1 { "_numvnodes", 0, 0, 0, 0 }, -#define V_NEXT_OFFSET 4 +#define V_NEXT_OFFSET 2 { "_vnode_offset_next_by_lru", 0, 0, 0, 0 }, -#define FNL_NFILE 5 +#define FNL_NFILE 3 { "_nfiles", 0, 0, 0, 0 }, -#define FNL_MAXFILE 6 +#define FNL_MAXFILE 4 { "_maxfiles", 0, 0, 0, 0 }, -#define TTY_NTTY 7 +#define TTY_NTTY 5 { "_tty_count", 0, 0, 0, 0 }, -#define TTY_TTYLIST 8 +#define TTY_TTYLIST 6 { "_ttylist", 0, 0, 0, 0 }, #define NLMANDATORY TTY_TTYLIST /* names up to here are mandatory */ { "", 0, 0, 0, 0 } @@ -770,11 +766,12 @@ kinfo_vnodes(int *avnodes) ep = bp + (numvnodes + 20) * (VPTRSZ + VNODESZ); KGET(V_NEXT_OFFSET, next_offset); - for (i = V_LRU_FREE_LIST; i <= V_LRU_VRELE_LIST; i++) { + for (i = 0; i < 3; i++) { TAILQ_HEAD(vnodelst, vnode) lru_head; struct vnode *vp, vnode; - KGET(i, lru_head); + KGET2((nl[V_LRU_LIST].n_value + sizeof(lru_head) * i), _head, + sizeof(lru_head), "lru_list"); vp = TAILQ_FIRST(_head); while (vp != NULL) { KGET2(vp, , sizeof(vnode), "vnode");
CVS commit: src/usr.sbin/pstat
Module Name:src Committed By: dholland Date: Mon May 26 20:07:25 UTC 2014 Modified Files: src/usr.sbin/pstat: pstat.c Log Message: Don't check lfs flags on ffs vnodes. To generate a diff of this commit: cvs rdiff -u -r1.123 -r1.124 src/usr.sbin/pstat/pstat.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/pstat/pstat.c diff -u src/usr.sbin/pstat/pstat.c:1.123 src/usr.sbin/pstat/pstat.c:1.124 --- src/usr.sbin/pstat/pstat.c:1.123 Mon Mar 24 13:42:41 2014 +++ src/usr.sbin/pstat/pstat.c Mon May 26 20:07:25 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: pstat.c,v 1.123 2014/03/24 13:42:41 hannken Exp $ */ +/* $NetBSD: pstat.c,v 1.124 2014/05/26 20:07:25 dholland Exp $ */ /*- * Copyright (c) 1980, 1991, 1993, 1994 @@ -39,7 +39,7 @@ __COPYRIGHT(@(#) Copyright (c) 1980, 19 #if 0 static char sccsid[] = @(#)pstat.c 8.16 (Berkeley) 5/9/95; #else -__RCSID($NetBSD: pstat.c,v 1.123 2014/03/24 13:42:41 hannken Exp $); +__RCSID($NetBSD: pstat.c,v 1.124 2014/05/26 20:07:25 dholland Exp $); #endif #endif /* not lint */ @@ -330,6 +330,9 @@ vnodemode(void) maddr = vp-v_mount; mount_print(mp); vnode_header(); + /* + * XXX do this in a more fs-independent way + */ if (FSTYPE_IS(mp, MOUNT_FFS) || FSTYPE_IS(mp, MOUNT_MFS)) { ufs_header(); @@ -455,8 +458,6 @@ const struct flagbit_desc ufs_flags[] = { IN_ACCESSED, 'a' }, { IN_SHLOCK, 'S' }, { IN_EXLOCK, 'E' }, - { IN_CLEANING, 'c' }, - { IN_ADIROP, 'D' }, { IN_SPACECOUNTED, 's' }, { 0, '\0' }, };
CVS commit: src/usr.sbin/pstat
Module Name:src Committed By: dsl Date: Wed Jan 2 10:43:11 UTC 2013 Modified Files: src/usr.sbin/pstat: Makefile Log Message: pstat is a kmem groveller, set -D_KMEMUSER in CPPFLAGS To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/usr.sbin/pstat/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/pstat/Makefile diff -u src/usr.sbin/pstat/Makefile:1.15 src/usr.sbin/pstat/Makefile:1.16 --- src/usr.sbin/pstat/Makefile:1.15 Mon May 28 12:06:39 2007 +++ src/usr.sbin/pstat/Makefile Wed Jan 2 10:43:11 2013 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.15 2007/05/28 12:06:39 tls Exp $ +# $NetBSD: Makefile,v 1.16 2013/01/02 10:43:11 dsl Exp $ # from: @(#)Makefile 8.1 (Berkeley) 6/6/93 .include bsd.own.mk @@ -15,6 +15,8 @@ LDADD= -lkvm CPPFLAGS+=-I${NETBSDSRCDIR}/sbin/swapctl +CPPFLAGS+=-D_KMEMUSER + .PATH: ${NETBSDSRCDIR}/sbin/swapctl .include bsd.prog.mk
CVS commit: src/usr.sbin/pstat
Module Name:src Committed By: apb Date: Sat Nov 10 11:01:52 UTC 2012 Modified Files: src/usr.sbin/pstat: pstat.c Log Message: The number of active vnodes may grow in between the sysctl call that figures out the size, and the sysctl call that fetches the data. Previously, any growth at all would have resulted in this error message: pstat: sysctl: KERN_VNODE: Cannot allocate memory Now allow for growth of 100 vnodes, or 5%, or both. Growth in excess of 2% or 6000 vnodeshas been observed in practice. Also ignore ENOMEM from the second sysctl call, in case the growth was even more than we anticipated. To generate a diff of this commit: cvs rdiff -u -r1.119 -r1.120 src/usr.sbin/pstat/pstat.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/pstat/pstat.c diff -u src/usr.sbin/pstat/pstat.c:1.119 src/usr.sbin/pstat/pstat.c:1.120 --- src/usr.sbin/pstat/pstat.c:1.119 Mon Jun 4 20:13:47 2012 +++ src/usr.sbin/pstat/pstat.c Sat Nov 10 11:01:52 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: pstat.c,v 1.119 2012/06/04 20:13:47 riastradh Exp $ */ +/* $NetBSD: pstat.c,v 1.120 2012/11/10 11:01:52 apb Exp $ */ /*- * Copyright (c) 1980, 1991, 1993, 1994 @@ -39,7 +39,7 @@ __COPYRIGHT(@(#) Copyright (c) 1980, 19 #if 0 static char sccsid[] = @(#)pstat.c 8.16 (Berkeley) 5/9/95; #else -__RCSID($NetBSD: pstat.c,v 1.119 2012/06/04 20:13:47 riastradh Exp $); +__RCSID($NetBSD: pstat.c,v 1.120 2012/11/10 11:01:52 apb Exp $); #endif #endif /* not lint */ @@ -73,6 +73,7 @@ __RCSID($NetBSD: pstat.c,v 1.119 2012/0 #include sys/sysctl.h #include err.h +#include errno.h #include kvm.h #include limits.h #include nlist.h @@ -681,7 +682,8 @@ char * loadvnodes(int *avnodes) { int mib[2]; - size_t copysize; + int status; + size_t copysize, oldsize; char *vnodebase; if (totalflag) { @@ -696,12 +698,34 @@ loadvnodes(int *avnodes) } mib[0] = CTL_KERN; mib[1] = KERN_VNODE; + /* + * First sysctl call gets the necessary buffer size; second + * sysctl call gets the data. We allow for some growth in the + * data size between the two sysctl calls (increases of a few + * thousand vnodes in between the two calls have been observed). + * We ignore ENOMEM from the second sysctl call, which can + * happen if the kernel's data grew by even more than we allowed + * for. + */ if (sysctl(mib, 2, NULL, copysize, NULL, 0) == -1) err(1, sysctl: KERN_VNODE); + oldsize = copysize; + copysize += 100 * sizeof(struct vnode) + copysize / 20; if ((vnodebase = malloc(copysize)) == NULL) err(1, malloc); - if (sysctl(mib, 2, vnodebase, copysize, NULL, 0) == -1) + status = sysctl(mib, 2, vnodebase, copysize, NULL, 0); + if (status == -1 errno != ENOMEM) err(1, sysctl: KERN_VNODE); +#if 0 /* for debugging the amount of growth allowed for */ + if (copysize != oldsize) { + warnx(count changed from %ld to %ld (%+ld)%s, + (long)(oldsize / sizeof(struct vnode)), + (long)(copysize / sizeof(struct vnode)), + (long)(copysize / sizeof(struct vnode)) - + (long)(oldsize / sizeof(struct vnode)), + (status == 0 ? : , and errno = ENOMEM)); + } +#endif if (copysize % (VPTRSZ + VNODESZ)) errx(1, vnode size mismatch); *avnodes = copysize / (VPTRSZ + VNODESZ);
CVS commit: src/usr.sbin/pstat
Module Name:src Committed By: wiz Date: Tue Jan 4 09:58:03 UTC 2011 Modified Files: src/usr.sbin/pstat: pstat.c Log Message: Fix memory leak in error case. Found by cppcheck. To generate a diff of this commit: cvs rdiff -u -r1.116 -r1.117 src/usr.sbin/pstat/pstat.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/pstat/pstat.c diff -u src/usr.sbin/pstat/pstat.c:1.116 src/usr.sbin/pstat/pstat.c:1.117 --- src/usr.sbin/pstat/pstat.c:1.116 Thu Nov 19 02:52:54 2009 +++ src/usr.sbin/pstat/pstat.c Tue Jan 4 09:58:03 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: pstat.c,v 1.116 2009/11/19 02:52:54 enami Exp $ */ +/* $NetBSD: pstat.c,v 1.117 2011/01/04 09:58:03 wiz Exp $ */ /*- * Copyright (c) 1980, 1991, 1993, 1994 @@ -39,7 +39,7 @@ #if 0 static char sccsid[] = @(#)pstat.c 8.16 (Berkeley) 5/9/95; #else -__RCSID($NetBSD: pstat.c,v 1.116 2009/11/19 02:52:54 enami Exp $); +__RCSID($NetBSD: pstat.c,v 1.117 2011/01/04 09:58:03 wiz Exp $); #endif #endif /* not lint */ @@ -926,6 +926,7 @@ err(1, malloc); if (sysctl(mib, 6, buf + offset, len, NULL, 0) == -1) { warn(sysctl: 2nd KERN_FILE2); + free(buf); return (-1); } *abuf = buf;
CVS commit: src/usr.sbin/pstat
Module Name:src Committed By: joerg Date: Wed Oct 14 22:59:11 UTC 2009 Modified Files: src/usr.sbin/pstat: pstat.8 Log Message: Fix markup. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/usr.sbin/pstat/pstat.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/pstat/pstat.8 diff -u src/usr.sbin/pstat/pstat.8:1.37 src/usr.sbin/pstat/pstat.8:1.38 --- src/usr.sbin/pstat/pstat.8:1.37 Thu Dec 28 04:17:51 2006 +++ src/usr.sbin/pstat/pstat.8 Wed Oct 14 22:59:11 2009 @@ -1,4 +1,4 @@ -.\ $NetBSD: pstat.8,v 1.37 2006/12/28 04:17:51 xtraeme Exp $ +.\ $NetBSD: pstat.8,v 1.38 2009/10/14 22:59:11 joerg Exp $ .\ .\ Copyright (c) 1980, 1991, 1993, 1994 .\ The Regents of the University of California. All rights reserved. @@ -229,11 +229,7 @@ by a two line header. The first line consists of the following: .Pp -.Df I -.No *** MOUNT Em fstype from -on -.Em on fsflags -.De +.No *** MOUNT Em fstype from Li on Em on fsflags .Pp where .Em fstype @@ -383,8 +379,8 @@ .Xr fs 5 , .Xr iostat 8 .Rs -.Rt Tn UNIX Rt Implementation , -.Ra K. Thompson +.%T Tn UNIX Implementation +.%A K. Thompson .Re .Sh HISTORY The
CVS commit: src/usr.sbin/pstat
Module Name:src Committed By: mlelstv Date: Wed Sep 16 07:27:41 UTC 2009 Modified Files: src/usr.sbin/pstat: pstat.c Log Message: Distinguish between UFS1 and UFS2 inodes by reading the ufsmount structure, the previous heuristic of comparing the size fields of inode and dinode failed. To generate a diff of this commit: cvs rdiff -u -r1.114 -r1.115 src/usr.sbin/pstat/pstat.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/pstat/pstat.c diff -u src/usr.sbin/pstat/pstat.c:1.114 src/usr.sbin/pstat/pstat.c:1.115 --- src/usr.sbin/pstat/pstat.c:1.114 Sat Apr 18 08:05:18 2009 +++ src/usr.sbin/pstat/pstat.c Wed Sep 16 07:27:41 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: pstat.c,v 1.114 2009/04/18 08:05:18 lukem Exp $ */ +/* $NetBSD: pstat.c,v 1.115 2009/09/16 07:27:41 mlelstv Exp $ */ /*- * Copyright (c) 1980, 1991, 1993, 1994 @@ -39,7 +39,7 @@ #if 0 static char sccsid[] = @(#)pstat.c 8.16 (Berkeley) 5/9/95; #else -__RCSID($NetBSD: pstat.c,v 1.114 2009/04/18 08:05:18 lukem Exp $); +__RCSID($NetBSD: pstat.c,v 1.115 2009/09/16 07:27:41 mlelstv Exp $); #endif #endif /* not lint */ @@ -52,11 +52,12 @@ #include sys/ucred.h #include stdbool.h #define _KERNEL -#include sys/file.h -#include ufs/ufs/inode.h #define NFS #include sys/mount.h #undef NFS +#include sys/file.h +#include ufs/ufs/inode.h +#include ufs/ufs/ufsmount.h #include sys/uio.h #include miscfs/genfs/layer.h #undef _KERNEL @@ -476,6 +477,7 @@ struct ufs1_dinode dp1; struct ufs2_dinode dp2; } dip; + struct ufsmount ump; char flags[sizeof(ufs_flags) / sizeof(ufs_flags[0])]; char dev[4 + 1 + 7 + 1]; /* 12bit marjor + 20bit minor */ char *name; @@ -483,13 +485,15 @@ dev_t rdev; KGETRET(VTOI(vp), inode, sizeof(struct inode), vnode's inode); - KGETRET(ip-i_din.ffs1_din, dip, sizeof (struct ufs1_dinode), - inode's dinode); + KGETRET(ip-i_ump, ump, sizeof(struct ufsmount), + vnode's mount point); - if (ip-i_size == dip.dp1.di_size) + if (ump.um_fstype == UFS1) { + KGETRET(ip-i_din.ffs1_din, dip, sizeof (struct ufs1_dinode), + inode's dinode); rdev = dip.dp1.di_rdev; - else { - KGETRET(ip-i_din.ffs1_din, dip, sizeof (struct ufs2_dinode), + } else { + KGETRET(ip-i_din.ffs2_din, dip, sizeof (struct ufs2_dinode), inode's UFS2 dinode); rdev = dip.dp2.di_rdev; }
CVS commit: src/usr.sbin/pstat
Module Name:src Committed By: lukem Date: Sat Apr 18 08:05:18 UTC 2009 Modified Files: src/usr.sbin/pstat: pstat.c Log Message: Fix WARNS=4 issues (-Wshadow -Wcast-qual -Wsign-compare) To generate a diff of this commit: cvs rdiff -u -r1.113 -r1.114 src/usr.sbin/pstat/pstat.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/pstat/pstat.c diff -u src/usr.sbin/pstat/pstat.c:1.113 src/usr.sbin/pstat/pstat.c:1.114 --- src/usr.sbin/pstat/pstat.c:1.113 Wed Mar 11 06:00:11 2009 +++ src/usr.sbin/pstat/pstat.c Sat Apr 18 08:05:18 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: pstat.c,v 1.113 2009/03/11 06:00:11 mrg Exp $ */ +/* $NetBSD: pstat.c,v 1.114 2009/04/18 08:05:18 lukem Exp $ */ /*- * Copyright (c) 1980, 1991, 1993, 1994 @@ -39,7 +39,7 @@ #if 0 static char sccsid[] = @(#)pstat.c 8.16 (Berkeley) 5/9/95; #else -__RCSID($NetBSD: pstat.c,v 1.113 2009/03/11 06:00:11 mrg Exp $); +__RCSID($NetBSD: pstat.c,v 1.114 2009/04/18 08:05:18 lukem Exp $); #endif #endif /* not lint */ @@ -84,19 +84,19 @@ struct nlist nl[] = { #define V_MOUNTLIST 0 - { _mountlist }, /* address of head of mount list. */ + { _mountlist, 0, 0, 0, 0 }, /* address of head of mount list. */ #define V_NUMV 1 - { _numvnodes }, + { _numvnodes, 0, 0, 0, 0 }, #define FNL_NFILE 2 - { _nfiles }, + { _nfiles, 0, 0, 0, 0 }, #define FNL_MAXFILE 3 - { _maxfiles }, + { _maxfiles, 0, 0, 0, 0 }, #define TTY_NTTY 4 - { _tty_count }, + { _tty_count, 0, 0, 0, 0 }, #define TTY_TTYLIST 5 - { _ttylist }, + { _ttylist, 0, 0, 0, 0 }, #define NLMANDATORY TTY_TTYLIST /* names up to here are mandatory */ - { } + { , 0, 0, 0, 0 } }; int usenumflag; @@ -400,7 +400,8 @@ int vnode_print(struct vnode *avnode, struct vnode *vp) { - char *type, flags[sizeof(vnode_flags) / sizeof(vnode_flags[0])]; + const char *type; + char flags[sizeof(vnode_flags) / sizeof(vnode_flags[0])]; int ovflw; /* @@ -656,7 +657,7 @@ (void)printf(*** MOUNT %s %s on %s, ST.f_fstypename, ST.f_mntfromname, ST.f_mntonname); if ((flags = mp-mnt_flag) != 0) { - int i; + size_t i; const char *sep = (; for (i = 0; i sizeof mnt_flags / sizeof mnt_flags[0]; i++) { @@ -711,7 +712,7 @@ char * kinfo_vnodes(int *avnodes) { - struct mntlist mountlist; + struct mntlist mlist; struct mount *mp, mount; struct vnode *vp, vnode; char *beg, *bp, *ep; @@ -722,8 +723,8 @@ err(1, malloc); beg = bp; ep = bp + (numvnodes + 20) * (VPTRSZ + VNODESZ); - KGET(V_MOUNTLIST, mountlist); - for (mp = mountlist.cqh_first;; + KGET(V_MOUNTLIST, mlist); + for (mp = mlist.cqh_first;; mp = mount.mnt_list.cqe_next) { KGET2(mp, mount, sizeof(mount), mount entry); TAILQ_FOREACH(vp, mount.mnt_vnodelist, v_mntvnodes) { @@ -736,7 +737,7 @@ memmove(bp, vnode, VNODESZ); bp += VNODESZ; } - if (mp == mountlist.cqh_last) + if (mp == mlist.cqh_last) break; } *avnodes = (bp - beg) / (VPTRSZ + VNODESZ); @@ -879,7 +880,7 @@ PRWORD(ovflw, %*d, 5, 1, ki-ki_msgcount); PRWORD(ovflw, %*lx, PTRSTRWIDTH + 1, 2, (long)ki-ki_fdata); PRWORD(ovflw, %*x, 5, 1, 0); - if (ki-ki_foffset 0) + if ((off_t)ki-ki_foffset 0) PRWORD(ovflw, %-*lld\n, PTRSTRWIDTH + 1, 2, (long long)ki-ki_foffset); else