svn commit: r335023 - head/bin/ps

Eitan Adler eadler at FreeBSD.org
Wed Jun 13 00:45:37 UTC 2018


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]"


More information about the svn-src-head mailing list