From owner-svn-src-all@freebsd.org Mon May 21 01:16:28 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 3A7E7EAA670; Mon, 21 May 2018 01:16:28 +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 DC80E815D2; Mon, 21 May 2018 01:16:27 +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 BA1671E1C2; Mon, 21 May 2018 01:16:27 +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 w4L1GRAR098544; Mon, 21 May 2018 01:16:27 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4L1GQ8q098540; Mon, 21 May 2018 01:16:26 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201805210116.w4L1GQ8q098540@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 21 May 2018 01:16:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r333954 - 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: 333954 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, 21 May 2018 01:16:28 -0000 Author: eadler Date: Mon May 21 01:16:26 2018 New Revision: 333954 URL: https://svnweb.freebsd.org/changeset/base/333954 Log: top(1): pull function declarations and externs into headers Modified: head/usr.bin/top/commands.c head/usr.bin/top/machine.c head/usr.bin/top/top.c head/usr.bin/top/top.h Modified: head/usr.bin/top/commands.c ============================================================================== --- head/usr.bin/top/commands.c Mon May 21 01:06:59 2018 (r333953) +++ head/usr.bin/top/commands.c Mon May 21 01:16:26 2018 (r333954) @@ -35,11 +35,6 @@ #include "utils.h" #include "machine.h" -extern char *copyright; - -/* imported from screen.c */ -extern int overstrike; - static int err_compar(const void *p1, const void *p2); struct errs /* structure for a system-call error */ Modified: head/usr.bin/top/machine.c ============================================================================== --- head/usr.bin/top/machine.c Mon May 21 01:06:59 2018 (r333953) +++ head/usr.bin/top/machine.c Mon May 21 01:16:26 2018 (r333954) @@ -43,6 +43,7 @@ #include "top.h" #include "machine.h" +#include "display.h" #include "screen.h" #include "utils.h" #include "layout.h" @@ -52,7 +53,7 @@ #define UPUNAMELEN 15 extern struct process_select ps; -extern char* printable(char *); +extern struct timeval timeout; static int smpmode; enum displaymodes displaymode; #ifdef TOP_USERNAME_LEN @@ -67,9 +68,6 @@ static int jidlength; static int swaplength; static int cmdlengthdelta; -/* Prototypes for top internals */ -void quit(int); - /* get_process_info passes back a handle. This is what it looks like: */ struct handle { @@ -233,9 +231,6 @@ static int pageshift; /* log base 2 of the pagesize * #define ki_swap(kip) \ ((kip)->ki_swrss > (kip)->ki_rssize ? (kip)->ki_swrss - (kip)->ki_rssize : 0) -/* useful externals */ -long percentages(int cnt, int *out, long *new, long *old, long *diffs); - /* * Sorting orders. The first element is the default. */ @@ -470,7 +465,6 @@ format_header(char *uname_field) static int swappgsin = -1; static int swappgsout = -1; -extern struct timeval timeout; void Modified: head/usr.bin/top/top.c ============================================================================== --- head/usr.bin/top/top.c Mon May 21 01:06:59 2018 (r333953) +++ head/usr.bin/top/top.c Mon May 21 01:16:26 2018 (r333954) @@ -3,7 +3,6 @@ char *copyright = /* * Top users/processes display for Unix - * Version 3 * * This program may be freely redistributed, * but this entire comment MUST remain intact. @@ -16,23 +15,6 @@ char *copyright = * $FreeBSD$ */ -/* - * See the file "Changes" for information on version-to-version changes. - */ - -/* - * This file contains "main" and other high-level routines. - */ - -/* - * The following preprocessor variables, when defined, are used to - * distinguish between different Unix implementations: - * - * SIGHOLD - use SVR4 sighold function when defined - * SIGRELSE - use SVR4 sigrelse function when defined - * FD_SET - macros FD_SET and FD_ZERO are used when defined - */ - #include #include #include @@ -48,7 +30,6 @@ char *copyright = #include #include -/* includes specific to top */ #include "commands.h" #include "display.h" /* interface to display package */ #include "screen.h" /* interface to screen package */ @@ -70,13 +51,7 @@ char stdoutbuf[Buffersize]; /* build Signal masks */ #define Smask(s) (1 << ((s) - 1)) -/* for getopt: */ -extern int optind; -extern char *optarg; -/* imported from screen.c */ -extern int overstrike; - static int fmt_flags = 0; int pcpu_stats = No; @@ -85,13 +60,10 @@ static sigret_t leave(int); static sigret_t tstop(int); static sigret_t top_winch(int); -volatile sig_atomic_t leaveflag; -volatile sig_atomic_t tstopflag; -volatile sig_atomic_t winchflag; +static volatile sig_atomic_t leaveflag; +static volatile sig_atomic_t tstopflag; +static volatile sig_atomic_t winchflag; -/* internal routines */ -void quit(int); - /* values which need to be accessed by signal handlers */ static int max_topn; /* maximum displayable processes */ @@ -102,7 +74,6 @@ jmp_buf jmp_int; char *username(int); -extern int (*compares[])(const void*, const void*); time_t time(time_t *tloc); caddr_t get_process_info(struct system_info *si, struct process_select *sel, Modified: head/usr.bin/top/top.h ============================================================================== --- head/usr.bin/top/top.h Mon May 21 01:06:59 2018 (r333953) +++ head/usr.bin/top/top.h Mon May 21 01:16:26 2018 (r333954) @@ -44,9 +44,17 @@ enum displaymodes { DISP_CPU = 0, DISP_IO, DISP_MAX }; extern enum displaymodes displaymode; extern int pcpu_stats; +extern int overstrike; +extern int (*compares[])(const void*, const void*); + char* kill_procs(char *); char* renice_procs(char *); + +extern char *copyright; +/* internal routines */ +void quit(int); + /* * The space command forces an immediate update. Sometimes, on loaded