diff options
author | obrien <obrien@FreeBSD.org> | 2008-01-09 18:06:24 +0000 |
---|---|---|
committer | obrien <obrien@FreeBSD.org> | 2008-01-09 18:06:24 +0000 |
commit | 2678039b69f7517dbbf73d17d7ea669e22803e3f (patch) | |
tree | 7227af220d557c3c92c71e07a629431802e4950c /usr.bin/top | |
parent | 915a8d4b134243c662cac1c12ddcbfb987316dd5 (diff) | |
download | FreeBSD-src-2678039b69f7517dbbf73d17d7ea669e22803e3f.zip FreeBSD-src-2678039b69f7517dbbf73d17d7ea669e22803e3f.tar.gz |
Improve -u (limit uid lookups) behavior.
Submitted by: David Frascone <dave@frascone.com>
PR: 119490
Diffstat (limited to 'usr.bin/top')
-rw-r--r-- | usr.bin/top/machine.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/usr.bin/top/machine.c b/usr.bin/top/machine.c index cc12705..d6fa14c 100644 --- a/usr.bin/top/machine.c +++ b/usr.bin/top/machine.c @@ -60,7 +60,11 @@ extern struct process_select ps; extern char* printable(char *); static int smpmode; enum displaymodes displaymode; +#ifdef TOP_USERNAME_LEN +static int namelength = TOP_USERNAME_LEN; +#else static int namelength = 8; +#endif static int cmdlengthdelta; /* Prototypes for top internals */ @@ -223,7 +227,7 @@ static void getsysctl(const char *name, void *ptr, size_t len); static int swapmode(int *retavail, int *retfree); int -machine_init(struct statics *statics) +machine_init(struct statics *statics, char do_unames) { int pagesize; size_t modelen; @@ -237,9 +241,11 @@ machine_init(struct statics *statics) modelen != sizeof(smpmode)) smpmode = 0; - while ((pw = getpwent()) != NULL) { + if (do_unames) { + while ((pw = getpwent()) != NULL) { if (strlen(pw->pw_name) > namelength) namelength = strlen(pw->pw_name); + } } if (smpmode && namelength > SMPUNAMELEN) namelength = SMPUNAMELEN; |