From owner-svn-src-all@freebsd.org Mon May 21 04:40:22 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 D2DFFEE24EC; Mon, 21 May 2018 04:40:21 +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 836276BF63; Mon, 21 May 2018 04:40:21 +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 61514202EC; Mon, 21 May 2018 04:40:21 +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 w4L4eLdG001689; Mon, 21 May 2018 04:40:21 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4L4eKCh001684; Mon, 21 May 2018 04:40:20 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201805210440.w4L4eKCh001684@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 04:40:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r333962 - 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: 333962 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 04:40:22 -0000 Author: eadler Date: Mon May 21 04:40:20 2018 New Revision: 333962 URL: https://svnweb.freebsd.org/changeset/base/333962 Log: top(1): further unconditionally assume we're on FreeBSD Modified: head/usr.bin/top/loadavg.h head/usr.bin/top/machine.c head/usr.bin/top/machine.h head/usr.bin/top/top.c Modified: head/usr.bin/top/loadavg.h ============================================================================== --- head/usr.bin/top/loadavg.h Mon May 21 04:32:14 2018 (r333961) +++ head/usr.bin/top/loadavg.h Mon May 21 04:40:20 2018 (r333962) @@ -10,6 +10,8 @@ * * loaddouble(la) - convert load_avg to double. * intload(i) - convert integer to load_avg. + * + * $FreeBSD$ */ /* @@ -19,39 +21,19 @@ * * Defined types: load_avg for load averages, pctcpu for cpu percentages. */ -#if defined(__mips__) && !(defined(__NetBSD__) || defined(__FreeBSD__)) +#if defined(__mips__) && defined(__FreeBSD__) # include # if defined(FBITS) && !defined(FSCALE) # define FSCALE (1 << FBITS) /* RISC/os on mips */ # endif #endif -#ifdef FSCALE -# define FIXED_LOADAVG FSCALE -# define FIXED_PCTCPU FSCALE -#endif +#define FIXED_LOADAVG FSCALE +#define FIXED_PCTCPU FSCALE -#ifdef ibm032 -# undef FIXED_LOADAVG -# undef FIXED_PCTCPU -# define FIXED_PCTCPU PCT_SCALE -#endif +typedef long pctcpu; +#define pctdouble(p) ((double)(p) / FIXED_PCTCPU) - -#ifdef FIXED_PCTCPU - typedef long pctcpu; -# define pctdouble(p) ((double)(p) / FIXED_PCTCPU) -#else -typedef double pctcpu; -# define pctdouble(p) (p) -#endif - -#ifdef FIXED_LOADAVG - typedef fixpt_t load_avg; -# define loaddouble(la) ((double)(la) / FIXED_LOADAVG) -# define intload(i) ((int)((i) * FIXED_LOADAVG)) -#else - typedef double load_avg; -# define loaddouble(la) (la) -# define intload(i) ((double)(i)) -#endif +typedef fixpt_t load_avg; +#define loaddouble(la) ((double)(la) / FIXED_LOADAVG) +#define intload(i) ((int)((i) * FIXED_LOADAVG)) Modified: head/usr.bin/top/machine.c ============================================================================== --- head/usr.bin/top/machine.c Mon May 21 04:32:14 2018 (r333961) +++ head/usr.bin/top/machine.c Mon May 21 04:40:20 2018 (r333962) @@ -905,7 +905,7 @@ get_process_info(struct system_info *si, struct proces /* remember active and total counts */ si->p_total = total_procs; - si->p_active = pref_len = active_procs; + si->p_pactive = pref_len = active_procs; /* pass back a handle */ handle.next_proc = pref; Modified: head/usr.bin/top/machine.h ============================================================================== --- head/usr.bin/top/machine.h Mon May 21 04:32:14 2018 (r333961) +++ head/usr.bin/top/machine.h Mon May 21 04:40:20 2018 (r333962) @@ -31,18 +31,12 @@ struct statics * the system_info struct is filled in by a machine dependent routine. */ -#ifdef p_active /* uw7 define macro p_active */ -#define P_ACTIVE p_pactive -#else -#define P_ACTIVE p_active -#endif - struct system_info { int last_pid; double load_avg[NUM_AVERAGES]; int p_total; - int P_ACTIVE; /* number of procs considered "active" */ + int p_pactive; /* number of procs considered "active" */ int *procstates; int *cpustates; int *memory; Modified: head/usr.bin/top/top.c ============================================================================== --- head/usr.bin/top/top.c Mon May 21 04:32:14 2018 (r333961) +++ head/usr.bin/top/top.c Mon May 21 04:40:20 2018 (r333962) @@ -403,7 +403,7 @@ char *argv[]; if (getuid() == 0) { /* be very un-nice! */ - (void) nice(-20); + nice(-20); } else { @@ -589,25 +589,13 @@ char *argv[]; } /* hold interrupt signals while setting up the screen and the handlers */ -#ifdef SIGHOLD - sighold(SIGINT); - sighold(SIGQUIT); - sighold(SIGTSTP); -#else old_sigmask = sigblock(Smask(SIGINT) | Smask(SIGQUIT) | Smask(SIGTSTP)); -#endif init_screen(); signal(SIGINT, leave); signal(SIGQUIT, leave); signal(SIGTSTP, tstop); signal(SIGWINCH, top_winch); -#ifdef SIGRELSE - sigrelse(SIGINT); - sigrelse(SIGQUIT); - sigrelse(SIGTSTP); -#else - (void) sigsetmask(old_sigmask); -#endif + sigsetmask(old_sigmask); if (warnings) { fputs("....", stderr); @@ -689,7 +677,7 @@ restart: /* determine number of processes to actually display */ /* this number will be the smallest of: active processes, number user requested, number current screen accomodates */ - active_procs = system_info.P_ACTIVE; + active_procs = system_info.p_pactive; if (active_procs > topn) { active_procs = topn; @@ -779,18 +767,14 @@ restart: fflush(stdout); /* default the signal handler action */ - (void) signal(SIGTSTP, SIG_DFL); + signal(SIGTSTP, SIG_DFL); /* unblock the signal and send ourselves one */ -#ifdef SIGRELSE - sigrelse(SIGTSTP); -#else - (void) sigsetmask(sigblock(0) & ~(1 << (SIGTSTP - 1))); -#endif - (void) kill(0, SIGTSTP); + sigsetmask(sigblock(0) & ~(1 << (SIGTSTP - 1))); + kill(0, SIGTSTP); /* reset the signal handler */ - (void) signal(SIGTSTP, tstop); + signal(SIGTSTP, tstop); /* reinit screen */ reinit_screen(); @@ -807,7 +791,7 @@ restart: max_topn = display_resize(); /* reset the signal handler */ - (void) signal(SIGWINCH, top_winch); + signal(SIGWINCH, top_winch); reset_display(); winchflag = 0; @@ -885,7 +869,7 @@ restart: show_help(); top_standout("Hit any key to continue: "); fflush(stdout); - (void) read(0, &ch, 1); + read(0, &ch, 1); break; case CMD_errors: /* show errors */ @@ -903,7 +887,7 @@ restart: show_errors(); top_standout("Hit any key to continue: "); fflush(stdout); - (void) read(0, &ch, 1); + read(0, &ch, 1); } break;