Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 17 Mar 2001 10:02:16 +0000
From:      David Malone <dwmalone@maths.tcd.ie>
To:        Brooks Davis <brooks@one-eyed-alien.net>
Cc:        Alex Zepeda <jazepeda@pacbell.net>, current@FreeBSD.ORG, mckusick@FreeBSD.ORG
Subject:   Re: very strange problem with ps
Message-ID:  <20010317100216.A24957@walton.maths.tcd.ie>
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
References:  <20010316181229.A16230@Odin.AC.HMC.Edu> <20010316181737.A3151@zippy.mybox.zip> <20010316182146.A17633@Odin.AC.HMC.Edu>

next in thread | previous in thread | raw e-mail | index | archive | help
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




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