server: Moved the tkill function to ptrace.c.

This commit is contained in:
Alexandre Julliard 2006-04-10 21:07:21 +02:00
parent d8659a9773
commit 7dbd1f01f2
7 changed files with 31 additions and 69 deletions

View File

@ -334,14 +334,6 @@ void *get_thread_ip( struct thread *thread )
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 */
void get_thread_context( struct thread *thread, CONTEXT *context, unsigned int flags )
{

View File

@ -550,34 +550,6 @@ void *get_thread_ip( struct thread *thread )
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 */
void get_thread_context( struct thread *thread, CONTEXT *context, unsigned int flags )
{

View File

@ -273,14 +273,6 @@ void *get_thread_ip( struct thread *thread )
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 */
void get_thread_context( struct thread *thread, CONTEXT *context, unsigned int flags )
{

View File

@ -172,14 +172,6 @@ void *get_thread_ip( struct thread *thread )
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 */
void get_thread_context( struct thread *thread, CONTEXT *context, unsigned int flags )
{

View File

@ -261,22 +261,6 @@ void *get_thread_ip( struct thread *thread )
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 */
void get_thread_context( struct thread *thread, CONTEXT *context, unsigned int flags )
{

View File

@ -173,6 +173,37 @@ int get_ptrace_pid( struct thread *thread )
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 */
int send_thread_signal( struct thread *thread, int sig )
{

View File

@ -126,7 +126,6 @@ extern void resume_after_ptrace( 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 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 void get_selector_entry( struct thread *thread, int entry, unsigned int *base,
unsigned int *limit, unsigned char *flags );