Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Nov 2012 06:32:39 +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: r243136 - head/sys/kern
Message-ID:  <201211160632.qAG6WdAo032964@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Fri Nov 16 06:32:38 2012
New Revision: 243136
URL: http://svnweb.freebsd.org/changeset/base/243136

Log:
  Restore the proper handling of the pid 0 for waitpid(2).
  Fix the style around.
  
  Reported and reviewed by:	bde (previous version)
  MFC after:	28 days

Modified:
  head/sys/kern/kern_exit.c

Modified: head/sys/kern/kern_exit.c
==============================================================================
--- head/sys/kern/kern_exit.c	Fri Nov 16 06:29:52 2012	(r243135)
+++ head/sys/kern/kern_exit.c	Fri Nov 16 06:32:38 2012	(r243136)
@@ -1024,6 +1024,7 @@ kern_wait(struct thread *td, pid_t pid, 
     struct rusage *rusage)
 {
 	struct __wrusage wru, *wrup;
+	struct proc *q;
 	idtype_t idtype;
 	id_t id;
 	int ret;
@@ -1031,12 +1032,16 @@ kern_wait(struct thread *td, pid_t pid, 
 	if (pid == WAIT_ANY) {
 		idtype = P_ALL;
 		id = 0;
-	}
-	else if (pid <= 0) {
+	} else if (pid == WAIT_MYPGRP) {
+		idtype = P_PGID;
+		q = td->td_proc;
+		PROC_LOCK(q);
+		id = (id_t)q->p_pgid;
+		PROC_UNLOCK(q);
+	} else if (pid < 0) {
 		idtype = P_PGID;
 		id = (id_t)-pid;
-	}
-	else {
+	} else {
 		idtype = P_PID;
 		id = (id_t)pid;
 	}



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