Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/pstat Use va.va_type instead of va.va_mode to deter...



details:   https://anonhg.NetBSD.org/src/rev/e8a884e2a9a7
branches:  trunk
changeset: 500521:e8a884e2a9a7
user:      enami <enami%NetBSD.org@localhost>
date:      Wed Dec 13 05:34:55 2000 +0000

description:
Use va.va_type instead of va.va_mode to determine if a nfs vnode is a
deivce node or not, since latter contains permission bits only.

diffstat:

 usr.sbin/pstat/pstat.c |  19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)

diffs (46 lines):

diff -r 925006894ecd -r e8a884e2a9a7 usr.sbin/pstat/pstat.c
--- a/usr.sbin/pstat/pstat.c    Wed Dec 13 04:05:14 2000 +0000
+++ b/usr.sbin/pstat/pstat.c    Wed Dec 13 05:34:55 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pstat.c,v 1.54 2000/11/02 21:40:37 tron Exp $  */
+/*     $NetBSD: pstat.c,v 1.55 2000/12/13 05:34:55 enami Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993, 1994
@@ -43,7 +43,7 @@
 #if 0
 static char sccsid[] = "@(#)pstat.c    8.16 (Berkeley) 5/9/95";
 #else
-__RCSID("$NetBSD: pstat.c,v 1.54 2000/11/02 21:40:37 tron Exp $");
+__RCSID("$NetBSD: pstat.c,v 1.55 2000/12/13 05:34:55 enami Exp $");
 #endif
 #endif /* not lint */
 
@@ -556,15 +556,24 @@
 
        KGETRET(np->n_vattr, &va, sizeof(va), "vnode attr");
        (void)printf(" %6ld %5s", (long)va.va_fileid, flagbuf);
-       type = va.va_mode & S_IFMT;
-       if (S_ISCHR(va.va_mode) || S_ISBLK(va.va_mode))
+       switch (va.va_type) {
+       case VCHR:
+               type = S_IFCHR;
+               goto device;
+               
+       case VBLK:
+               type = S_IFBLK;
+       device:
                if (usenumflag || ((name = devname(va.va_rdev, type)) == NULL))
                        (void)printf("   %2d,%-2d",
                            major(va.va_rdev), minor(va.va_rdev));
                else
                        (void)printf(" %7s", name);
-       else
+               break;
+       default:
                (void)printf(" %7qd", (long long)np->n_size);
+               break;
+       }
        return (0);
 }
 



Home | Main Index | Thread Index | Old Index