svn commit: r191313 - head/sys/kern

Konstantin Belousov kib at FreeBSD.org
Mon Apr 20 14:34:56 UTC 2009


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);
 


More information about the svn-src-head mailing list