From owner-svn-src-user@FreeBSD.ORG Sun Feb 24 11:28:52 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 9D5228A9; Sun, 24 Feb 2013 11:28:52 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 59D231CFE; Sun, 24 Feb 2013 11:28:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1OBSqHQ011114; Sun, 24 Feb 2013 11:28:52 GMT (envelope-from dchagin@svn.freebsd.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1OBSqXk011111; Sun, 24 Feb 2013 11:28:52 GMT (envelope-from dchagin@svn.freebsd.org) Message-Id: <201302241128.r1OBSqXk011111@svn.freebsd.org> From: Dmitry Chagin Date: Sun, 24 Feb 2013 11:28:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r247218 - user/dchagin/lemul/sys/compat/linux X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Feb 2013 11:28:52 -0000 Author: dchagin Date: Sun Feb 24 11:28:51 2013 New Revision: 247218 URL: http://svnweb.freebsd.org/changeset/base/247218 Log: Add a function for converting wait options. Modified: user/dchagin/lemul/sys/compat/linux/linux_misc.c user/dchagin/lemul/sys/compat/linux/linux_misc.h Modified: user/dchagin/lemul/sys/compat/linux/linux_misc.c ============================================================================== --- user/dchagin/lemul/sys/compat/linux/linux_misc.c Sun Feb 24 11:27:18 2013 (r247217) +++ user/dchagin/lemul/sys/compat/linux/linux_misc.c Sun Feb 24 11:28:51 2013 (r247218) @@ -1992,3 +1992,23 @@ linux_tdfind(struct thread *td, lwpid_t 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; +} + Modified: user/dchagin/lemul/sys/compat/linux/linux_misc.h ============================================================================== --- user/dchagin/lemul/sys/compat/linux/linux_misc.h Sun Feb 24 11:27:18 2013 (r247217) +++ user/dchagin/lemul/sys/compat/linux/linux_misc.h Sun Feb 24 11:28:51 2013 (r247218) @@ -111,10 +111,20 @@ 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);