From owner-freebsd-current Sat Mar 17 2: 2:25 2001 Delivered-To: freebsd-current@freebsd.org Received: from salmon.maths.tcd.ie (salmon.maths.tcd.ie [134.226.81.11]) by hub.freebsd.org (Postfix) with SMTP id 09F2637B71A; Sat, 17 Mar 2001 02:02:18 -0800 (PST) (envelope-from dwmalone@maths.tcd.ie) Received: from walton.maths.tcd.ie by salmon.maths.tcd.ie with SMTP id ; 17 Mar 2001 10:02:17 +0000 (GMT) Date: Sat, 17 Mar 2001 10:02:16 +0000 From: David Malone To: Brooks Davis Cc: Alex Zepeda , current@FreeBSD.ORG, mckusick@FreeBSD.ORG Subject: Re: very strange problem with ps Message-ID: <20010317100216.A24957@walton.maths.tcd.ie> References: <20010316181229.A16230@Odin.AC.HMC.Edu> <20010316181737.A3151@zippy.mybox.zip> <20010316182146.A17633@Odin.AC.HMC.Edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20010316182146.A17633@Odin.AC.HMC.Edu>; from brooks@one-eyed-alien.net on Fri, Mar 16, 2001 at 06:21:46PM -0800 Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Fri, Mar 16, 2001 at 06:21:46PM -0800, Brooks Davis wrote: > Ah, you are correct. I should have tried that. What a strange bug. It happens for any option which causes the sysctl to return no processes to libkvm. (Try ps -p 100000). I think the following patch should fix the problem. (Kirk changed the way the struct proc size was checked, and the old way happened to work OK if no data was returned. Kirk, should I go ahead and commit this?) David. Index: kvm_proc.c =================================================================== RCS file: /cvs/FreeBSD-CVS/src/lib/libkvm/kvm_proc.c,v retrieving revision 1.32 diff -u -r1.32 kvm_proc.c --- kvm_proc.c 2001/02/12 00:21:09 1.32 +++ kvm_proc.c 2001/03/17 09:54:16 @@ -403,7 +403,8 @@ _kvm_syserr(kd, kd->program, "kvm_getprocs"); return (0); } - if (kd->procbase->ki_structsize != sizeof(struct kinfo_proc)) { + if (size > 0 && + kd->procbase->ki_structsize != sizeof(struct kinfo_proc)) { _kvm_err(kd, kd->program, "kinfo_proc size mismatch (expected %d, got %d)", sizeof(struct kinfo_proc), To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message