Index: sys/compat/linux/linux_misc.c =================================================================== --- sys/compat/linux/linux_misc.c +++ sys/compat/linux/linux_misc.c @@ -1096,6 +1096,7 @@ { idtype_t idtype; int error, options; + pid_t id; if (args->options & ~(LINUX_WNOHANG | LINUX_WNOWAIT | LINUX_WEXITED | LINUX_WSTOPPED | LINUX_WCONTINUED | __WCLONE | __WNOTHREAD | __WALL)) @@ -1107,6 +1108,7 @@ options |= WEXITED | WTRAPPED | WUNTRACED | WCONTINUED | WLINUXCLONE; + id = args->id; switch (args->idtype) { case LINUX_P_ALL: idtype = P_ALL; @@ -1117,8 +1119,13 @@ idtype = P_PID; break; case LINUX_P_PGID: - if (args->id <= 0) + if (args->id < 0) return (EINVAL); + if (args->id == 0) { + error = kern_getpgid(td, args->id, &id); + if (error != 0) + return (error); + } idtype = P_PGID; break; case LINUX_P_PIDFD: @@ -1128,7 +1135,7 @@ return (EINVAL); } - error = linux_common_wait(td, idtype, args->id, NULL, options, + error = linux_common_wait(td, idtype, id, NULL, options, args->rusage, args->info); td->td_retval[0] = 0;