Changeset View
Changeset View
Standalone View
Standalone View
sys/compat/linux/linux_misc.c
Show First 20 Lines • Show All 1,063 Lines • ▼ Show 20 Lines | linux_wait4(struct thread *td, struct linux_wait4_args *args) | ||||
options = 0; | options = 0; | ||||
linux_to_bsd_waitopts(args->options, &options); | linux_to_bsd_waitopts(args->options, &options); | ||||
/* | /* | ||||
* For backward compatibility we implicitly add flags WEXITED | * For backward compatibility we implicitly add flags WEXITED | ||||
* and WTRAPPED here. | * and WTRAPPED here. | ||||
*/ | */ | ||||
options |= WEXITED | WTRAPPED; | options |= WEXITED | WTRAPPED; | ||||
/* | |||||
* As FreeBSD does not have __WALL option bit analogue explicitly set all | |||||
* possible option bits to emulate Linux __WALL wait option bit. The same | |||||
* for waitid system call. | |||||
*/ | |||||
if ((args->options & __WALL) != 0) | |||||
options |= WUNTRACED | WCONTINUED | WLINUXCLONE; | |||||
if (args->pid == WAIT_ANY) { | if (args->pid == WAIT_ANY) { | ||||
idtype = P_ALL; | idtype = P_ALL; | ||||
id = 0; | id = 0; | ||||
} else if (args->pid < 0) { | } else if (args->pid < 0) { | ||||
idtype = P_PGID; | idtype = P_PGID; | ||||
id = (id_t)-args->pid; | id = (id_t)-args->pid; | ||||
} else { | } else { | ||||
idtype = P_PID; | idtype = P_PID; | ||||
Show All 11 Lines | linux_waitid(struct thread *td, struct linux_waitid_args *args) | ||||
int error, options; | int error, options; | ||||
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) | |||||
options |= WEXITED | WTRAPPED | WUNTRACED | | |||||
WCONTINUED | WLINUXCLONE; | |||||
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); | ||||
▲ Show 20 Lines • Show All 1,760 Lines • Show Last 20 Lines |