Subject: bin/23713: /bin/ps displays wrong idle(I) state
To: None <gnats-bugs@gnats.netbsd.org>
From: None <joff@stchome.com>
List: netbsd-bugs
Date: 12/10/2003 15:05:16
>Number:         23713
>Category:       bin
>Synopsis:       /bin/ps displays wrong idle(I) state
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Dec 10 22:06:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     
>Release:        NetBSD 1.6.1_STABLE
>Organization:
	
>Environment:
System: NetBSD angel 1.6.1_STABLE NetBSD 1.6.1_STABLE (DELL600SC) #4: Thu Oct 23 12:11:13 MST 2003 joff@angel:/usr/src/sys/arch/i386/compile/DELL600SC i386
Architecture: i386
Machine: i386
>Description:
	ps should display an "I" on the state if the process has
	been idle for more than vm.maxslp seconds.  It only displays
	an "I" if the process has been idle for more than 127
	seconds
>How-To-Repeat:
	do a "ps aux -O sl".  Notice that for SL (sleep time) >
	20, no "I" is displayed.
>Fix:
	nlist.c, donlist_sysctl() overwrites maxslp with vm.uspace
	with what looks like a cut-n-paste error on the original
	code of nlist.c

Index: nlist.c
===================================================================
RCS file: /cvsroot/src/bin/ps/nlist.c,v
retrieving revision 1.18
diff -u -r1.18 nlist.c
--- nlist.c	2001/07/14 06:53:44	1.18
+++ nlist.c	2003/12/10 22:04:31
@@ -192,8 +192,8 @@
 
 	mib[0] = CTL_VM;
 	mib[1] = VM_USPACE;
-	size = sizeof(maxslp);
-	if (sysctl(mib, 2, &maxslp, &size, NULL, 0) == -1)
+	size = sizeof(uspace);
+	if (sysctl(mib, 2, &uspace, &size, NULL, 0) == -1)
 #ifdef USPACE
 		uspace = USPACE;
 #else
>Release-Note:
>Audit-Trail:
>Unformatted: