From owner-svn-src-all@freebsd.org Mon Jun 4 04:59:34 2018 Return-Path: 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 7DA8EFF038F; Mon, 4 Jun 2018 04:59:34 +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 335FE71048; Mon, 4 Jun 2018 04:59:34 +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 14FB6A6D; Mon, 4 Jun 2018 04:59:34 +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 w544xXM0060049; Mon, 4 Jun 2018 04:59:33 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w544xWgB060042; Mon, 4 Jun 2018 04:59:32 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201806040459.w544xWgB060042@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 4 Jun 2018 04:59:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334600 - 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: 334600 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 " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jun 2018 04:59:34 -0000 Author: eadler Date: Mon Jun 4 04:59:32 2018 New Revision: 334600 URL: https://svnweb.freebsd.org/changeset/base/334600 Log: 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) Modified: head/usr.bin/top/commands.c head/usr.bin/top/display.c head/usr.bin/top/display.h head/usr.bin/top/machine.c head/usr.bin/top/machine.h head/usr.bin/top/top.c head/usr.bin/top/username.c Modified: head/usr.bin/top/commands.c ============================================================================== --- head/usr.bin/top/commands.c Mon Jun 4 04:59:24 2018 (r334599) +++ head/usr.bin/top/commands.c Mon Jun 4 04:59:32 2018 (r334600) @@ -18,6 +18,7 @@ */ #include +#include #include #include Modified: head/usr.bin/top/display.c ============================================================================== --- head/usr.bin/top/display.c Mon Jun 4 04:59:24 2018 (r334599) +++ head/usr.bin/top/display.c Mon Jun 4 04:59:32 2018 (r334600) @@ -28,17 +28,17 @@ * *_process, u_endscreen. */ +#include #include #include #include -#include #include #include #include #include +#include #include -#include #include #include #include @@ -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 */ Modified: head/usr.bin/top/display.h ============================================================================== --- head/usr.bin/top/display.h Mon Jun 4 04:59:24 2018 (r334599) +++ head/usr.bin/top/display.h Mon Jun 4 04:59:32 2018 (r334600) @@ -4,7 +4,8 @@ #define MT_standout 1 #define MT_delayed 2 -#include "machine.h" +#include +struct statics; int display_updatecpus(struct statics *statics); void clear_message(void); Modified: head/usr.bin/top/machine.c ============================================================================== --- head/usr.bin/top/machine.c Mon Jun 4 04:59:24 2018 (r334599) +++ head/usr.bin/top/machine.c Mon Jun 4 04:59:32 2018 (r334600) @@ -8,37 +8,35 @@ * by Monte Mitzelfelt (for latest top see http://www.groupsys.com/topinfo/) * * AUTHOR: Christos Zoulas - * Steven Wallace + * Steven Wallace * Wolfram Schneider * Thomas Moestl + * Eitan Adler * * $FreeBSD$ */ #include -#include +#include #include +#include #include #include -#include -#include #include #include #include -#include #include #include #include #include -#include #include -#include #include #include +#include #include #include -#include +#include #include #include @@ -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, l 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; Modified: head/usr.bin/top/machine.h ============================================================================== --- head/usr.bin/top/machine.h Mon Jun 4 04:59:24 2018 (r334599) +++ head/usr.bin/top/machine.h Mon Jun 4 04:59:32 2018 (r334600) @@ -10,6 +10,9 @@ #ifndef MACHINE_H #define MACHINE_H +#include +#include + #define NUM_AVERAGES 3 /* Log base 2 of 1024 is 10 (2^10 == 1024) */ Modified: head/usr.bin/top/top.c ============================================================================== --- head/usr.bin/top/top.c Mon Jun 4 04:59:24 2018 (r334599) +++ head/usr.bin/top/top.c Mon Jun 4 04:59:32 2018 (r334600) @@ -13,15 +13,17 @@ */ #include -#include -#include #include +#include +#include +#include +#include +#include -#include -#include #include #include -#include +#include +#include #include #include #include Modified: head/usr.bin/top/username.c ============================================================================== --- head/usr.bin/top/username.c Mon Jun 4 04:59:24 2018 (r334599) +++ head/usr.bin/top/username.c Mon Jun 4 04:59:32 2018 (r334600) @@ -30,7 +30,6 @@ */ #include -#include #include #include