From owner-freebsd-threads@FreeBSD.ORG Thu Feb 12 09:10:51 2004 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7C6DA16A4CE; Thu, 12 Feb 2004 09:10:51 -0800 (PST) Received: from rwcrmhc12.comcast.net (rwcrmhc12.comcast.net [216.148.227.85]) by mx1.FreeBSD.org (Postfix) with ESMTP id 731E243D1D; Thu, 12 Feb 2004 09:10:51 -0800 (PST) (envelope-from rodrigc@crodrigues.org) Received: from h00609772adf0.ne.client2.attbi.com ([66.31.45.197]) by comcast.net (rwcrmhc12) with ESMTP id <20040212171050014002v0moe>; Thu, 12 Feb 2004 17:10:50 +0000 Received: from h00609772adf0.ne.client2.attbi.com (localhost.crodrigues.org [127.0.0.1])i1CHB2hd072846; Thu, 12 Feb 2004 12:11:02 -0500 (EST) (envelope-from rodrigc@h00609772adf0.ne.client2.attbi.com) Received: (from rodrigc@localhost)i1CHB2US072845; Thu, 12 Feb 2004 12:11:02 -0500 (EST) (envelope-from rodrigc) Date: Thu, 12 Feb 2004 12:11:01 -0500 From: Craig Rodrigues To: freebsd-threads@freebsd.org Message-ID: <20040212171101.GA72641@crodrigues.org> References: <402B03B7.1000104@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.1i cc: deischen@freebsd.org cc: scottl@freebsd.org Subject: Re: Should ps -p list threads? X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Feb 2004 17:10:51 -0000 On Thu, Feb 12, 2004 at 11:16:57AM -0500, Daniel Eischen wrote: > But 'ps' without -H seems to display KSEs where it shouldn't. I looked in the source code of ps, specifically in src/bin/ps/ps.c If you type just 'ps', this code gets executed in ps.c: 351 if (nuids == 1) { 352 what = KERN_PROC_UID; 353 flag = *uids; 354 } 371 if ((kp = kvm_getprocs(kd, what, flag, &nentries)) == 0 || nentr ies < 0) 372 errx(1, "%s", kvm_geterr(kd)); If you type 'ps -H', this code gets executed in ps.c: 194 case 'H': 195 showthreads = 1; 196 break; 351 if (nuids == 1) { 352 what = KERN_PROC_UID; 353 flag = *uids; 371 if ((kp = kvm_getprocs(kd, what, flag, &nentries)) == 0 || nentries < 0) 372 errx(1, "%s", kvm_geterr(kd)); So, I am not sure if this is a bug in kvm_getprocs() or in ps.c, but the result is that if you type ps or ps -H, they both display KSEs. Probably just typing ps should not display them. Any idea what the problem is? -- Craig Rodrigues http://crodrigues.org rodrigc@crodrigues.org