server: Use thr_kill2 syscall to signal threads on FreeBSD.

This commit is contained in:
Tijl Coosemans 2007-08-23 14:12:37 +02:00 committed by Alexandre Julliard
parent d0ce7ec599
commit 0c4f152ec7
4 changed files with 17 additions and 4 deletions

2
configure vendored
View File

@ -15687,6 +15687,7 @@ esac
for ac_func in \ for ac_func in \
@ -15746,6 +15747,7 @@ for ac_func in \
strncasecmp \ strncasecmp \
strtold \ strtold \
tcgetattr \ tcgetattr \
thr_kill2 \
timegm \ timegm \
usleep \ usleep \
vsnprintf \ vsnprintf \

View File

@ -1287,6 +1287,7 @@ AC_CHECK_FUNCS(\
strncasecmp \ strncasecmp \
strtold \ strtold \
tcgetattr \ tcgetattr \
thr_kill2 \
timegm \ timegm \
usleep \ usleep \
vsnprintf \ vsnprintf \

View File

@ -849,6 +849,9 @@
/* Define to 1 if you have the <termios.h> header file. */ /* Define to 1 if you have the <termios.h> header file. */
#undef HAVE_TERMIOS_H #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. */ /* Define to 1 if you have the `timegm' function. */
#undef HAVE_TIMEGM #undef HAVE_TIMEGM

View File

@ -35,6 +35,10 @@
#ifdef HAVE_SYS_WAIT_H #ifdef HAVE_SYS_WAIT_H
# include <sys/wait.h> # include <sys/wait.h>
#endif #endif
#ifdef HAVE_SYS_THR_H
# include <sys/ucontext.h>
# include <sys/thr.h>
#endif
#include <unistd.h> #include <unistd.h>
#include "ntstatus.h" #include "ntstatus.h"
@ -206,9 +210,8 @@ static int wait4_thread( struct thread *thread, int signal )
/* send a signal to a specific thread */ /* send a signal to a specific thread */
static inline int tkill( int tgid, int pid, int sig ) static inline int tkill( int tgid, int pid, int sig )
{ {
int ret = -ENOSYS;
#ifdef __linux__ #ifdef __linux__
int ret = -ENOSYS;
# ifdef __i386__ # ifdef __i386__
__asm__( "pushl %%ebx\n\t" __asm__( "pushl %%ebx\n\t"
"movl %2,%%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) __asm__( "syscall" : "=a" (ret)
: "0" (200) /*SYS_tkill*/, "D" (pid), "S" (sig) ); : "0" (200) /*SYS_tkill*/, "D" (pid), "S" (sig) );
# endif # endif
#endif /* __linux__ */
if (ret >= 0) return ret; if (ret >= 0) return ret;
errno = -ret; errno = -ret;
return -1; 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 */ /* initialize the process tracing mechanism */