OK bluhm@

On Mon, Jul 18, 2016 at 12:27:50PM +0200, Philip Guenther wrote:
> 
> The VFLAG column of pstat -v is a bit wonky:
> 
>     ADDR TYP VFLAG  USE HOLD FILEID IFLAG RDEV|SZ
> cc2ece20 chr     -    1    0   4244    Am    kmem
> cc2ecdac chr     -    1    0   4243           mem
> cc30f920 chr     I    2    0   3763  ACUm   ttyp2
> cc30f8ac chr     I    1    0   3764  ACUm   ptyp2
> cc30f838 chr    F-    0    0   3891           ptm
> ...
> cc80c48c blk    s-   17    7   3440          sd0l
> ...
> cc80cd28 dir    RF    0    2      2           512
> 
> Why "F-" or "s-" but "RF"?  Because the decision of whether to print a '-' 
> to placehold the column when there are no flags ignores the 'B', 'F', and 
> 'S' flags!  Diff below switches to deciding to print a '-' only if we 
> haven't printed any flags, instead of basing it on whether one of the 
> flags members is zero.
> 
> ok?
> 
> Philip
> 
> Index: usr.sbin/pstat/pstat.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/pstat/pstat.c,v
> retrieving revision 1.106
> diff -u -p -r1.106 pstat.c
> --- usr.sbin/pstat/pstat.c    3 Jun 2016 20:38:48 -0000       1.106
> +++ usr.sbin/pstat/pstat.c    18 Jul 2016 10:22:37 -0000
> @@ -407,7 +407,7 @@ void
>  vnode_print(struct vnode *avnode, struct vnode *vp)
>  {
>       char *type, flags[16];
> -     char *fp = flags;
> +     char *fp;
>       int flag;
>  
>       /*
> @@ -438,6 +438,7 @@ vnode_print(struct vnode *avnode, struct
>       /*
>        * gather flags
>        */
> +     fp = flags;
>       flag = vp->v_flag;
>       if (flag & VROOT)
>               *fp++ = 'R';
> @@ -461,7 +462,7 @@ vnode_print(struct vnode *avnode, struct
>               *fp++ = 'l';
>       if (vp->v_bioflag & VBIOONSYNCLIST)
>               *fp++ = 's';
> -     if (flag == 0)
> +     if (fp == flags)
>               *fp++ = '-';
>       *fp = '\0';
>       (void)printf("%0*lx %s %5s %4d %4u",

Reply via email to