Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 9 Jan 2008 12:15:25 -0500
From:      "David Frascone" <dave@frascone.com>
To:        freebsd-current@freebsd.org
Subject:   Small patch to fix top in large NIS environments
Message-ID:  <9cf5ced20801090915i3df2d4a1lc057a38b20fc5ac2@mail.gmail.com>

next in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
The -u flag to top is supposed to limit uid lookups.  But, it was still
spinning through the entire password database with while (getpwent()).  At
Cisco, which has a fairly large NIS database, this takes forever, and top
never starts.

I filed this bug to address it:
http://www.freebsd.org/cgi/query-pr.cgi?pr=119490

The attached patch fixes it.  This is my first submission, so let me know if
this is the proper order, etc, to post the patches (i.e. file the bug, the
post a fix)

-Dave

[-- Attachment #2 --]
Index: usr.bin/top/machine.c
===================================================================
RCS file: /usr/FreeBSD/cvsup/src/usr.bin/top/machine.c,v
retrieving revision 1.83
diff -r1.83 machine.c
226c226
< machine_init(struct statics *statics)
---
> machine_init(struct statics *statics, char do_unames)
240c240,241
< 	while ((pw = getpwent()) != NULL) {
---
> 	if (do_unames) {
> 	    while ((pw = getpwent()) != NULL) {
242a244
> 	    }
Index: contrib/top/top.c
===================================================================
RCS file: /usr/FreeBSD/cvsup/src/contrib/top/top.c,v
retrieving revision 1.23
diff -r1.23 top.c
453c453
<     if (machine_init(&statics) == -1)
---
>     if (machine_init(&statics, do_unames) == -1)

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9cf5ced20801090915i3df2d4a1lc057a38b20fc5ac2>