Date: Mon, 21 May 2018 04:40:20 +0000 (UTC) From: Eitan Adler <eadler@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r333962 - head/usr.bin/top Message-ID: <201805210440.w4L4eKCh001684@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 <sys/fixpoint.h> # 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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201805210440.w4L4eKCh001684>