top(1): include what you use
- Change headers to more closely match what we use - use more standard functions instead of bzero, bcmp, bcopy - Add myself to authors. Tested with: base clang (amd64), gcc 9 (amd64), base clang (i386), base gcc (mips)
This commit is contained in:
parent
5dc98aeeaa
commit
8d0d26767b
@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/resource.h>
|
||||
#include <sys/signal.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
|
@ -28,17 +28,17 @@
|
||||
* *_process, u_endscreen.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <curses.h>
|
||||
#include <ctype.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <termcap.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
@ -823,7 +823,7 @@ i_process(int line, char *thisline)
|
||||
p = stpcpy(base, thisline);
|
||||
|
||||
/* zero fill the rest of it */
|
||||
bzero(p, display_width - (p - base));
|
||||
memset(p, 0, display_width - (p - base));
|
||||
}
|
||||
|
||||
void
|
||||
@ -862,7 +862,7 @@ u_process(int line, char *newline)
|
||||
optr = stpcpy(bufferline, newline);
|
||||
|
||||
/* zero fill the rest of it */
|
||||
bzero(optr, display_width - (optr - bufferline));
|
||||
memset(optr, 0, display_width - (optr - bufferline));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1236,7 +1236,7 @@ line_update(char *old, char *new, int start, int line)
|
||||
diff = display_width - newcol;
|
||||
if (diff > 0)
|
||||
{
|
||||
bzero(old, diff);
|
||||
memset(old, 0, diff);
|
||||
}
|
||||
|
||||
/* remember where the current line is */
|
||||
|
@ -4,7 +4,8 @@
|
||||
#define MT_standout 1
|
||||
#define MT_delayed 2
|
||||
|
||||
#include "machine.h"
|
||||
#include <sys/time.h>
|
||||
struct statics;
|
||||
|
||||
int display_updatecpus(struct statics *statics);
|
||||
void clear_message(void);
|
||||
|
@ -8,37 +8,35 @@
|
||||
* by Monte Mitzelfelt (for latest top see http://www.groupsys.com/topinfo/)
|
||||
*
|
||||
* AUTHOR: Christos Zoulas <christos@ee.cornell.edu>
|
||||
* Steven Wallace <swallace@freebsd.org>
|
||||
* Steven Wallace <swallace@FreeBSD.org>
|
||||
* Wolfram Schneider <wosch@FreeBSD.org>
|
||||
* Thomas Moestl <tmoestl@gmx.net>
|
||||
* Eitan Adler <eadler@FreeBSD.org>
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/errno.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/priority.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/rtprio.h>
|
||||
#include <sys/signal.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/user.h>
|
||||
#include <sys/vmmeter.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <err.h>
|
||||
#include <kvm.h>
|
||||
#include <math.h>
|
||||
#include <nlist.h>
|
||||
#include <paths.h>
|
||||
#include <pwd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <vis.h>
|
||||
|
||||
@ -86,8 +84,6 @@ struct handle {
|
||||
|
||||
#define PCTCPU(pp) (pcpu[pp - pbase])
|
||||
|
||||
/* definitions for indices in the nlist array */
|
||||
|
||||
/*
|
||||
* These definitions control the format of the per-process area
|
||||
*/
|
||||
@ -647,7 +643,7 @@ get_old_proc(struct kinfo_proc *pp)
|
||||
return (NULL);
|
||||
}
|
||||
oldp = *oldpp;
|
||||
if (bcmp(&oldp->ki_start, &pp->ki_start, sizeof(pp->ki_start)) != 0) {
|
||||
if (memcmp(&oldp->ki_start, &pp->ki_start, sizeof(pp->ki_start)) != 0) {
|
||||
pp->ki_udata = NOPROC;
|
||||
return (NULL);
|
||||
}
|
||||
@ -669,7 +665,7 @@ get_io_stats(const struct kinfo_proc *pp, long *inp, long *oup, long *flp,
|
||||
|
||||
oldp = get_old_proc(pp);
|
||||
if (oldp == NULL) {
|
||||
bzero(&dummy, sizeof(dummy));
|
||||
memset(&dummy, 0, sizeof(dummy));
|
||||
oldp = &dummy;
|
||||
}
|
||||
*inp = RU(pp)->ru_inblock - RU(oldp)->ru_inblock;
|
||||
|
@ -10,6 +10,9 @@
|
||||
#ifndef MACHINE_H
|
||||
#define MACHINE_H
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#define NUM_AVERAGES 3
|
||||
|
||||
/* Log base 2 of 1024 is 10 (2^10 == 1024) */
|
||||
|
@ -13,15 +13,17 @@
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/jail.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/limits.h>
|
||||
#include <sys/select.h>
|
||||
#include <sys/signal.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <curses.h>
|
||||
#include <errno.h>
|
||||
#include <jail.h>
|
||||
#include <setjmp.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <signal.h>
|
||||
#include <string.h>
|
||||
|
@ -30,7 +30,6 @@
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <pwd.h>
|
||||
#include <stdbool.h>
|
||||
|
Loading…
x
Reference in New Issue
Block a user