From owner-svn-src-head@freebsd.org Sat May 19 23:00:00 2018 Return-Path: Delivered-To: svn-src-head@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 B7B2FEE7839; Sat, 19 May 2018 23:00:00 +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 687E583AF4; Sat, 19 May 2018 23:00:00 +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 497385CEF; Sat, 19 May 2018 23:00:00 +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 w4JN00MK001734; Sat, 19 May 2018 23:00:00 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4JMxw5l001678; Sat, 19 May 2018 22:59:58 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201805192259.w4JMxw5l001678@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sat, 19 May 2018 22:59:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r333900 - 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: 333900 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 May 2018 23:00:01 -0000 Author: eadler Date: Sat May 19 22:59:58 2018 New Revision: 333900 URL: https://svnweb.freebsd.org/changeset/base/333900 Log: top(1): assume that we're building on FreeBSD This allows us to avoid the ifdefs that we set unconditionally. Deleted: head/usr.bin/top/getopt.c Modified: head/usr.bin/top/Makefile head/usr.bin/top/commands.c head/usr.bin/top/display.c head/usr.bin/top/machine.c head/usr.bin/top/machine.h head/usr.bin/top/top.c head/usr.bin/top/utils.c Modified: head/usr.bin/top/Makefile ============================================================================== --- head/usr.bin/top/Makefile Sat May 19 22:45:43 2018 (r333899) +++ head/usr.bin/top/Makefile Sat May 19 22:59:58 2018 (r333900) @@ -4,7 +4,7 @@ PROG= top SRCS= commands.c display.c machine.c screen.c top.c \ username.c utils.c version.c SRCS+= sigdesc.h top.local.h -CFLAGS+= -DHAVE_GETOPT -DHAVE_STRERROR -DORDER -I ${.OBJDIR} +CFLAGS+= -I ${.OBJDIR} MAN= top.1 WARNS?= 1 Modified: head/usr.bin/top/commands.c ============================================================================== --- head/usr.bin/top/commands.c Sat May 19 22:45:43 2018 (r333899) +++ head/usr.bin/top/commands.c Sat May 19 22:59:58 2018 (r333900) @@ -86,7 +86,6 @@ J - display processes for only one jail (+ selec k - kill processes; send a signal to a list of processes\n\ m - toggle the display between 'cpu' and 'io' modes\n\ n or # - change number of processes to display\n", stdout); -#ifdef ORDER if (displaymode == DISP_CPU) fputs("\ o - specify sort order (pri, size, res, cpu, time, threads, jid, pid)\n", @@ -95,7 +94,6 @@ o - specify sort order (pri, size, res, cpu, tim fputs("\ o - specify sort order (vcsw, ivcsw, read, write, fault, total, jid, pid)\n", stdout); -#endif fputs("\ P - toggle the displaying of per-CPU statistics\n\ r - renice a process\n\ Modified: head/usr.bin/top/display.c ============================================================================== --- head/usr.bin/top/display.c Sat May 19 22:45:43 2018 (r333899) +++ head/usr.bin/top/display.c Sat May 19 22:59:58 2018 (r333900) @@ -1220,7 +1220,6 @@ register char **names; register char *p; register int num; register char *thisname; - register int useM = No; char rbuf[6]; /* format each number followed by its string */ Modified: head/usr.bin/top/machine.c ============================================================================== --- head/usr.bin/top/machine.c Sat May 19 22:45:43 2018 (r333899) +++ head/usr.bin/top/machine.c Sat May 19 22:59:58 2018 (r333900) @@ -243,7 +243,6 @@ static int pageshift; /* log base 2 of the pagesize * /* useful externals */ long percentages(int cnt, int *out, long *new, long *old, long *diffs); -#ifdef ORDER /* * Sorting orders. The first element is the default. */ @@ -252,7 +251,6 @@ char *ordernames[] = { "total", "read", "write", "fault", "vcsw", "ivcsw", "jid", "swap", "pid", NULL }; -#endif /* Per-cpu time states */ static int maxcpu; @@ -400,9 +398,7 @@ machine_init(struct statics *statics, char do_unames) else statics->carc_names = NULL; statics->swap_names = swapnames; -#ifdef ORDER statics->order_names = ordernames; -#endif /* Allocate state for per-CPU stats. */ cpumask = 0; @@ -491,7 +487,6 @@ extern struct timeval timeout; void get_system_info(struct system_info *si) { - long total; struct loadavg sysload; int mib[2]; struct timeval boottime; @@ -1382,11 +1377,7 @@ static int sorted_state[] = { /* compare_cpu - the comparison function for sorting by cpu percentage */ int -#ifdef ORDER compare_cpu(void *arg1, void *arg2) -#else -proc_compare(void *arg1, void *arg2) -#endif { struct kinfo_proc *p1 = *(struct kinfo_proc **)arg1; struct kinfo_proc *p2 = *(struct kinfo_proc **)arg2; @@ -1401,7 +1392,6 @@ proc_compare(void *arg1, void *arg2) return (0); } -#ifdef ORDER /* "cpu" compare routines */ int compare_size(), compare_res(), compare_time(), compare_prio(), compare_threads(); @@ -1556,16 +1546,11 @@ compare_swap(const void *arg1, const void *arg2) return (0); } -#endif /* ORDER */ /* assorted comparison functions for sorting by i/o */ int -#ifdef ORDER compare_iototal(void *arg1, void *arg2) -#else -io_compare(void *arg1, void *arg2) -#endif { struct kinfo_proc *p1 = *(struct kinfo_proc **)arg1; struct kinfo_proc *p2 = *(struct kinfo_proc **)arg2; @@ -1573,7 +1558,6 @@ io_compare(void *arg1, void *arg2) return (get_io_total(p2) - get_io_total(p1)); } -#ifdef ORDER int compare_ioread(void *arg1, void *arg2) { @@ -1638,7 +1622,6 @@ compare_ivcsw(void *arg1, void *arg2) return (flp2 - flp1); } -#endif /* ORDER */ /* * proc_owner(pid) - returns the uid that owns process "pid", or -1 if Modified: head/usr.bin/top/machine.h ============================================================================== --- head/usr.bin/top/machine.h Sat May 19 22:45:43 2018 (r333899) +++ head/usr.bin/top/machine.h Sat May 19 22:59:58 2018 (r333900) @@ -23,9 +23,7 @@ struct statics char **arc_names; char **carc_names; char **swap_names; -#ifdef ORDER char **order_names; -#endif int ncpus; }; Modified: head/usr.bin/top/top.c ============================================================================== --- head/usr.bin/top/top.c Sat May 19 22:45:43 2018 (r333899) +++ head/usr.bin/top/top.c Sat May 19 22:59:58 2018 (r333900) @@ -105,12 +105,7 @@ char *ctime(); char *kill_procs(); char *renice_procs(); -#ifdef ORDER extern int (*compares[])(); -#else -extern int proc_compare(); -extern int io_compare(); -#endif time_t time(); caddr_t get_process_info(struct system_info *si, struct process_select *sel, @@ -281,10 +276,8 @@ char *argv[]; char *iptr; char no_command = 1; struct timeval timeout; -#ifdef ORDER char *order_name = NULL; int order_index = 0; -#endif #ifndef FD_SET /* FD_SET and friends are not present: fake it */ typedef int fd_set; @@ -293,11 +286,7 @@ char *argv[]; #endif fd_set readfds; -#ifdef ORDER static char command_chars[] = "\f qh?en#sdkriIutHmSCajzPJwo"; -#else - static char command_chars[] = "\f qh?en#sdkriIutHmSCajzPJw"; -#endif /* these defines enumerate the "strchr"s of the commands in command_chars */ #define CMD_redraw 0 #define CMD_update 1 @@ -326,9 +315,7 @@ char *argv[]; #define CMD_pcputog 23 #define CMD_jail 24 #define CMD_swaptog 25 -#ifdef ORDER #define CMD_order 26 -#endif /* set the buffer for stdout */ #ifdef DEBUG @@ -487,14 +474,7 @@ char *argv[]; break; case 'o': /* select sort order */ -#ifdef ORDER order_name = optarg; -#else - fprintf(stderr, - "%s: this platform does not support arbitrary ordering. Sorry.\n", - myname); - warnings++; -#endif break; case 't': @@ -582,7 +562,6 @@ char *argv[]; exit(1); } -#ifdef ORDER /* determine sorting order index, if necessary */ if (order_name != NULL) { @@ -602,7 +581,6 @@ char *argv[]; exit(1); } } -#endif #ifdef no_initialization_needed /* initialize the hashing stuff */ @@ -715,14 +693,7 @@ restart: /* get the current stats */ get_system_info(&system_info); -#ifdef ORDER compare = compares[order_index]; -#else - if (displaymode == DISP_CPU) - compare = proc_compare; - else - compare = io_compare; -#endif /* get the current set of processes */ processes = @@ -1144,7 +1115,6 @@ restart: case CMD_showargs: fmt_flags ^= FMT_SHOWARGS; break; -#ifdef ORDER case CMD_order: new_message(MT_standout, "Order to sort: "); @@ -1167,7 +1137,6 @@ restart: clear_message(); } break; -#endif case CMD_jidtog: ps.jail = !ps.jail; new_message(MT_standout | MT_delayed, Modified: head/usr.bin/top/utils.c ============================================================================== --- head/usr.bin/top/utils.c Sat May 19 22:45:43 2018 (r333899) +++ head/usr.bin/top/utils.c Sat May 19 22:59:58 2018 (r333900) @@ -337,32 +337,17 @@ long *diffs; /* externs referenced by errmsg */ -#ifndef HAVE_STRERROR -#ifndef SYS_ERRLIST_DECLARED -#define SYS_ERRLIST_DECLARED -extern char *sys_errlist[]; -#endif -extern int sys_nerr; -#endif - char *errmsg(errnum) int errnum; { -#ifdef HAVE_STRERROR char *msg = strerror(errnum); if (msg != NULL) { return msg; } -#else - if (errnum > 0 && errnum < sys_nerr) - { - return((char *)sys_errlist[errnum]); - } -#endif return("No error"); }