kvm_proclist: gnore processes in PRS_NEW

Andriy Gapon avg at FreeBSD.org
Wed Oct 3 16:37:09 UTC 2012


I believe that the following patch does the right thing that is repeated in a few
other places.
I would like to ask for a review just in case.

commit cf0f573a1dcbc09cb8fce612530afeeb7f1b1c62
Author: Andriy Gapon <avg at icyb.net.ua>
Date:   Sun Sep 23 22:49:26 2012 +0300

    kvm_proc: ignore processes in larvae state

diff --git a/lib/libkvm/kvm_proc.c b/lib/libkvm/kvm_proc.c
index 8fc415c..d1daf77 100644
--- a/lib/libkvm/kvm_proc.c
+++ b/lib/libkvm/kvm_proc.c
@@ -144,6 +144,8 @@ kvm_proclist(kvm_t *kd, int what, int arg, struct proc *p,
 			_kvm_err(kd, kd->program, "can't read proc at %p", p);
 			return (-1);
 		}
+		if (proc.p_state == PRS_NEW)
+			continue;
 		if (proc.p_state != PRS_ZOMBIE) {
 			if (KREAD(kd, (u_long)TAILQ_FIRST(&proc.p_threads),
 			    &mtd)) {

-- 
Andriy Gapon


More information about the freebsd-hackers mailing list