From c48987263d3f55042a1e5d0c5e8411ed21161f2d Mon Sep 17 00:00:00 2001 From: dwmalone Date: Thu, 24 Jan 2002 17:58:42 +0000 Subject: Resolve conflicts. --- contrib/top/display.c | 8 ++++---- contrib/top/machine.h | 12 +++++++++++- contrib/top/utils.c | 30 +++++++++++++++++++++++++----- 3 files changed, 40 insertions(+), 10 deletions(-) (limited to 'contrib/top') diff --git a/contrib/top/display.c b/contrib/top/display.c index 2a39072..22a940a 100644 --- a/contrib/top/display.c +++ b/contrib/top/display.c @@ -164,9 +164,9 @@ struct statics *statics; ip = cpustate_columns; while (*pp != NULL) { + *ip++ = cpustate_total_length; if ((i = strlen(*pp++)) > 0) { - *ip++ = cpustate_total_length; cpustate_total_length += i + 8; } } @@ -279,7 +279,7 @@ time_t *tod; } static int ltotal = 0; -static char procstates_buffer[128]; +static char procstates_buffer[MAX_COLS]; /* * *_procstates(total, brkdn, names) - print the process summary line @@ -321,7 +321,7 @@ int total; int *brkdn; { - static char new[128]; + static char new[MAX_COLS]; register int i; /* update number of processes only if it has changed */ @@ -467,7 +467,7 @@ register int *states; ((double)value)/10.); /* remember it for next time */ - *lp = *states; + *lp = value; } } diff --git a/contrib/top/machine.h b/contrib/top/machine.h index 0f14bf3..4f4f6af 100644 --- a/contrib/top/machine.h +++ b/contrib/top/machine.h @@ -1,4 +1,8 @@ /* + * $FreeBSD$ + */ + +/* * This file defines the interface between top and the machine-dependent * module. It is NOT machine dependent and should not need to be changed * for any specific machine. @@ -22,12 +26,18 @@ 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_ACTIVE; /* number of procs considered "active" */ int *procstates; int *cpustates; int *memory; diff --git a/contrib/top/utils.c b/contrib/top/utils.c index 94233de..906170a 100644 --- a/contrib/top/utils.c +++ b/contrib/top/utils.c @@ -7,6 +7,8 @@ * * Copyright (c) 1984, 1989, William LeFebvre, Rice University * Copyright (c) 1989, 1990, 1992, William LeFebvre, Northwestern University + * + * $FreeBSD$ */ /* @@ -324,24 +326,42 @@ long *diffs; /* * errmsg(errnum) - return an error message string appropriate to the * error number "errnum". This is a substitute for the System V - * function "strerror" with one important difference: the string - * returned by this function does NOT end in a newline! - * N.B.: there appears to be no reliable way to determine if - * "strerror" exists at compile time, so I make do by providing - * something of similar functionality. + * function "strerror". There appears to be no reliable way to + * determine if "strerror" exists at compile time, so I make do + * by providing something of similar functionality. For those + * systems that have strerror and NOT errlist, define + * -DHAVE_STRERROR in the module file and this function will + * use strerror. */ /* 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"); } -- cgit v1.1