Commit 7dbd1f01 authored by Alexandre Julliard's avatar Alexandre Julliard

server: Moved the tkill function to ptrace.c.

parent d8659a97
...@@ -334,14 +334,6 @@ void *get_thread_ip( struct thread *thread ) ...@@ -334,14 +334,6 @@ void *get_thread_ip( struct thread *thread )
return (void *)context.Fir; return (void *)context.Fir;
} }
/* send a signal to a specific thread */
int tkill( int tgid, int pid, int sig )
{
/* FIXME: should do something here */
errno = ENOSYS;
return -1;
}
/* retrieve the thread context */ /* retrieve the thread context */
void get_thread_context( struct thread *thread, CONTEXT *context, unsigned int flags ) void get_thread_context( struct thread *thread, CONTEXT *context, unsigned int flags )
{ {
......
...@@ -550,34 +550,6 @@ void *get_thread_ip( struct thread *thread ) ...@@ -550,34 +550,6 @@ void *get_thread_ip( struct thread *thread )
return (void *)context.Eip; return (void *)context.Eip;
} }
/* send a signal to a specific thread */
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" (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;
#else
errno = ENOSYS;
return -1;
#endif
}
/* retrieve the thread context */ /* retrieve the thread context */
void get_thread_context( struct thread *thread, CONTEXT *context, unsigned int flags ) void get_thread_context( struct thread *thread, CONTEXT *context, unsigned int flags )
{ {
......
...@@ -273,14 +273,6 @@ void *get_thread_ip( struct thread *thread ) ...@@ -273,14 +273,6 @@ void *get_thread_ip( struct thread *thread )
return (void *)context.Iar; return (void *)context.Iar;
} }
/* send a signal to a specific thread */
int tkill( int tgid, int pid, int sig )
{
/* FIXME: should do something here */
errno = ENOSYS;
return -1;
}
/* retrieve the thread context */ /* retrieve the thread context */
void get_thread_context( struct thread *thread, CONTEXT *context, unsigned int flags ) void get_thread_context( struct thread *thread, CONTEXT *context, unsigned int flags )
{ {
......
...@@ -172,14 +172,6 @@ void *get_thread_ip( struct thread *thread ) ...@@ -172,14 +172,6 @@ void *get_thread_ip( struct thread *thread )
return (void *)context.pc; return (void *)context.pc;
} }
/* send a signal to a specific thread */
int tkill( int tgid, int pid, int sig )
{
/* FIXME: should do something here */
errno = ENOSYS;
return -1;
}
/* retrieve the thread context */ /* retrieve the thread context */
void get_thread_context( struct thread *thread, CONTEXT *context, unsigned int flags ) void get_thread_context( struct thread *thread, CONTEXT *context, unsigned int flags )
{ {
......
...@@ -261,22 +261,6 @@ void *get_thread_ip( struct thread *thread ) ...@@ -261,22 +261,6 @@ void *get_thread_ip( struct thread *thread )
return (void *)context.Rip; return (void *)context.Rip;
} }
/* send a signal to a specific thread */
int tkill( int tgid, int pid, int sig )
{
#ifdef __linux__
int ret;
__asm__( "syscall" : "=a" (ret)
: "0" (200) /*SYS_tkill*/, "D" (pid), "S" (sig) );
if (ret >= 0) return ret;
errno = -ret;
return -1;
#else
errno = ENOSYS;
return -1;
#endif
}
/* retrieve the thread context */ /* retrieve the thread context */
void get_thread_context( struct thread *thread, CONTEXT *context, unsigned int flags ) void get_thread_context( struct thread *thread, CONTEXT *context, unsigned int flags )
{ {
......
...@@ -173,6 +173,37 @@ int get_ptrace_pid( struct thread *thread ) ...@@ -173,6 +173,37 @@ int get_ptrace_pid( struct thread *thread )
return thread->unix_pid; return thread->unix_pid;
} }
/* send a signal to a specific thread */
static inline int tkill( int tgid, int pid, int sig )
{
int ret = -ENOSYS;
#ifdef __linux__
# ifdef __i386__
__asm__( "pushl %%ebx\n\t"
"movl %2,%%ebx\n\t"
"int $0x80\n\t"
"popl %%ebx\n\t"
: "=a" (ret)
: "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) );
# elif defined(__x86_64__)
__asm__( "syscall" : "=a" (ret)
: "0" (200) /*SYS_tkill*/, "D" (pid), "S" (sig) );
# endif
#endif /* __linux__ */
if (ret >= 0) return ret;
errno = -ret;
return -1;
}
/* send a Unix signal to a specific thread */ /* send a Unix signal to a specific thread */
int send_thread_signal( struct thread *thread, int sig ) int send_thread_signal( struct thread *thread, int sig )
{ {
......
...@@ -126,7 +126,6 @@ extern void resume_after_ptrace( struct thread *thread ); ...@@ -126,7 +126,6 @@ extern void resume_after_ptrace( struct thread *thread );
extern void *get_thread_ip( struct thread *thread ); extern void *get_thread_ip( 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 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 void get_selector_entry( struct thread *thread, int entry, unsigned int *base, extern void get_selector_entry( struct thread *thread, int entry, unsigned int *base,
unsigned int *limit, unsigned char *flags ); unsigned int *limit, unsigned char *flags );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment