summaryrefslogtreecommitdiffstats
path: root/usr.bin/top
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2005-05-16 18:17:38 +0000
committerobrien <obrien@FreeBSD.org>2005-05-16 18:17:38 +0000
commit4689881298440ff8bfc1ac82cdd0c45934bc2c93 (patch)
treebddb92444f5df183752f4d0086918e8966ebe1e7 /usr.bin/top
parent30c28c4860bdfd56962b842b52db06c033e6be31 (diff)
downloadFreeBSD-src-4689881298440ff8bfc1ac82cdd0c45934bc2c93.zip
FreeBSD-src-4689881298440ff8bfc1ac82cdd0c45934bc2c93.tar.gz
Hardcode username to 8 characters. This makes top(1) output sane when
there are users on the system (even if not running a single process) with a login > 8 chars. I'm not all that happy limiting the username width like this, but it restores sanity to top(1) output. Discussed with: keramida
Diffstat (limited to 'usr.bin/top')
-rw-r--r--usr.bin/top/machine.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/usr.bin/top/machine.c b/usr.bin/top/machine.c
index 4aebd2c..070ac87 100644
--- a/usr.bin/top/machine.c
+++ b/usr.bin/top/machine.c
@@ -54,13 +54,15 @@
static void getsysctl(char *, void *, size_t);
#define GETSYSCTL(name, var) getsysctl(name, &(var), sizeof(var))
+#define SMPUNAMELEN 13
+#define UPUNAMELEN 15
extern struct process_select ps;
extern char* printable(char *);
int swapmode(int *retavail, int *retfree);
static int smpmode;
enum displaymodes displaymode;
-static int namelength;
+static int namelength = 8;
static int cmdlengthdelta;
/* Prototypes for top internals */
@@ -237,12 +239,10 @@ machine_init(struct statics *statics)
if (strlen(pw->pw_name) > namelength)
namelength = strlen(pw->pw_name);
}
- if (namelength < 8)
- namelength = 8;
- if (smpmode && namelength > 13)
- namelength = 13;
- else if (namelength > 15)
- namelength = 15;
+ if (smpmode && namelength > SMPUNAMELEN)
+ namelength = SMPUNAMELEN;
+ else if (namelength > UPUNAMELEN)
+ namelength = UPUNAMELEN;
kd = kvm_open(NULL, _PATH_DEVNULL, NULL, O_RDONLY, "kvm_open");
if (kd == NULL)
OpenPOWER on IntegriCloud