server: When possible, use tgkill instead of tkill syscall on Linux.
This commit is contained in:
parent
94515450fa
commit
22357ca388
|
@ -341,7 +341,7 @@ int get_thread_single_step( struct thread *thread )
|
||||||
}
|
}
|
||||||
|
|
||||||
/* send a signal to a specific 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 */
|
/* FIXME: should do something here */
|
||||||
errno = ENOSYS;
|
errno = ENOSYS;
|
||||||
|
|
|
@ -560,16 +560,24 @@ int get_thread_single_step( struct thread *thread )
|
||||||
}
|
}
|
||||||
|
|
||||||
/* send a signal to a specific thread */
|
/* send a signal to a specific thread */
|
||||||
int tkill( int pid, int sig )
|
int tkill( int tgid, int pid, int sig )
|
||||||
{
|
{
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
__asm__( "pushl %%ebx\n\t"
|
__asm__( "pushl %%ebx\n\t"
|
||||||
"movl %2,%%ebx\n\t"
|
"movl %2,%%ebx\n\t"
|
||||||
"int $0x80\n\t"
|
"int $0x80\n\t"
|
||||||
"popl %%ebx\n\t"
|
"popl %%ebx\n\t"
|
||||||
: "=a" (ret)
|
: "=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;
|
if (ret >= 0) return ret;
|
||||||
errno = -ret;
|
errno = -ret;
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -286,7 +286,7 @@ int get_thread_single_step( struct thread *thread )
|
||||||
}
|
}
|
||||||
|
|
||||||
/* send a signal to a specific 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 */
|
/* FIXME: should do something here */
|
||||||
errno = ENOSYS;
|
errno = ENOSYS;
|
||||||
|
|
|
@ -179,7 +179,7 @@ int get_thread_single_step( struct thread *thread )
|
||||||
}
|
}
|
||||||
|
|
||||||
/* send a signal to a specific 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 */
|
/* FIXME: should do something here */
|
||||||
errno = ENOSYS;
|
errno = ENOSYS;
|
||||||
|
|
|
@ -271,7 +271,7 @@ int get_thread_single_step( struct thread *thread )
|
||||||
}
|
}
|
||||||
|
|
||||||
/* send a signal to a specific thread */
|
/* send a signal to a specific thread */
|
||||||
int tkill( int pid, int sig )
|
int tkill( int tgid, int pid, int sig )
|
||||||
{
|
{
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
int ret;
|
int ret;
|
||||||
|
|
|
@ -187,7 +187,7 @@ int send_thread_signal( struct thread *thread, int sig )
|
||||||
{
|
{
|
||||||
if (thread->unix_tid != -1)
|
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 );
|
if (ret == -1 && errno == ENOSYS) ret = kill( thread->unix_pid, sig );
|
||||||
}
|
}
|
||||||
else ret = kill( thread->unix_pid, sig );
|
else ret = kill( thread->unix_pid, sig );
|
||||||
|
|
|
@ -132,7 +132,7 @@ extern void *get_thread_ip( struct thread *thread );
|
||||||
extern int get_thread_single_step( 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 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 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 int send_thread_signal( struct thread *thread, int sig );
|
||||||
|
|
||||||
extern unsigned int global_error; /* global error code for when no thread is current */
|
extern unsigned int global_error; /* global error code for when no thread is current */
|
||||||
|
|
Loading…
Reference in New Issue