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;
        }
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to