diff --git a/server/context_alpha.c b/server/context_alpha.c index 1f82d8eec15769587163bd1ab3da23cb87d2e0ab..41771bf00e3f26ffea7e538cac537c4bb90aad20 100644 --- a/server/context_alpha.c +++ b/server/context_alpha.c @@ -341,7 +341,7 @@ int get_thread_single_step( struct thread *thread ) } /* send a signal to a specific thread */ -int tkill( int pid, int sig ) +int tkill( int tgid, int pid, int sig ) { /* FIXME: should do something here */ errno = ENOSYS; diff --git a/server/context_i386.c b/server/context_i386.c index 52b33aaa70530e218d16d309be82b32ebbd62a1b..cf334cb7cbfc25043c3e48b3888632f1b9306bce 100644 --- a/server/context_i386.c +++ b/server/context_i386.c @@ -560,16 +560,24 @@ int get_thread_single_step( struct thread *thread ) } /* send a signal to a specific thread */ -int tkill( int pid, int sig ) +int tkill( int tgid, int pid, int sig ) { #ifdef __linux__ int ret; + __asm__( "pushl %%ebx\n\t" "movl %2,%%ebx\n\t" "int $0x80\n\t" "popl %%ebx\n\t" : "=a" (ret) - : "0" (238) /*SYS_tkill*/, "r" (pid), "c" (sig) ); + : "0" (270) /*SYS_tgkill*/, "r" (tgid), "c" (pid), "d" (sig) ); + if (ret == -ENOSYS) + __asm__( "pushl %%ebx\n\t" + "movl %2,%%ebx\n\t" + "int $0x80\n\t" + "popl %%ebx\n\t" + : "=a" (ret) + : "0" (238) /*SYS_tkill*/, "r" (pid), "c" (sig) ); if (ret >= 0) return ret; errno = -ret; return -1; diff --git a/server/context_powerpc.c b/server/context_powerpc.c index 72947e0f181b41bd0d3c88704d0edebb36f47a5a..9a438b97902ef5039cf4bd138292a20941103fef 100644 --- a/server/context_powerpc.c +++ b/server/context_powerpc.c @@ -286,7 +286,7 @@ int get_thread_single_step( struct thread *thread ) } /* send a signal to a specific thread */ -int tkill( int pid, int sig ) +int tkill( int tgid, int pid, int sig ) { /* FIXME: should do something here */ errno = ENOSYS; diff --git a/server/context_sparc.c b/server/context_sparc.c index b718ff371987514163cfa13a7caa7e8def33a5c9..39c3dd3361321182bdabe8435fc66bf189754dfb 100644 --- a/server/context_sparc.c +++ b/server/context_sparc.c @@ -179,7 +179,7 @@ int get_thread_single_step( struct thread *thread ) } /* send a signal to a specific thread */ -int tkill( int pid, int sig ) +int tkill( int tgid, int pid, int sig ) { /* FIXME: should do something here */ errno = ENOSYS; diff --git a/server/context_x86_64.c b/server/context_x86_64.c index c102510187b1339ad9a7b2ec37fadc81cfa27b31..ee8bb318e1e9c1f479bf4db8d878d6ea42f603dc 100644 --- a/server/context_x86_64.c +++ b/server/context_x86_64.c @@ -271,7 +271,7 @@ int get_thread_single_step( struct thread *thread ) } /* send a signal to a specific thread */ -int tkill( int pid, int sig ) +int tkill( int tgid, int pid, int sig ) { #ifdef __linux__ int ret; diff --git a/server/ptrace.c b/server/ptrace.c index e4cf889d2a7d983f12344be22600fd05a6852080..d7134f2b1de1a5dcfaf78e032b8c527dc6cc976f 100644 --- a/server/ptrace.c +++ b/server/ptrace.c @@ -187,7 +187,7 @@ int send_thread_signal( struct thread *thread, int sig ) { if (thread->unix_tid != -1) { - ret = tkill( thread->unix_tid, sig ); + ret = tkill( thread->unix_pid, thread->unix_tid, sig ); if (ret == -1 && errno == ENOSYS) ret = kill( thread->unix_pid, sig ); } else ret = kill( thread->unix_pid, sig ); diff --git a/server/thread.h b/server/thread.h index 01e12184a8b6bc27093a35212b9537a57304fbff..3bcc576ca31f8eccc62fce7e536e341c9f492001 100644 --- a/server/thread.h +++ b/server/thread.h @@ -132,7 +132,7 @@ extern void *get_thread_ip( struct thread *thread ); extern int get_thread_single_step( struct thread *thread ); extern void get_thread_context( struct thread *thread, CONTEXT *context, unsigned int flags ); extern void set_thread_context( struct thread *thread, const CONTEXT *context, unsigned int flags ); -extern int tkill( int pid, int sig ); +extern int tkill( int tgid, int pid, int sig ); extern int send_thread_signal( struct thread *thread, int sig ); extern unsigned int global_error; /* global error code for when no thread is current */