... 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 [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to