Date: Fri, 7 Sep 2001 16:34:06 +0200 From: Thomas Quinot <thomas@cuivre.fr.eu.org> To: current@freebsd.org Subject: top(1) takes ages to start up Message-ID: <20010907163406.A18904@melusine.cuivre.fr.eu.org>
next in thread | raw e-mail | index | archive | help
... because it walks through the entire NIS db just to find out what the
longest user name is (/src/usr.bin/top/machine.c 1.5). At this site,
this means 2800 RPC calls and dozens of seconds when the network and/or
NIS server are busy.
What do others think of the following patch?
Thomas.
--- machine.c.dist Fri Jun 1 00:36:51 2001
+++ machine.c Fri Sep 7 16:31:45 2001
@@ -212,7 +212,7 @@
sysctlbyname("kern.smp.active", &smpmode, &modelen, NULL, 0) < 0) ||
modelen != sizeof(smpmode))
smpmode = 0;
-
+#ifndef NO_GETPWENT
while ((pw = getpwent()) != NULL) {
if (strlen(pw->pw_name) > namelength)
namelength = strlen(pw->pw_name);
@@ -223,6 +223,9 @@
namelength = 13;
else if (namelength > 15)
namelength = 15;
+#else
+ namelength = 8;
+#endif
if ((kd = kvm_open("/dev/null", "/dev/null", "/dev/null", O_RDONLY, "kvm_open")) == NULL)
return -1;
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010907163406.A18904>
