Changeset View
Changeset View
Standalone View
Standalone View
sys/compat/linux/linux_misc.c
Show First 20 Lines • Show All 1,099 Lines • ▼ Show 20 Lines | return (linux_common_wait(td, idtype, id, args->status, options, | ||||
args->rusage, NULL)); | args->rusage, NULL)); | ||||
} | } | ||||
int | int | ||||
linux_waitid(struct thread *td, struct linux_waitid_args *args) | linux_waitid(struct thread *td, struct linux_waitid_args *args) | ||||
{ | { | ||||
idtype_t idtype; | idtype_t idtype; | ||||
int error, options; | int error, options; | ||||
struct proc *p; | |||||
pid_t id; | |||||
if (args->options & ~(LINUX_WNOHANG | LINUX_WNOWAIT | LINUX_WEXITED | | if (args->options & ~(LINUX_WNOHANG | LINUX_WNOWAIT | LINUX_WEXITED | | ||||
LINUX_WSTOPPED | LINUX_WCONTINUED | __WCLONE | __WNOTHREAD | __WALL)) | LINUX_WSTOPPED | LINUX_WCONTINUED | __WCLONE | __WNOTHREAD | __WALL)) | ||||
return (EINVAL); | return (EINVAL); | ||||
options = 0; | options = 0; | ||||
linux_to_bsd_waitopts(args->options, &options); | linux_to_bsd_waitopts(args->options, &options); | ||||
if ((args->options & __WALL) != 0) | if ((args->options & __WALL) != 0) | ||||
options |= WEXITED | WTRAPPED | WUNTRACED | | options |= WEXITED | WTRAPPED | WUNTRACED | | ||||
WCONTINUED | WLINUXCLONE; | WCONTINUED | WLINUXCLONE; | ||||
id = args->id; | |||||
switch (args->idtype) { | switch (args->idtype) { | ||||
case LINUX_P_ALL: | case LINUX_P_ALL: | ||||
idtype = P_ALL; | idtype = P_ALL; | ||||
break; | break; | ||||
case LINUX_P_PID: | case LINUX_P_PID: | ||||
if (args->id <= 0) | if (args->id <= 0) | ||||
return (EINVAL); | return (EINVAL); | ||||
idtype = P_PID; | idtype = P_PID; | ||||
break; | break; | ||||
case LINUX_P_PGID: | 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_pgrp->pg_id; | |||||
PROC_UNLOCK(p); | |||||
} else if (args->id <= 0) | |||||
return (EINVAL); | return (EINVAL); | ||||
idtype = P_PGID; | idtype = P_PGID; | ||||
break; | break; | ||||
case LINUX_P_PIDFD: | case LINUX_P_PIDFD: | ||||
LINUX_RATELIMIT_MSG("unsupported waitid P_PIDFD idtype"); | LINUX_RATELIMIT_MSG("unsupported waitid P_PIDFD idtype"); | ||||
return (ENOSYS); | return (ENOSYS); | ||||
default: | default: | ||||
return (EINVAL); | 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); | args->rusage, args->info); | ||||
td->td_retval[0] = 0; | td->td_retval[0] = 0; | ||||
return (error); | return (error); | ||||
} | } | ||||
#ifdef LINUX_LEGACY_SYSCALLS | #ifdef LINUX_LEGACY_SYSCALLS | ||||
int | int | ||||
▲ Show 20 Lines • Show All 1,740 Lines • Show Last 20 Lines |