Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Jun 2018 00:45:36 +0000 (UTC)
From:      Eitan Adler <eadler@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r335023 - head/bin/ps
Message-ID:  <201806130045.w5D0jaVk043623@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: eadler
Date: Wed Jun 13 00:45:35 2018
New Revision: 335023
URL: https://svnweb.freebsd.org/changeset/base/335023

Log:
  ps(1): fix some nits
  
  - fracmem and mempages are double. ki_rssize should be too
  - remove default case that is fully covered by all existing cases
  - mark usage as dead

Modified:
  head/bin/ps/print.c
  head/bin/ps/ps.c

Modified: head/bin/ps/print.c
==============================================================================
--- head/bin/ps/print.c	Tue Jun 12 23:54:08 2018	(r335022)
+++ head/bin/ps/print.c	Wed Jun 13 00:45:35 2018	(r335023)
@@ -662,7 +662,7 @@ getpmem(KINFO *k)
 		return (0.0);
 	/* XXX want pmap ptpages, segtab, etc. (per architecture) */
 	/* XXX don't have info about shared */
-	fracmem = ((float)k->ki_p->ki_rssize) / mempages;
+	fracmem = ((double)k->ki_p->ki_rssize) / mempages;
 	return (100.0 * fracmem);
 }
 
@@ -771,8 +771,6 @@ printval(void *bp, VAR *v)
 	case PGTOK:
 		(void)asprintf(&str, ofmt, ps_pgtok(*(u_long *)bp));
 		break;
-	default:
-		xo_errx(1, "unknown type %d", v->type);
 	}
 
 	return (str);

Modified: head/bin/ps/ps.c
==============================================================================
--- head/bin/ps/ps.c	Tue Jun 12 23:54:08 2018	(r335022)
+++ head/bin/ps/ps.c	Wed Jun 13 00:45:35 2018	(r335023)
@@ -689,7 +689,7 @@ main(int argc, char *argv[])
 			    (STAILQ_NEXT(vent, next_ve) == NULL &&
 			    (vent->var->flag & LJUST))) ? 0 : vent->var->width;
 			snprintf(fmtbuf, sizeof(fmtbuf), "{:%s/%%%s%d..%ds}",
-			    vent->var->field ?: vent->var->name,
+			    vent->var->field ? vent->var->field : vent->var->name,
 			    (vent->var->flag & LJUST) ? "-" : "",
 			    fwidthmin, fwidthmax);
 			xo_emit(fmtbuf, str);
@@ -1448,7 +1448,7 @@ pidmax_init(void)
 	}
 }
 
-static void
+static void __dead2
 usage(void)
 {
 #define	SINGLE_OPTS	"[-aCcde" OPT_LAZY_f "HhjlmrSTuvwXxZ]"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201806130045.w5D0jaVk043623>