Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Apr 2009 14:34:55 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r191313 - head/sys/kern
Message-ID:  <200904201434.n3KEYtSP048797@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Mon Apr 20 14:34:55 2009
New Revision: 191313
URL: http://svn.freebsd.org/changeset/base/191313

Log:
  On the exit of the child process which parent either set SA_NOCLDWAIT
  or ignored SIGCHLD, unconditionally wake up the parent instead of doing
  this only when the child is a last child.
  
  This brings us in line with other U**xes that support SA_NOCLDWAIT. If
  the parent called waitpid(childpid), then exit of the child should wake
  up the parent immediately instead of forcing it to wait for all children
  to exit.
  
  Reported by:	Alan Ferrency <alan pair com>
  Submitted by:	Jilles Tjoelker <jilles stack nl>
  PR:	108390
  MFC after:	2 weeks

Modified:
  head/sys/kern/kern_exit.c

Modified: head/sys/kern/kern_exit.c
==============================================================================
--- head/sys/kern/kern_exit.c	Mon Apr 20 13:53:40 2009	(r191312)
+++ head/sys/kern/kern_exit.c	Mon Apr 20 14:34:55 2009	(r191313)
@@ -504,13 +504,13 @@ exit1(struct thread *td, int rv)
 		proc_reparent(p, initproc);
 		p->p_sigparent = SIGCHLD;
 		PROC_LOCK(p->p_pptr);
+
 		/*
-		 * If this was the last child of our parent, notify
-		 * parent, so in case he was wait(2)ing, he will
+		 * Notify parent, so in case he was wait(2)ing or
+		 * executiing waitpid(2) with our pid, he will
 		 * continue.
 		 */
-		if (LIST_EMPTY(&pp->p_children))
-			wakeup(pp);
+		wakeup(pp);
 	} else
 		mtx_unlock(&p->p_pptr->p_sigacts->ps_mtx);
 



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