Module: wine Branch: master Commit: b3fb3a67395959e9fe5e86d28cf5eb918e6ee86b URL: http://source.winehq.org/git/wine.git/?a=commit;h=b3fb3a67395959e9fe5e86d28c... Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Mar 5 17:09:54 2007 +0100 server: Replace use of internal __pthread_kill() function by a system call. --- server/mach.c | 22 ++++++++++++++++++++-- 1 files changed, 20 insertions(+), 2 deletions(-) diff --git a/server/mach.c b/server/mach.c index 111953c..5996ba4 100644 --- a/server/mach.c +++ b/server/mach.c @@ -20,6 +20,7 @@ */ #include "config.h" +#include "wine/port.h" #include <assert.h> #include <errno.h> @@ -46,7 +47,20 @@ #include <mach/thread_act.h> #include <servers/bootstrap.h> -extern int __pthread_kill(mach_port_t, int); +#if defined(__APPLE__) && defined(__i386__) +extern int pthread_kill_syscall( mach_port_t, int ); +__ASM_GLOBAL_FUNC( pthread_kill_syscall, + "movl $328,%eax\n\t" /* SYS___pthread_kill */ + "int $0x80\n\t" + "jae 1f\n\t" + "negl %eax\n" + "1:\tret" ); +#else +static inline int pthread_kill_syscall( mach_port_t, int ) +{ + return -ENOSYS; +} +#endif static mach_port_t server_mach_port; @@ -232,7 +246,11 @@ int send_thread_signal( struct thread *thread, int sig ) if (!mach_port_extract_right( process_port, thread->unix_tid, MACH_MSG_TYPE_COPY_SEND, &port, &type )) { - ret = __pthread_kill( port, sig ); + if ((ret = pthread_kill_syscall( port, sig )) < 0) + { + errno = -ret; + ret = -1; + } mach_port_deallocate( mach_task_self(), port ); } else errno = ESRCH;