diff --git a/sys/compat/linux/linux_mib.h b/sys/compat/linux/linux_mib.h --- a/sys/compat/linux/linux_mib.h +++ b/sys/compat/linux/linux_mib.h @@ -60,8 +60,10 @@ #define LINUX_KERNVER_2004000 LINUX_KERNVER(2,4,0) #define LINUX_KERNVER_2006000 LINUX_KERNVER(2,6,0) #define LINUX_KERNVER_2006039 LINUX_KERNVER(2,6,39) +#define LINUX_KERNVER_5004000 LINUX_KERNVER(5,4,0) #define linux_use26(t) (linux_kernver(t) >= LINUX_KERNVER_2006000) +#define linux_use54(t) (linux_kernver(t) >= LINUX_KERNVER_5004000) extern int linux_debug; extern int linux_default_openfiles; diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -1097,6 +1097,8 @@ { idtype_t idtype; int error, options; + struct proc *p; + pid_t id; if (args->options & ~(LINUX_WNOHANG | LINUX_WNOWAIT | LINUX_WEXITED | LINUX_WSTOPPED | LINUX_WCONTINUED | __WCLONE | __WNOTHREAD | __WALL)) @@ -1108,6 +1110,7 @@ options |= WEXITED | WTRAPPED | WUNTRACED | WCONTINUED | WLINUXCLONE; + id = args->id; switch (args->idtype) { case LINUX_P_ALL: idtype = P_ALL; @@ -1118,7 +1121,12 @@ idtype = P_PID; break; case LINUX_P_PGID: - if (args->id <= 0) + if (linux_use54(td) && args->id == 0) { + p = td->td_proc; + PROC_LOCK(p); + id = p->p_pgid; + PROC_UNLOCK(p); + } else if (args->id <= 0) return (EINVAL); idtype = P_PGID; break; @@ -1129,7 +1137,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;