From owner-svn-src-all@freebsd.org  Sun Jun 10 06:21:54 2018
Return-Path: <owner-svn-src-all@freebsd.org>
Delivered-To: svn-src-all@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 42E541011318;
 Sun, 10 Jun 2018 06:21:54 +0000 (UTC)
 (envelope-from eadler@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 713436F853;
 Sun, 10 Jun 2018 06:21:53 +0000 (UTC)
 (envelope-from eadler@FreeBSD.org)
Received: from repo.freebsd.org (repo.freebsd.org
 [IPv6:2610:1c1:1:6068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E163AE65;
 Sun, 10 Jun 2018 06:21:52 +0000 (UTC)
 (envelope-from eadler@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w5A6LqDk004272;
 Sun, 10 Jun 2018 06:21:52 GMT (envelope-from eadler@FreeBSD.org)
Received: (from eadler@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id w5A6Lpbc004251;
 Sun, 10 Jun 2018 06:21:51 GMT (envelope-from eadler@FreeBSD.org)
Message-Id: <201806100621.w5A6Lpbc004251@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: eadler set sender to
 eadler@FreeBSD.org using -f
From: Eitan Adler <eadler@FreeBSD.org>
Date: Sun, 10 Jun 2018 06:21:51 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r334917 - head/usr.bin/top
X-SVN-Group: head
X-SVN-Commit-Author: eadler
X-SVN-Commit-Paths: head/usr.bin/top
X-SVN-Commit-Revision: 334917
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.26
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for &quot;
 user&quot; and &quot; projects&quot; \)" <svn-src-all.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-all>,
 <mailto:svn-src-all-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-all/>
List-Post: <mailto:svn-src-all@freebsd.org>
List-Help: <mailto:svn-src-all-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-all>,
 <mailto:svn-src-all-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 10 Jun 2018 06:21:54 -0000

Author: eadler
Date: Sun Jun 10 06:21:51 2018
New Revision: 334917
URL: https://svnweb.freebsd.org/changeset/base/334917

Log:
  top(1): filter fewer warnings; clean up
  
  - remove WARNS?=6. It is default
  - we no longer have cast-qual problems
  - remove unused macros
  - remove unneeded casts
  - add include guard for loadavg.h

Modified:
  head/usr.bin/top/Makefile
  head/usr.bin/top/loadavg.h
  head/usr.bin/top/top.c
  head/usr.bin/top/top.h
  head/usr.bin/top/username.c

Modified: head/usr.bin/top/Makefile
==============================================================================
--- head/usr.bin/top/Makefile	Sun Jun 10 06:21:45 2018	(r334916)
+++ head/usr.bin/top/Makefile	Sun Jun 10 06:21:51 2018	(r334917)
@@ -8,17 +8,15 @@ SRCS=	commands.c display.c machine.c screen.c top.c \
 CFLAGS+= -I ${.OBJDIR}
 MAN=	top.1
 
-WARNS?=	6
-
 .if ${COMPILER_TYPE} == "gcc"
 .if ${COMPILER_VERSION} >= 50000
-CFLAGS.gcc=-Wno-error=cast-align -Wno-error=cast-qual -Wno-error=discarded-qualifiers -Wno-error=incompatible-pointer-types \
+CFLAGS.gcc=-Wno-error=cast-qual -Wno-error=discarded-qualifiers -Wno-error=incompatible-pointer-types \
 	-Wno-error=maybe-uninitialized
 .else #base gcc
 NO_WERROR=
 .endif
 .endif
-CFLAGS.clang=-Wno-error=incompatible-pointer-types-discards-qualifiers -Wno-error=cast-qual -Wno-error=cast-align
+CFLAGS.clang=-Wno-error=incompatible-pointer-types-discards-qualifiers -Wno-error=cast-qual
 
 LIBADD=	ncursesw m kvm jail
 

Modified: head/usr.bin/top/loadavg.h
==============================================================================
--- head/usr.bin/top/loadavg.h	Sun Jun 10 06:21:45 2018	(r334916)
+++ head/usr.bin/top/loadavg.h	Sun Jun 10 06:21:51 2018	(r334917)
@@ -14,12 +14,14 @@
  *	$FreeBSD$
  */
 
-#define FIXED_LOADAVG FSCALE
-#define FIXED_PCTCPU FSCALE
+#ifndef LOADAVG_H
+#define LOADAVG_H
 
+#include <sys/param.h>
+
 typedef long pctcpu;
-#define pctdouble(p) ((double)(p) / FIXED_PCTCPU)
+#define pctdouble(p) ((double)(p) / FSCALE)
 
 typedef fixpt_t load_avg;
-#define loaddouble(la) ((double)(la) / FIXED_LOADAVG)
-#define intload(i) ((int)((i) * FIXED_LOADAVG))
+#define loaddouble(la) ((double)(la) / FSCALE)
+#endif /* LOADAVG_H */

Modified: head/usr.bin/top/top.c
==============================================================================
--- head/usr.bin/top/top.c	Sun Jun 10 06:21:45 2018	(r334916)
+++ head/usr.bin/top/top.c	Sun Jun 10 06:21:51 2018	(r334917)
@@ -643,8 +643,8 @@ _Static_assert(sizeof(command_chars) == CMD_toggletid 
     if (warnings)
     {
 	fputs("....", stderr);
-	fflush(stderr);			/* why must I do this? */
-	sleep((unsigned)(3 * warnings));
+	fflush(stderr);
+	sleep(3 * warnings);
 	fputc('\n', stderr);
     }
 

Modified: head/usr.bin/top/top.h
==============================================================================
--- head/usr.bin/top/top.h	Sun Jun 10 06:21:45 2018	(r334916)
+++ head/usr.bin/top/top.h	Sun Jun 10 06:21:51 2018	(r334917)
@@ -23,10 +23,6 @@ extern int Header_lines;	/* 7 */
 /* maximum number we can have */
 #define Largest		0x7fffffff
 
-/*
- * The entire display is based on these next numbers being defined as is.
- */
-
 /* Exit code for system errors */
 #define TOP_EX_SYS_ERROR	23
 
@@ -43,7 +39,6 @@ extern int pcpu_stats;
 extern int overstrike;
 extern pid_t mypid;
 
-
 extern const char * myname;
 
 extern int (*compares[])(const void*, const void*);
@@ -74,13 +69,5 @@ void quit(int);
  *  overridden on the command line, even with the value "infinity".
  */
 #define Nominal_TOPN	18
-
-/*
- *  If the local system's getpwnam interface uses random access to retrieve
- *  a record (i.e.: 4.3 systems, Sun "yellow pages"), then defining
- *  RANDOM_PW will take advantage of that fact.  
- */
-
-#define RANDOM_PW	1
 
 #endif /* TOP_H */

Modified: head/usr.bin/top/username.c
==============================================================================
--- head/usr.bin/top/username.c	Sun Jun 10 06:21:45 2018	(r334916)
+++ head/usr.bin/top/username.c	Sun Jun 10 06:21:51 2018	(r334917)
@@ -115,8 +115,6 @@ int enter_user(int uid, char name[], bool wecare)
 
 /*
  * Get a userid->name mapping from the system.
- * If the passwd database is hashed (#define RANDOM_PW), we
- * just handle this uid.
  */
 
 int
@@ -127,7 +125,7 @@ get_user(int uid)
     /* no performance penalty for using getpwuid makes it easy */
     if ((pwd = getpwuid(uid)) != NULL)
     {
-	return(enter_user(pwd->pw_uid, pwd->pw_name, 1));
+		return(enter_user(pwd->pw_uid, pwd->pw_name, 1));
     }
 
     /* if we can't find the name at all, then use the uid as the name */