Tijl Coosemans : server: Use thr_kill2 syscall to signal threads on FreeBSD .

Alexandre Julliard julliard at wine.codeweavers.com
Fri Aug 24 05:24:42 CDT 2007


Module: wine
Branch: master
Commit: 0c4f152ec7aeaaab7e3221000c80c1f90437842c
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=0c4f152ec7aeaaab7e3221000c80c1f90437842c

Author: Tijl Coosemans <tijl at ulyssis.org>
Date:   Thu Aug 23 14:12:37 2007 +0200

server: Use thr_kill2 syscall to signal threads on FreeBSD.

---

 configure           |    2 ++
 configure.ac        |    1 +
 include/config.h.in |    3 +++
 server/ptrace.c     |   15 +++++++++++----
 4 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/configure b/configure
index 101511d..8c3db36 100755
--- a/configure
+++ b/configure
@@ -15689,6 +15689,7 @@ esac
 
 
 
+
 for ac_func in \
 	_pclose \
 	_popen \
@@ -15746,6 +15747,7 @@ for ac_func in \
 	strncasecmp \
 	strtold \
 	tcgetattr \
+	thr_kill2 \
 	timegm \
 	usleep \
 	vsnprintf \
diff --git a/configure.ac b/configure.ac
index 6b90cd2..64be416 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1287,6 +1287,7 @@ AC_CHECK_FUNCS(\
 	strncasecmp \
 	strtold \
 	tcgetattr \
+	thr_kill2 \
 	timegm \
 	usleep \
 	vsnprintf \
diff --git a/include/config.h.in b/include/config.h.in
index 0c4935c..df65adb 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -849,6 +849,9 @@
 /* Define to 1 if you have the <termios.h> header file. */
 #undef HAVE_TERMIOS_H
 
+/* Define to 1 if you have the `thr_kill2' function. */
+#undef HAVE_THR_KILL2
+
 /* Define to 1 if you have the `timegm' function. */
 #undef HAVE_TIMEGM
 
diff --git a/server/ptrace.c b/server/ptrace.c
index f1a9afb..343e38e 100644
--- a/server/ptrace.c
+++ b/server/ptrace.c
@@ -35,6 +35,10 @@
 #ifdef HAVE_SYS_WAIT_H
 # include <sys/wait.h>
 #endif
+#ifdef HAVE_SYS_THR_H
+# include <sys/ucontext.h>
+# include <sys/thr.h>
+#endif
 #include <unistd.h>
 
 #include "ntstatus.h"
@@ -206,9 +210,8 @@ static int wait4_thread( struct thread *thread, int signal )
 /* send a signal to a specific thread */
 static inline int tkill( int tgid, int pid, int sig )
 {
-    int ret = -ENOSYS;
-
 #ifdef __linux__
+    int ret = -ENOSYS;
 # ifdef __i386__
     __asm__( "pushl %%ebx\n\t"
              "movl %2,%%ebx\n\t"
@@ -227,11 +230,15 @@ static inline int tkill( int tgid, int pid, int sig )
     __asm__( "syscall" : "=a" (ret)
              : "0" (200) /*SYS_tkill*/, "D" (pid), "S" (sig) );
 # endif
-#endif  /* __linux__ */
-
     if (ret >= 0) return ret;
     errno = -ret;
     return -1;
+#elif defined(__FreeBSD__) && defined(HAVE_THR_KILL2)
+    return thr_kill2( tgid, pid, sig );
+#else
+    errno = ENOSYS;
+    return -1;
+#endif
 }
 
 /* initialize the process tracing mechanism */




More information about the wine-cvs mailing list