Commit 683583fa authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Remove support for setting custom signal handlers.

parent 173644b0
...@@ -1601,9 +1601,6 @@ ...@@ -1601,9 +1601,6 @@
# Codepages # Codepages
@ cdecl __wine_get_unix_codepage() @ cdecl __wine_get_unix_codepage()
# signal handling
@ cdecl __wine_set_signal_handler(long ptr)
# Filesystem # Filesystem
@ cdecl wine_nt_to_unix_file_name(ptr ptr long long) @ cdecl wine_nt_to_unix_file_name(ptr ptr long long)
@ cdecl wine_unix_to_nt_file_name(ptr ptr) @ cdecl wine_unix_to_nt_file_name(ptr ptr)
...@@ -119,9 +119,6 @@ enum arm_trap_code ...@@ -119,9 +119,6 @@ enum arm_trap_code
}; };
typedef void (WINAPI *raise_func)( EXCEPTION_RECORD *rec, CONTEXT *context ); typedef void (WINAPI *raise_func)( EXCEPTION_RECORD *rec, CONTEXT *context );
typedef int (*wine_signal_handler)(unsigned int sig);
static wine_signal_handler handlers[256];
/*********************************************************************** /***********************************************************************
...@@ -164,15 +161,6 @@ static inline WORD get_error_code( const ucontext_t *sigcontext ) ...@@ -164,15 +161,6 @@ static inline WORD get_error_code( const ucontext_t *sigcontext )
#endif #endif
} }
/***********************************************************************
* dispatch_signal
*/
static inline int dispatch_signal(unsigned int sig)
{
if (handlers[sig] == NULL) return 0;
return handlers[sig](sig);
}
/******************************************************************* /*******************************************************************
* is_valid_frame * is_valid_frame
*/ */
...@@ -700,22 +688,19 @@ static void fpe_handler( int signal, siginfo_t *siginfo, void *sigcontext ) ...@@ -700,22 +688,19 @@ static void fpe_handler( int signal, siginfo_t *siginfo, void *sigcontext )
*/ */
static void int_handler( int signal, siginfo_t *siginfo, void *sigcontext ) static void int_handler( int signal, siginfo_t *siginfo, void *sigcontext )
{ {
if (!dispatch_signal(SIGINT)) EXCEPTION_RECORD rec;
{ CONTEXT context;
EXCEPTION_RECORD rec; NTSTATUS status;
CONTEXT context;
NTSTATUS status; save_context( &context, sigcontext );
rec.ExceptionCode = CONTROL_C_EXIT;
save_context( &context, sigcontext ); rec.ExceptionFlags = EXCEPTION_CONTINUABLE;
rec.ExceptionCode = CONTROL_C_EXIT; rec.ExceptionRecord = NULL;
rec.ExceptionFlags = EXCEPTION_CONTINUABLE; rec.ExceptionAddress = (LPVOID)context.Pc;
rec.ExceptionRecord = NULL; rec.NumberParameters = 0;
rec.ExceptionAddress = (LPVOID)context.Pc; status = raise_exception( &rec, &context, TRUE );
rec.NumberParameters = 0; if (status) raise_status( status, &rec );
status = raise_exception( &rec, &context, TRUE ); restore_context( &context, sigcontext );
if (status) raise_status( status, &rec );
restore_context( &context, sigcontext );
}
} }
...@@ -768,18 +753,6 @@ static void usr1_handler( int signal, siginfo_t *siginfo, void *sigcontext ) ...@@ -768,18 +753,6 @@ static void usr1_handler( int signal, siginfo_t *siginfo, void *sigcontext )
} }
/***********************************************************************
* __wine_set_signal_handler (NTDLL.@)
*/
int CDECL __wine_set_signal_handler(unsigned int sig, wine_signal_handler wsh)
{
if (sig >= ARRAY_SIZE(handlers)) return -1;
if (handlers[sig] != NULL) return -2;
handlers[sig] = wsh;
return 0;
}
/********************************************************************** /**********************************************************************
* signal_init_process * signal_init_process
*/ */
......
...@@ -141,10 +141,6 @@ struct stack_layout ...@@ -141,10 +141,6 @@ struct stack_layout
void *redzone[2]; void *redzone[2];
}; };
typedef int (*wine_signal_handler)(unsigned int sig);
static wine_signal_handler handlers[256];
struct arm64_thread_data struct arm64_thread_data
{ {
void *exit_frame; /* exit frame pointer */ void *exit_frame; /* exit frame pointer */
...@@ -160,15 +156,6 @@ static inline struct arm64_thread_data *arm64_thread_data(void) ...@@ -160,15 +156,6 @@ static inline struct arm64_thread_data *arm64_thread_data(void)
} }
/*********************************************************************** /***********************************************************************
* dispatch_signal
*/
static inline int dispatch_signal(unsigned int sig)
{
if (handlers[sig] == NULL) return 0;
return handlers[sig](sig);
}
/***********************************************************************
* get_signal_stack * get_signal_stack
* *
* Get the base of the signal stack for the current thread. * Get the base of the signal stack for the current thread.
...@@ -998,13 +985,10 @@ static void fpe_handler( int signal, siginfo_t *siginfo, void *sigcontext ) ...@@ -998,13 +985,10 @@ static void fpe_handler( int signal, siginfo_t *siginfo, void *sigcontext )
*/ */
static void int_handler( int signal, siginfo_t *siginfo, void *sigcontext ) static void int_handler( int signal, siginfo_t *siginfo, void *sigcontext )
{ {
if (!dispatch_signal(SIGINT)) struct stack_layout *stack = setup_exception( sigcontext );
{
struct stack_layout *stack = setup_exception( sigcontext );
stack->rec.ExceptionCode = CONTROL_C_EXIT; stack->rec.ExceptionCode = CONTROL_C_EXIT;
setup_raise_exception( sigcontext, stack ); setup_raise_exception( sigcontext, stack );
}
} }
...@@ -1064,18 +1048,6 @@ static void usr2_handler( int signal, siginfo_t *siginfo, void *sigcontext ) ...@@ -1064,18 +1048,6 @@ static void usr2_handler( int signal, siginfo_t *siginfo, void *sigcontext )
} }
/***********************************************************************
* __wine_set_signal_handler (NTDLL.@)
*/
int CDECL __wine_set_signal_handler(unsigned int sig, wine_signal_handler wsh)
{
if (sig >= ARRAY_SIZE(handlers)) return -1;
if (handlers[sig] != NULL) return -2;
handlers[sig] = wsh;
return 0;
}
/********************************************************************** /**********************************************************************
* signal_init_process * signal_init_process
*/ */
......
...@@ -442,12 +442,8 @@ struct stack_layout ...@@ -442,12 +442,8 @@ struct stack_layout
DWORD eip; DWORD eip;
}; };
typedef int (*wine_signal_handler)(unsigned int sig);
static ULONG first_ldt_entry = 32; static ULONG first_ldt_entry = 32;
static wine_signal_handler handlers[256];
enum i386_trap_code enum i386_trap_code
{ {
TRAP_x86_UNKNOWN = -1, /* Unknown fault (TRAP_sig not defined) */ TRAP_x86_UNKNOWN = -1, /* Unknown fault (TRAP_sig not defined) */
...@@ -552,16 +548,6 @@ static inline int ldt_is_system( WORD sel ) ...@@ -552,16 +548,6 @@ static inline int ldt_is_system( WORD sel )
} }
/*********************************************************************** /***********************************************************************
* dispatch_signal
*/
static inline int dispatch_signal(unsigned int sig)
{
if (handlers[sig] == NULL) return 0;
return handlers[sig](sig);
}
/***********************************************************************
* get_trap_code * get_trap_code
* *
* Get the trap code for a signal. * Get the trap code for a signal.
...@@ -1800,19 +1786,12 @@ static void fpe_handler( int signal, siginfo_t *siginfo, void *sigcontext ) ...@@ -1800,19 +1786,12 @@ static void fpe_handler( int signal, siginfo_t *siginfo, void *sigcontext )
* int_handler * int_handler
* *
* Handler for SIGINT. * Handler for SIGINT.
*
* FIXME: should not be calling external functions on the signal stack.
*/ */
static void int_handler( int signal, siginfo_t *siginfo, void *sigcontext ) static void int_handler( int signal, siginfo_t *siginfo, void *sigcontext )
{ {
WORD fs, gs; struct stack_layout *stack = setup_exception( sigcontext );
void *stack_ptr = init_handler( sigcontext, &fs, &gs ); stack->rec.ExceptionCode = CONTROL_C_EXIT;
if (!dispatch_signal(SIGINT)) setup_raise_exception( sigcontext, stack );
{
struct stack_layout *stack = setup_exception_record( sigcontext, stack_ptr, fs, gs );
stack->rec.ExceptionCode = CONTROL_C_EXIT;
setup_raise_exception( sigcontext, stack );
}
} }
/********************************************************************** /**********************************************************************
...@@ -1859,18 +1838,6 @@ static void usr1_handler( int signal, siginfo_t *siginfo, void *sigcontext ) ...@@ -1859,18 +1838,6 @@ static void usr1_handler( int signal, siginfo_t *siginfo, void *sigcontext )
} }
/***********************************************************************
* __wine_set_signal_handler (NTDLL.@)
*/
int CDECL __wine_set_signal_handler(unsigned int sig, wine_signal_handler wsh)
{
if (sig >= ARRAY_SIZE(handlers)) return -1;
if (handlers[sig] != NULL) return -2;
handlers[sig] = wsh;
return 0;
}
/********************************************************************** /**********************************************************************
* signal_init_process * signal_init_process
*/ */
......
...@@ -140,20 +140,6 @@ SIGFPE ...@@ -140,20 +140,6 @@ SIGFPE
#endif /* __APPLE__ */ #endif /* __APPLE__ */
typedef int (*wine_signal_handler)(unsigned int sig);
static wine_signal_handler handlers[256];
/***********************************************************************
* dispatch_signal
*/
static inline int dispatch_signal(unsigned int sig)
{
if (handlers[sig] == NULL) return 0;
return handlers[sig](sig);
}
/*********************************************************************** /***********************************************************************
* save_context * save_context
* *
...@@ -599,22 +585,19 @@ static void fpe_handler( int signal, siginfo_t *siginfo, void *sigcontext ) ...@@ -599,22 +585,19 @@ static void fpe_handler( int signal, siginfo_t *siginfo, void *sigcontext )
*/ */
static void int_handler( int signal, siginfo_t *siginfo, void *sigcontext ) static void int_handler( int signal, siginfo_t *siginfo, void *sigcontext )
{ {
if (!dispatch_signal(SIGINT)) EXCEPTION_RECORD rec;
{ CONTEXT context;
EXCEPTION_RECORD rec; NTSTATUS status;
CONTEXT context;
NTSTATUS status; save_context( &context, sigcontext );
rec.ExceptionCode = CONTROL_C_EXIT;
save_context( &context, sigcontext ); rec.ExceptionFlags = EXCEPTION_CONTINUABLE;
rec.ExceptionCode = CONTROL_C_EXIT; rec.ExceptionRecord = NULL;
rec.ExceptionFlags = EXCEPTION_CONTINUABLE; rec.ExceptionAddress = (LPVOID)context.Iar;
rec.ExceptionRecord = NULL; rec.NumberParameters = 0;
rec.ExceptionAddress = (LPVOID)context.Iar; status = raise_exception( &rec, &context, TRUE );
rec.NumberParameters = 0; if (status) raise_status( status, &rec );
status = raise_exception( &rec, &context, TRUE ); restore_context( &context, sigcontext );
if (status) raise_status( status, &rec );
restore_context( &context, sigcontext );
}
} }
...@@ -667,18 +650,6 @@ static void usr1_handler( int signal, siginfo_t *siginfo, void *sigcontext ) ...@@ -667,18 +650,6 @@ static void usr1_handler( int signal, siginfo_t *siginfo, void *sigcontext )
} }
/***********************************************************************
* __wine_set_signal_handler (NTDLL.@)
*/
int CDECL __wine_set_signal_handler(unsigned int sig, wine_signal_handler wsh)
{
if (sig >= ARRAY_SIZE(handlers)) return -1;
if (handlers[sig] != NULL) return -2;
handlers[sig] = wsh;
return 0;
}
/********************************************************************** /**********************************************************************
* signal_init_process * signal_init_process
*/ */
......
...@@ -292,10 +292,6 @@ struct stack_layout ...@@ -292,10 +292,6 @@ struct stack_layout
ULONG64 red_zone[16]; ULONG64 red_zone[16];
}; };
typedef int (*wine_signal_handler)(unsigned int sig);
static wine_signal_handler handlers[256];
struct amd64_thread_data struct amd64_thread_data
{ {
DWORD_PTR dr0; /* debug registers */ DWORD_PTR dr0; /* debug registers */
...@@ -1635,15 +1631,6 @@ static NTSTATUS virtual_unwind( ULONG type, DISPATCHER_CONTEXT *dispatch, CONTEX ...@@ -1635,15 +1631,6 @@ static NTSTATUS virtual_unwind( ULONG type, DISPATCHER_CONTEXT *dispatch, CONTEX
} }
/*********************************************************************** /***********************************************************************
* dispatch_signal
*/
static inline int dispatch_signal(unsigned int sig)
{
if (handlers[sig] == NULL) return 0;
return handlers[sig](sig);
}
/***********************************************************************
* get_signal_stack * get_signal_stack
* *
* Get the base of the signal stack for the current thread. * Get the base of the signal stack for the current thread.
...@@ -2705,12 +2692,9 @@ static void fpe_handler( int signal, siginfo_t *siginfo, void *sigcontext ) ...@@ -2705,12 +2692,9 @@ static void fpe_handler( int signal, siginfo_t *siginfo, void *sigcontext )
*/ */
static void int_handler( int signal, siginfo_t *siginfo, void *sigcontext ) static void int_handler( int signal, siginfo_t *siginfo, void *sigcontext )
{ {
if (!dispatch_signal(SIGINT)) struct stack_layout *stack = setup_exception( sigcontext );
{ stack->rec.ExceptionCode = CONTROL_C_EXIT;
struct stack_layout *stack = setup_exception( sigcontext ); setup_raise_exception( sigcontext, stack );
stack->rec.ExceptionCode = CONTROL_C_EXIT;
setup_raise_exception( sigcontext, stack );
}
} }
...@@ -2754,18 +2738,6 @@ static void usr1_handler( int signal, siginfo_t *siginfo, void *ucontext ) ...@@ -2754,18 +2738,6 @@ static void usr1_handler( int signal, siginfo_t *siginfo, void *ucontext )
} }
/***********************************************************************
* __wine_set_signal_handler (NTDLL.@)
*/
int CDECL __wine_set_signal_handler(unsigned int sig, wine_signal_handler wsh)
{
if (sig >= ARRAY_SIZE(handlers)) return -1;
if (handlers[sig] != NULL) return -2;
handlers[sig] = wsh;
return 0;
}
/********************************************************************** /**********************************************************************
* signal_init_process * signal_init_process
*/ */
......
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