diff options
author | kib <kib@FreeBSD.org> | 2012-11-16 06:32:38 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2012-11-16 06:32:38 +0000 |
commit | 812355449549ef06d537b201f0e468eefc5a1d49 (patch) | |
tree | f095c3a483ebe00a7c7f14721374fa86e762d77f | |
parent | 6efe04e4bb01c0da1355b9920a120f4ccc62a96d (diff) | |
download | FreeBSD-src-812355449549ef06d537b201f0e468eefc5a1d49.zip FreeBSD-src-812355449549ef06d537b201f0e468eefc5a1d49.tar.gz |
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
-rw-r--r-- | sys/kern/kern_exit.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index 64ea5c3..3dd6521 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -1024,6 +1024,7 @@ kern_wait(struct thread *td, pid_t pid, int *status, int options, 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, int *status, int options, 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; } |