Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Jun 2006 12:34:17 +0800 (CST)
From:      Gea-Suan Lin <gslin@csie.nctu.edu.tw>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        gslin@csie.nctu.edu.tw
Subject:   bin/98693: Reduce NIS server loading
Message-ID:  <200606080434.k584YHNK015480@ccbsd3.csie.nctu.edu.tw>
Resent-Message-ID: <200606080710.k587ABou009369@freefall.freebsd.org>

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

>Number:         98693
>Category:       bin
>Synopsis:       Reduce NIS server loading
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jun 08 07:10:11 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Gea-Suan Lin
>Release:        FreeBSD 6.1-STABLE i386
>Organization:
>Environment:
System: FreeBSD ccbsd3.csie.nctu.edu.tw 6.1-STABLE FreeBSD 6.1-STABLE #2: Thu Jun 8 06:24:03 CST 2006 root@ccbsd3.csie.nctu.edu.tw:/usr/obj/usr/src/sys/CCBSD3 i386


	
>Description:
	
If there are a lot of users (> 10k) in NIS, then running top causes
NIS server high load.

>How-To-Repeat:
	
>Fix:
	

--- /usr/src/usr.bin/top/machine.c	Wed May 18 21:42:51 2005
+++ machine.c	Thu Jun  8 12:32:56 2006
@@ -62,7 +62,7 @@
 int swapmode(int *retavail, int *retfree);
 static int smpmode;
 enum displaymodes displaymode;
-static int namelength = 8;
+static int namelength = UPUNAMELEN;
 static int cmdlengthdelta;
 
 /* Prototypes for top internals */
@@ -235,14 +235,8 @@
 	    modelen != sizeof(smpmode))
 		smpmode = 0;
 
-	while ((pw = getpwent()) != NULL) {
-		if (strlen(pw->pw_name) > namelength)
-			namelength = strlen(pw->pw_name);
-	}
 	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)
>Release-Note:
>Audit-Trail:
>Unformatted:



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