Date: Sun, 10 Jun 2018 06:21:51 +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: r334917 - head/usr.bin/top Message-ID: <201806100621.w5A6Lpbc004251@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201806100621.w5A6Lpbc004251>