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
This commit is contained in:
parent
18f78f76b1
commit
4b53cf024a
@ -8,17 +8,15 @@ SRCS= commands.c display.c machine.c screen.c top.c \
|
|||||||
CFLAGS+= -I ${.OBJDIR}
|
CFLAGS+= -I ${.OBJDIR}
|
||||||
MAN= top.1
|
MAN= top.1
|
||||||
|
|
||||||
WARNS?= 6
|
|
||||||
|
|
||||||
.if ${COMPILER_TYPE} == "gcc"
|
.if ${COMPILER_TYPE} == "gcc"
|
||||||
.if ${COMPILER_VERSION} >= 50000
|
.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
|
-Wno-error=maybe-uninitialized
|
||||||
.else #base gcc
|
.else #base gcc
|
||||||
NO_WERROR=
|
NO_WERROR=
|
||||||
.endif
|
.endif
|
||||||
.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
|
LIBADD= ncursesw m kvm jail
|
||||||
|
|
||||||
|
@ -14,12 +14,14 @@
|
|||||||
* $FreeBSD$
|
* $FreeBSD$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define FIXED_LOADAVG FSCALE
|
#ifndef LOADAVG_H
|
||||||
#define FIXED_PCTCPU FSCALE
|
#define LOADAVG_H
|
||||||
|
|
||||||
|
#include <sys/param.h>
|
||||||
|
|
||||||
typedef long pctcpu;
|
typedef long pctcpu;
|
||||||
#define pctdouble(p) ((double)(p) / FIXED_PCTCPU)
|
#define pctdouble(p) ((double)(p) / FSCALE)
|
||||||
|
|
||||||
typedef fixpt_t load_avg;
|
typedef fixpt_t load_avg;
|
||||||
#define loaddouble(la) ((double)(la) / FIXED_LOADAVG)
|
#define loaddouble(la) ((double)(la) / FSCALE)
|
||||||
#define intload(i) ((int)((i) * FIXED_LOADAVG))
|
#endif /* LOADAVG_H */
|
||||||
|
@ -643,8 +643,8 @@ _Static_assert(sizeof(command_chars) == CMD_toggletid + 2, "command chars size")
|
|||||||
if (warnings)
|
if (warnings)
|
||||||
{
|
{
|
||||||
fputs("....", stderr);
|
fputs("....", stderr);
|
||||||
fflush(stderr); /* why must I do this? */
|
fflush(stderr);
|
||||||
sleep((unsigned)(3 * warnings));
|
sleep(3 * warnings);
|
||||||
fputc('\n', stderr);
|
fputc('\n', stderr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,10 +23,6 @@ extern int Header_lines; /* 7 */
|
|||||||
/* maximum number we can have */
|
/* maximum number we can have */
|
||||||
#define Largest 0x7fffffff
|
#define Largest 0x7fffffff
|
||||||
|
|
||||||
/*
|
|
||||||
* The entire display is based on these next numbers being defined as is.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Exit code for system errors */
|
/* Exit code for system errors */
|
||||||
#define TOP_EX_SYS_ERROR 23
|
#define TOP_EX_SYS_ERROR 23
|
||||||
|
|
||||||
@ -43,7 +39,6 @@ extern int pcpu_stats;
|
|||||||
extern int overstrike;
|
extern int overstrike;
|
||||||
extern pid_t mypid;
|
extern pid_t mypid;
|
||||||
|
|
||||||
|
|
||||||
extern const char * myname;
|
extern const char * myname;
|
||||||
|
|
||||||
extern int (*compares[])(const void*, const void*);
|
extern int (*compares[])(const void*, const void*);
|
||||||
@ -75,12 +70,4 @@ void quit(int);
|
|||||||
*/
|
*/
|
||||||
#define Nominal_TOPN 18
|
#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 */
|
#endif /* TOP_H */
|
||||||
|
@ -115,8 +115,6 @@ int enter_user(int uid, char name[], bool wecare)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Get a userid->name mapping from the system.
|
* Get a userid->name mapping from the system.
|
||||||
* If the passwd database is hashed (#define RANDOM_PW), we
|
|
||||||
* just handle this uid.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -127,7 +125,7 @@ get_user(int uid)
|
|||||||
/* no performance penalty for using getpwuid makes it easy */
|
/* no performance penalty for using getpwuid makes it easy */
|
||||||
if ((pwd = getpwuid(uid)) != NULL)
|
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 */
|
/* if we can't find the name at all, then use the uid as the name */
|
||||||
|
Loading…
Reference in New Issue
Block a user