diff options
Diffstat (limited to 'usr.bin/top')
-rw-r--r-- | usr.bin/top/display.c | 6 | ||||
-rw-r--r-- | usr.bin/top/machine.c | 15 | ||||
-rw-r--r-- | usr.bin/top/top.c | 9 |
3 files changed, 9 insertions, 21 deletions
diff --git a/usr.bin/top/display.c b/usr.bin/top/display.c index 1b63407a62e..e8ed5fd24a8 100644 --- a/usr.bin/top/display.c +++ b/usr.bin/top/display.c @@ -1,4 +1,4 @@ -/* $OpenBSD: display.c,v 1.14 2003/06/13 21:52:24 deraadt Exp $ */ +/* $OpenBSD: display.c,v 1.15 2003/06/18 08:36:31 deraadt Exp $ */ /* * Top users/processes display for Unix @@ -91,11 +91,9 @@ static char **memory_names; static int num_procstates; static int num_cpustates; -static int num_memory; static int *lprocstates; static int *lcpustates; -static int *lmemory; static int *cpustate_columns; static int cpustate_total_length; @@ -158,8 +156,6 @@ display_init(struct statics * statics) cpustate_columns = (int *) malloc(num_cpustates * sizeof(int)); memory_names = statics->memory_names; - num_memory = string_count(memory_names); - lmemory = (int *) malloc(num_memory * sizeof(int)); /* calculate starting columns where needed */ cpustate_total_length = 0; diff --git a/usr.bin/top/machine.c b/usr.bin/top/machine.c index ad1ceceb849..fdcd85ee70a 100644 --- a/usr.bin/top/machine.c +++ b/usr.bin/top/machine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machine.c,v 1.34 2003/06/17 00:51:29 jfb Exp $ */ +/* $OpenBSD: machine.c,v 1.35 2003/06/18 08:36:31 deraadt Exp $ */ /*- * Copyright (c) 1994 Thorsten Lockert <tholo@sigmasoft.com> @@ -216,25 +216,22 @@ get_system_info(struct system_info *si) struct loadavg sysload; struct vmtotal vmtotal; double *infoloadp; - int total, i; size_t size; + int i; size = sizeof(cp_time); - if (sysctl(cp_time_mib, 2, &cp_time, &size, NULL, 0) < 0) { + if (sysctl(cp_time_mib, 2, &cp_time, &size, NULL, 0) < 0) warn("sysctl kern.cp_time failed"); - total = 0; - } + size = sizeof(sysload); - if (sysctl(sysload_mib, 2, &sysload, &size, NULL, 0) < 0) { + if (sysctl(sysload_mib, 2, &sysload, &size, NULL, 0) < 0) warn("sysctl failed"); - total = 0; - } infoloadp = si->load_avg; for (i = 0; i < 3; i++) *infoloadp++ = ((double) sysload.ldavg[i]) / sysload.fscale; /* convert cp_time counts to percentages */ - total = percentages(CPUSTATES, cpu_states, cp_time, cp_old, cp_diff); + (void) percentages(CPUSTATES, cpu_states, cp_time, cp_old, cp_diff); /* get total -- systemwide main memory usage structure */ size = sizeof(vmtotal); diff --git a/usr.bin/top/top.c b/usr.bin/top/top.c index 4945313afef..376623f02f9 100644 --- a/usr.bin/top/top.c +++ b/usr.bin/top/top.c @@ -1,4 +1,4 @@ -/* $OpenBSD: top.c,v 1.23 2003/06/16 17:24:44 millert Exp $ */ +/* $OpenBSD: top.c,v 1.24 2003/06/18 08:36:31 deraadt Exp $ */ /* * Top users/processes display for Unix @@ -37,7 +37,6 @@ const char copyright[] = "Copyright (c) 1984 through 1996, William LeFebvre #include <stdio.h> #include <ctype.h> #include <signal.h> -#include <setjmp.h> #include <string.h> #include <stdlib.h> #include <unistd.h> @@ -74,12 +73,8 @@ volatile sig_atomic_t winchflag; static void reset_display(void); int rundisplay(void); -/* values which need to be accessed by signal handlers */ static int max_topn; /* maximum displayable processes */ -/* miscellaneous things */ -jmp_buf jmp_int; - extern int (*proc_compares[])(const void *, const void *); int order_index; @@ -101,7 +96,7 @@ char warnings = 0; double delay = Default_DELAY; char *order_name = NULL; int topn = Default_TOPN; -int no_command = 1; +int no_command = Yes; #if Default_TOPN == Infinity char topn_specified = No; |