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 [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to