diff options
author | dchagin <dchagin@FreeBSD.org> | 2016-01-09 16:28:40 +0000 |
---|---|---|
committer | dchagin <dchagin@FreeBSD.org> | 2016-01-09 16:28:40 +0000 |
commit | cda33c12b343f1c255629b1f7611655e3b29e3ac (patch) | |
tree | f9ccabfdca3ffb46fe8ed9aa468ff89091201220 /sys/compat | |
parent | 711049c77b1b3ac708f86965e53280f134689263 (diff) | |
download | FreeBSD-src-cda33c12b343f1c255629b1f7611655e3b29e3ac.zip FreeBSD-src-cda33c12b343f1c255629b1f7611655e3b29e3ac.tar.gz |
MFC r283435:
Convert Linux wait options to the FreeBSD.
Check wait options as a Linux do.
Linux always set WEXITED option not a WUNTRACED|WNOHANG
which is a strange bug.
Diffstat (limited to 'sys/compat')
-rw-r--r-- | sys/compat/linux/linux_misc.c | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index b9218d8..bf8c462 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -885,26 +885,20 @@ linux_common_wait(struct thread *td, int pid, int *status, int linux_waitpid(struct thread *td, struct linux_waitpid_args *args) { - int options; - + struct linux_wait4_args wait4_args; + #ifdef DEBUG if (ldebug(waitpid)) printf(ARGS(waitpid, "%d, %p, %d"), args->pid, (void *)args->status, args->options); #endif - /* - * this is necessary because the test in kern_wait doesn't work - * because we mess with the options here - */ - if (args->options & ~(WUNTRACED | WNOHANG | WCONTINUED | __WCLONE)) - return (EINVAL); - - options = (args->options & (WNOHANG | WUNTRACED)); - /* WLINUXCLONE should be equal to __WCLONE, but we make sure */ - if (args->options & __WCLONE) - options |= WLINUXCLONE; - return (linux_common_wait(td, args->pid, args->status, options, NULL)); + wait4_args.pid = args->pid; + wait4_args.status = args->status; + wait4_args.options = args->options; + wait4_args.rusage = NULL; + + return (linux_wait4(td, &wait4_args)); } #endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */ @@ -920,11 +914,12 @@ linux_wait4(struct thread *td, struct linux_wait4_args *args) args->pid, (void *)args->status, args->options, (void *)args->rusage); #endif + if (args->options & ~(LINUX_WUNTRACED | LINUX_WNOHANG | + LINUX_WCONTINUED | __WCLONE | __WNOTHREAD | __WALL)) + return (EINVAL); - options = (args->options & (WNOHANG | WUNTRACED)); - /* WLINUXCLONE should be equal to __WCLONE, but we make sure */ - if (args->options & __WCLONE) - options |= WLINUXCLONE; + options = WEXITED; + linux_to_bsd_waitopts(args->options, &options); if (args->rusage != NULL) rup = &ru; |