ntdll: Remove support for setting custom signal handlers.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
173644b08f
commit
683583faf2
|
@ -1601,9 +1601,6 @@
|
|||
# Codepages
|
||||
@ cdecl __wine_get_unix_codepage()
|
||||
|
||||
# signal handling
|
||||
@ cdecl __wine_set_signal_handler(long ptr)
|
||||
|
||||
# Filesystem
|
||||
@ cdecl wine_nt_to_unix_file_name(ptr ptr long long)
|
||||
@ cdecl wine_unix_to_nt_file_name(ptr ptr)
|
||||
|
|
|
@ -119,9 +119,6 @@ enum arm_trap_code
|
|||
};
|
||||
|
||||
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 )
|
|||
#endif
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* dispatch_signal
|
||||
*/
|
||||
static inline int dispatch_signal(unsigned int sig)
|
||||
{
|
||||
if (handlers[sig] == NULL) return 0;
|
||||
return handlers[sig](sig);
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
* is_valid_frame
|
||||
*/
|
||||
|
@ -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 )
|
||||
{
|
||||
if (!dispatch_signal(SIGINT))
|
||||
{
|
||||
EXCEPTION_RECORD rec;
|
||||
CONTEXT context;
|
||||
NTSTATUS status;
|
||||
EXCEPTION_RECORD rec;
|
||||
CONTEXT context;
|
||||
NTSTATUS status;
|
||||
|
||||
save_context( &context, sigcontext );
|
||||
rec.ExceptionCode = CONTROL_C_EXIT;
|
||||
rec.ExceptionFlags = EXCEPTION_CONTINUABLE;
|
||||
rec.ExceptionRecord = NULL;
|
||||
rec.ExceptionAddress = (LPVOID)context.Pc;
|
||||
rec.NumberParameters = 0;
|
||||
status = raise_exception( &rec, &context, TRUE );
|
||||
if (status) raise_status( status, &rec );
|
||||
restore_context( &context, sigcontext );
|
||||
}
|
||||
save_context( &context, sigcontext );
|
||||
rec.ExceptionCode = CONTROL_C_EXIT;
|
||||
rec.ExceptionFlags = EXCEPTION_CONTINUABLE;
|
||||
rec.ExceptionRecord = NULL;
|
||||
rec.ExceptionAddress = (LPVOID)context.Pc;
|
||||
rec.NumberParameters = 0;
|
||||
status = raise_exception( &rec, &context, TRUE );
|
||||
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 )
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* __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
|
||||
*/
|
||||
|
|
|
@ -141,10 +141,6 @@ struct stack_layout
|
|||
void *redzone[2];
|
||||
};
|
||||
|
||||
typedef int (*wine_signal_handler)(unsigned int sig);
|
||||
|
||||
static wine_signal_handler handlers[256];
|
||||
|
||||
struct arm64_thread_data
|
||||
{
|
||||
void *exit_frame; /* exit frame pointer */
|
||||
|
@ -159,15 +155,6 @@ static inline struct arm64_thread_data *arm64_thread_data(void)
|
|||
return (struct arm64_thread_data *)NtCurrentTeb()->SystemReserved2;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* dispatch_signal
|
||||
*/
|
||||
static inline int dispatch_signal(unsigned int sig)
|
||||
{
|
||||
if (handlers[sig] == NULL) return 0;
|
||||
return handlers[sig](sig);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* get_signal_stack
|
||||
*
|
||||
|
@ -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 )
|
||||
{
|
||||
if (!dispatch_signal(SIGINT))
|
||||
{
|
||||
struct stack_layout *stack = setup_exception( sigcontext );
|
||||
struct stack_layout *stack = setup_exception( sigcontext );
|
||||
|
||||
stack->rec.ExceptionCode = CONTROL_C_EXIT;
|
||||
setup_raise_exception( sigcontext, stack );
|
||||
}
|
||||
stack->rec.ExceptionCode = CONTROL_C_EXIT;
|
||||
setup_raise_exception( sigcontext, stack );
|
||||
}
|
||||
|
||||
|
||||
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -442,12 +442,8 @@ struct stack_layout
|
|||
DWORD eip;
|
||||
};
|
||||
|
||||
typedef int (*wine_signal_handler)(unsigned int sig);
|
||||
|
||||
static ULONG first_ldt_entry = 32;
|
||||
|
||||
static wine_signal_handler handlers[256];
|
||||
|
||||
enum i386_trap_code
|
||||
{
|
||||
TRAP_x86_UNKNOWN = -1, /* Unknown fault (TRAP_sig not defined) */
|
||||
|
@ -551,16 +547,6 @@ static inline int ldt_is_system( WORD sel )
|
|||
return is_gdt_sel( sel ) || ((sel >> 3) < first_ldt_entry);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* dispatch_signal
|
||||
*/
|
||||
static inline int dispatch_signal(unsigned int sig)
|
||||
{
|
||||
if (handlers[sig] == NULL) return 0;
|
||||
return handlers[sig](sig);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* get_trap_code
|
||||
*
|
||||
|
@ -1800,19 +1786,12 @@ static void fpe_handler( int signal, siginfo_t *siginfo, void *sigcontext )
|
|||
* int_handler
|
||||
*
|
||||
* 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 )
|
||||
{
|
||||
WORD fs, gs;
|
||||
void *stack_ptr = init_handler( sigcontext, &fs, &gs );
|
||||
if (!dispatch_signal(SIGINT))
|
||||
{
|
||||
struct stack_layout *stack = setup_exception_record( sigcontext, stack_ptr, fs, gs );
|
||||
stack->rec.ExceptionCode = CONTROL_C_EXIT;
|
||||
setup_raise_exception( sigcontext, stack );
|
||||
}
|
||||
struct stack_layout *stack = setup_exception( sigcontext );
|
||||
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 )
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* __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
|
||||
*/
|
||||
|
|
|
@ -140,20 +140,6 @@ SIGFPE
|
|||
#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
|
||||
*
|
||||
|
@ -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 )
|
||||
{
|
||||
if (!dispatch_signal(SIGINT))
|
||||
{
|
||||
EXCEPTION_RECORD rec;
|
||||
CONTEXT context;
|
||||
NTSTATUS status;
|
||||
EXCEPTION_RECORD rec;
|
||||
CONTEXT context;
|
||||
NTSTATUS status;
|
||||
|
||||
save_context( &context, sigcontext );
|
||||
rec.ExceptionCode = CONTROL_C_EXIT;
|
||||
rec.ExceptionFlags = EXCEPTION_CONTINUABLE;
|
||||
rec.ExceptionRecord = NULL;
|
||||
rec.ExceptionAddress = (LPVOID)context.Iar;
|
||||
rec.NumberParameters = 0;
|
||||
status = raise_exception( &rec, &context, TRUE );
|
||||
if (status) raise_status( status, &rec );
|
||||
restore_context( &context, sigcontext );
|
||||
}
|
||||
save_context( &context, sigcontext );
|
||||
rec.ExceptionCode = CONTROL_C_EXIT;
|
||||
rec.ExceptionFlags = EXCEPTION_CONTINUABLE;
|
||||
rec.ExceptionRecord = NULL;
|
||||
rec.ExceptionAddress = (LPVOID)context.Iar;
|
||||
rec.NumberParameters = 0;
|
||||
status = raise_exception( &rec, &context, TRUE );
|
||||
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 )
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* __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
|
||||
*/
|
||||
|
|
|
@ -292,10 +292,6 @@ struct stack_layout
|
|||
ULONG64 red_zone[16];
|
||||
};
|
||||
|
||||
typedef int (*wine_signal_handler)(unsigned int sig);
|
||||
|
||||
static wine_signal_handler handlers[256];
|
||||
|
||||
struct amd64_thread_data
|
||||
{
|
||||
DWORD_PTR dr0; /* debug registers */
|
||||
|
@ -1634,15 +1630,6 @@ static NTSTATUS virtual_unwind( ULONG type, DISPATCHER_CONTEXT *dispatch, CONTEX
|
|||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* dispatch_signal
|
||||
*/
|
||||
static inline int dispatch_signal(unsigned int sig)
|
||||
{
|
||||
if (handlers[sig] == NULL) return 0;
|
||||
return handlers[sig](sig);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* get_signal_stack
|
||||
*
|
||||
|
@ -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 )
|
||||
{
|
||||
if (!dispatch_signal(SIGINT))
|
||||
{
|
||||
struct stack_layout *stack = setup_exception( sigcontext );
|
||||
stack->rec.ExceptionCode = CONTROL_C_EXIT;
|
||||
setup_raise_exception( sigcontext, stack );
|
||||
}
|
||||
struct stack_layout *stack = setup_exception( sigcontext );
|
||||
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 )
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* __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
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue