server: When possible, use tgkill instead of tkill syscall on Linux.
diff --git a/server/context_i386.c b/server/context_i386.c
index 52b33aa..cf334cb 100644
--- a/server/context_i386.c
+++ b/server/context_i386.c
@@ -560,16 +560,24 @@
}
/* 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;