diff options
author | dchagin <dchagin@FreeBSD.org> | 2016-01-09 15:22:50 +0000 |
---|---|---|
committer | dchagin <dchagin@FreeBSD.org> | 2016-01-09 15:22:50 +0000 |
commit | 778af4f786b2616dc167e39728e9ccd274f98fa1 (patch) | |
tree | fabfa251e757b0f4a19e09861b8e1c79d94e8d62 /sys/compat | |
parent | b9febf10b6d52bfaea7061291f088ceb9049ff51 (diff) | |
download | FreeBSD-src-778af4f786b2616dc167e39728e9ccd274f98fa1.zip FreeBSD-src-778af4f786b2616dc167e39728e9ccd274f98fa1.tar.gz |
MFC r283390:
Add a function for converting wait options.
Diffstat (limited to 'sys/compat')
-rw-r--r-- | sys/compat/linux/linux_misc.c | 19 | ||||
-rw-r--r-- | sys/compat/linux/linux_misc.h | 13 |
2 files changed, 31 insertions, 1 deletions
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index 6293c40..345dd22 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -2006,3 +2006,22 @@ linux_tdfind(struct thread *td, lwpid_t tid, pid_t pid) return (tdt); } + +void +linux_to_bsd_waitopts(int options, int *bsdopts) +{ + + if (options & LINUX_WNOHANG) + *bsdopts |= WNOHANG; + if (options & LINUX_WUNTRACED) + *bsdopts |= WUNTRACED; + if (options & LINUX_WEXITED) + *bsdopts |= WEXITED; + if (options & LINUX_WCONTINUED) + *bsdopts |= WCONTINUED; + if (options & LINUX_WNOWAIT) + *bsdopts |= WNOWAIT; + + if (options & __WCLONE) + *bsdopts |= WLINUXCLONE; +} diff --git a/sys/compat/linux/linux_misc.h b/sys/compat/linux/linux_misc.h index 50e52f2..a25ba73 100644 --- a/sys/compat/linux/linux_misc.h +++ b/sys/compat/linux/linux_misc.h @@ -111,10 +111,21 @@ struct l_new_utsname { extern int stclohz; -#define __WCLONE 0x80000000 +#define LINUX_WNOHANG 0x00000001 +#define LINUX_WUNTRACED 0x00000002 +#define LINUX_WSTOPPED LINUX_WUNTRACED +#define LINUX_WEXITED 0x00000004 +#define LINUX_WCONTINUED 0x00000008 +#define LINUX_WNOWAIT 0x01000000 + + +#define __WNOTHREAD 0x20000000 +#define __WALL 0x40000000 +#define __WCLONE 0x80000000 int linux_common_wait(struct thread *td, int pid, int *status, int options, struct rusage *ru); +void linux_to_bsd_waitopts(int options, int *bsdopts); int linux_set_upcall_kse(struct thread *td, register_t stack); int linux_set_cloned_tls(struct thread *td, void *desc); struct thread *linux_tdfind(struct thread *, lwpid_t, pid_t); |