threads/91044: [patch] ps reports zombie process as having RE state, shall be Z

Kostik Belousov kostikbel at
Thu Dec 29 01:20:05 PST 2005

>Number:         91044
>Category:       threads
>Synopsis:       [patch] ps reports zombie process as having RE state, shall be Z
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-threads
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Dec 29 09:20:03 GMT 2005
>Originator:     Kostik Belousov
>Release:        6.0-STABLE
FreeBSD 6.0-STABLE FreeBSD 6.0-STABLE #34: Wed Nov  2 11:48:22 EET 2005     root at  i386
Revision 1.232 of the sys/kern/kern_proc.c introduced fill_kinfo_thread and
fill_kinfo_proc_only separation for sysctl reporting process data. This introduced
the buglet where SZOMB status for zombie processes filled in the fk_proc_only,
and overwritten in the fk_thread with SIDL. As result, zombies are reported as
live processes.

I propose the attached patch to put them in the grave in the ps output.
              do a ps auxww and watch for zombies
Index: sys/kern/kern_proc.c
RCS file: /usr/local/arch/ncvs/src/sys/kern/kern_proc.c,v
retrieving revision 1.235
diff -u -r1.235 kern_proc.c
--- sys/kern/kern_proc.c        13 Nov 2005 13:27:44 -0000      1.235
+++ sys/kern/kern_proc.c        29 Dec 2005 09:08:42 -0000
@@ -789,6 +789,8 @@
                } else {
                        kp->ki_stat = SWAIT;
+       } else if (p->p_state == PRS_ZOMBIE) {
+               kp->ki_stat = SZOMB;
        } else {
                kp->ki_stat = SIDL;


More information about the freebsd-threads mailing list