From owner-freebsd-bugs Thu Dec 19 08:15:41 1996 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.4/8.8.4) id IAA28355 for bugs-outgoing; Thu, 19 Dec 1996 08:15:41 -0800 (PST) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by freefall.freebsd.org (8.8.4/8.8.4) with ESMTP id IAA28350 for ; Thu, 19 Dec 1996 08:15:38 -0800 (PST) Received: (from bde@localhost) by godzilla.zeta.org.au (8.8.3/8.6.9) id DAA16359 for bugs@freebsd.org; Fri, 20 Dec 1996 03:15:29 +1100 Date: Fri, 20 Dec 1996 03:15:29 +1100 From: Bruce Evans Message-Id: <199612191615.DAA16359@godzilla.zeta.org.au> To: bugs@freebsd.org Subject: On speaking to the undead Sender: owner-bugs@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Should signals be sent (using kill()) to zombie processes or to process groups containing only zombie processes? I think so. NIST-PCTS tests that signal 0 can be sent to zombie process groups. Sending signal 0 is useful for detecting if the process [group] has completely gone away. Linux-2.0.27 allows sending all signals in both cases (at least when the signals aren't blocked at process exit time and permission is granted). FreeBSD returns -1/ESRCH in all cases. POSIX specifies that process lifetimes end when the process is successfully waited for, and process group lifetimes end when all all processes leave the group by ending their lifetime or changing the group. No special signal handling is specified for zombie processes (POSIX calls them terminated processes [whose lifetime hasn't ended]). kill() is specified as returning ESRCH [only] when no process or process group matching the pid can be found. Thus the Linux behaviour is correct. The FreeBSD implementation is also correct if FreeBSD "provides extended security controls" :-). Then it may impose further implementation-defined restrictions on signals, including signal 0, and it may deny the existence of some pids. It's quite reasonable to pretend that zombie pids don't exist. Allowing signals to be sent to zombie process groups simply involves removing the SZOMB check from killpg1(). It's harder to allow zombie processes in kill(). pfind() can't see them because processes are removed from the process hash table at exit() time. pgfind() works right because processes are removed from the process group hash table at wait() time. Bruce