Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 9 Jan 2016 15:22:50 +0000 (UTC)
From:      Dmitry Chagin <dchagin@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r293499 - stable/10/sys/compat/linux
Message-ID:  <201601091522.u09FMol4018055@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dchagin
Date: Sat Jan  9 15:22:50 2016
New Revision: 293499
URL: https://svnweb.freebsd.org/changeset/base/293499

Log:
  MFC r283390:
  
  Add a function for converting wait options.

Modified:
  stable/10/sys/compat/linux/linux_misc.c
  stable/10/sys/compat/linux/linux_misc.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/linux/linux_misc.c
==============================================================================
--- stable/10/sys/compat/linux/linux_misc.c	Sat Jan  9 15:21:45 2016	(r293498)
+++ stable/10/sys/compat/linux/linux_misc.c	Sat Jan  9 15:22:50 2016	(r293499)
@@ -2006,3 +2006,22 @@ 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: stable/10/sys/compat/linux/linux_misc.h
==============================================================================
--- stable/10/sys/compat/linux/linux_misc.h	Sat Jan  9 15:21:45 2016	(r293498)
+++ stable/10/sys/compat/linux/linux_misc.h	Sat Jan  9 15:22:50 2016	(r293499)
@@ -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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601091522.u09FMol4018055>