diff --git a/usr.bin/top/Makefile b/usr.bin/top/Makefile index 58fc850a2922..89a798b6a094 100644 --- a/usr.bin/top/Makefile +++ b/usr.bin/top/Makefile @@ -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 diff --git a/usr.bin/top/loadavg.h b/usr.bin/top/loadavg.h index 7981cf0c74cf..852f079e35cd 100644 --- a/usr.bin/top/loadavg.h +++ b/usr.bin/top/loadavg.h @@ -14,12 +14,14 @@ * $FreeBSD$ */ -#define FIXED_LOADAVG FSCALE -#define FIXED_PCTCPU FSCALE +#ifndef LOADAVG_H +#define LOADAVG_H + +#include 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 */ diff --git a/usr.bin/top/top.c b/usr.bin/top/top.c index d10f285719cc..087d022058a9 100644 --- a/usr.bin/top/top.c +++ b/usr.bin/top/top.c @@ -643,8 +643,8 @@ _Static_assert(sizeof(command_chars) == CMD_toggletid + 2, "command chars size") if (warnings) { fputs("....", stderr); - fflush(stderr); /* why must I do this? */ - sleep((unsigned)(3 * warnings)); + fflush(stderr); + sleep(3 * warnings); fputc('\n', stderr); } diff --git a/usr.bin/top/top.h b/usr.bin/top/top.h index 25f981dc8b9c..e143551121c5 100644 --- a/usr.bin/top/top.h +++ b/usr.bin/top/top.h @@ -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*); @@ -75,12 +70,4 @@ void quit(int); */ #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 */ diff --git a/usr.bin/top/username.c b/usr.bin/top/username.c index 06aae92529c0..566fb8edfb6a 100644 --- a/usr.bin/top/username.c +++ b/usr.bin/top/username.c @@ -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 */