Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
6a26e3f7
Commit
6a26e3f7
authored
Mar 21, 2003
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Split signal blocking code out of SIGNAL_Reset into SIGNAL_Block.
Added SIGTERM handler.
parent
bace7a11
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
129 additions
and
54 deletions
+129
-54
exception.c
dlls/ntdll/exception.c
+0
-2
signal_i386.c
dlls/ntdll/signal_i386.c
+42
-19
signal_powerpc.c
dlls/ntdll/signal_powerpc.c
+42
-16
signal_sparc.c
dlls/ntdll/signal_sparc.c
+41
-17
thread.h
include/thread.h
+2
-0
sysdeps.c
scheduler/sysdeps.c
+2
-0
No files found.
dlls/ntdll/exception.c
View file @
6a26e3f7
...
...
@@ -54,8 +54,6 @@ typedef struct
# error You must define GET_IP for this CPU
#endif
extern
void
SIGNAL_Unblock
(
void
);
void
WINAPI
EXC_RtlRaiseException
(
PEXCEPTION_RECORD
,
PCONTEXT
);
void
WINAPI
EXC_RtlUnwind
(
PEXCEPTION_FRAME
,
LPVOID
,
PEXCEPTION_RECORD
,
DWORD
,
PCONTEXT
);
...
...
dlls/ntdll/signal_i386.c
View file @
6a26e3f7
...
...
@@ -422,8 +422,6 @@ typedef int (*wine_signal_handler)(unsigned int sig);
static
wine_signal_handler
handlers
[
256
];
static
sigset_t
all_sigs
;
extern
void
WINAPI
EXC_RtlRaiseException
(
PEXCEPTION_RECORD
,
PCONTEXT
);
/***********************************************************************
...
...
@@ -752,17 +750,6 @@ static inline DWORD get_fpu_code( const CONTEXT *context )
}
/***********************************************************************
* SIGNAL_Unblock
*
* Unblock signals. Called from EXC_RtlRaiseException.
*/
void
SIGNAL_Unblock
(
void
)
{
sigprocmask
(
SIG_UNBLOCK
,
&
all_sigs
,
NULL
);
}
/**********************************************************************
* do_segv
*
...
...
@@ -1106,6 +1093,18 @@ static HANDLER_DEF(abrt_handler)
/**********************************************************************
* term_handler
*
* Handler for SIGTERM.
*/
static
HANDLER_DEF
(
term_handler
)
{
init_handler
(
HANDLER_CONTEXT
);
SYSDEPS_AbortThread
(
0
);
}
/**********************************************************************
* usr1_handler
*
* Handler for SIGUSR1, used to signal a thread that it got suspended.
...
...
@@ -1197,13 +1196,12 @@ BOOL SIGNAL_Init(void)
}
#endif
/* HAVE_SIGALTSTACK */
sigfillset
(
&
all_sigs
);
if
(
set_handler
(
SIGINT
,
have_sigaltstack
,
(
void
(
*
)())
int_handler
)
==
-
1
)
goto
error
;
if
(
set_handler
(
SIGFPE
,
have_sigaltstack
,
(
void
(
*
)())
fpe_handler
)
==
-
1
)
goto
error
;
if
(
set_handler
(
SIGSEGV
,
have_sigaltstack
,
(
void
(
*
)())
segv_handler
)
==
-
1
)
goto
error
;
if
(
set_handler
(
SIGILL
,
have_sigaltstack
,
(
void
(
*
)())
segv_handler
)
==
-
1
)
goto
error
;
if
(
set_handler
(
SIGABRT
,
have_sigaltstack
,
(
void
(
*
)())
abrt_handler
)
==
-
1
)
goto
error
;
if
(
set_handler
(
SIGTERM
,
have_sigaltstack
,
(
void
(
*
)())
term_handler
)
==
-
1
)
goto
error
;
if
(
set_handler
(
SIGUSR1
,
have_sigaltstack
,
(
void
(
*
)())
usr1_handler
)
==
-
1
)
goto
error
;
#ifdef SIGBUS
if
(
set_handler
(
SIGBUS
,
have_sigaltstack
,
(
void
(
*
)())
segv_handler
)
==
-
1
)
goto
error
;
...
...
@@ -1226,13 +1224,14 @@ BOOL SIGNAL_Init(void)
/**********************************************************************
* SIGNAL_Reset
* SIGNAL_Block
*
* Block the async signals.
*/
void
SIGNAL_
Reset
(
void
)
void
SIGNAL_
Block
(
void
)
{
sigset_t
block_set
;
/* block the async signals */
sigemptyset
(
&
block_set
);
sigaddset
(
&
block_set
,
SIGALRM
);
sigaddset
(
&
block_set
,
SIGIO
);
...
...
@@ -1240,12 +1239,36 @@ void SIGNAL_Reset(void)
sigaddset
(
&
block_set
,
SIGUSR1
);
sigaddset
(
&
block_set
,
SIGUSR2
);
sigprocmask
(
SIG_BLOCK
,
&
block_set
,
NULL
);
}
/***********************************************************************
* SIGNAL_Unblock
*
* Unblock signals. Called from EXC_RtlRaiseException.
*/
void
SIGNAL_Unblock
(
void
)
{
sigset_t
all_sigs
;
/* restore default handlers */
sigfillset
(
&
all_sigs
);
sigprocmask
(
SIG_UNBLOCK
,
&
all_sigs
,
NULL
);
}
/**********************************************************************
* SIGNAL_Reset
*
* Restore the default handlers.
*/
void
SIGNAL_Reset
(
void
)
{
signal
(
SIGINT
,
SIG_DFL
);
signal
(
SIGFPE
,
SIG_DFL
);
signal
(
SIGSEGV
,
SIG_DFL
);
signal
(
SIGILL
,
SIG_DFL
);
signal
(
SIGABRT
,
SIG_DFL
);
signal
(
SIGTERM
,
SIG_DFL
);
#ifdef SIGBUS
signal
(
SIGBUS
,
SIG_DFL
);
#endif
...
...
dlls/ntdll/signal_powerpc.c
View file @
6a26e3f7
...
...
@@ -76,8 +76,6 @@ typedef int (*wine_signal_handler)(unsigned int sig);
static
wine_signal_handler
handlers
[
256
];
static
sigset_t
all_sigs
;
extern
void
WINAPI
EXC_RtlRaiseException
(
PEXCEPTION_RECORD
,
PCONTEXT
);
/***********************************************************************
...
...
@@ -190,16 +188,6 @@ static inline DWORD get_fpu_code( const CONTEXT *context )
}
/***********************************************************************
* SIGNAL_Unblock
*
* Unblock signals. Called from EXC_RtlRaiseException.
*/
void
SIGNAL_Unblock
(
void
)
{
sigprocmask
(
SIG_UNBLOCK
,
&
all_sigs
,
NULL
);
}
/**********************************************************************
* segv_handler
*
...
...
@@ -404,6 +392,17 @@ static HANDLER_DEF(abrt_handler)
/**********************************************************************
* term_handler
*
* Handler for SIGTERM.
*/
static
HANDLER_DEF
(
term_handler
)
{
SYSDEPS_AbortThread
(
0
);
}
/**********************************************************************
* usr1_handler
*
* Handler for SIGUSR1, used to signal a thread that it got suspended.
...
...
@@ -474,6 +473,7 @@ BOOL SIGNAL_Init(void)
if
(
set_handler
(
SIGSEGV
,
have_sigaltstack
,
(
void
(
*
)())
segv_handler
)
==
-
1
)
goto
error
;
if
(
set_handler
(
SIGILL
,
have_sigaltstack
,
(
void
(
*
)())
segv_handler
)
==
-
1
)
goto
error
;
if
(
set_handler
(
SIGABRT
,
have_sigaltstack
,
(
void
(
*
)())
abrt_handler
)
==
-
1
)
goto
error
;
if
(
set_handler
(
SIGTERM
,
have_sigaltstack
,
(
void
(
*
)())
term_handler
)
==
-
1
)
goto
error
;
if
(
set_handler
(
SIGUSR1
,
have_sigaltstack
,
(
void
(
*
)())
usr1_handler
)
==
-
1
)
goto
error
;
#ifdef SIGBUS
if
(
set_handler
(
SIGBUS
,
have_sigaltstack
,
(
void
(
*
)())
segv_handler
)
==
-
1
)
goto
error
;
...
...
@@ -491,13 +491,14 @@ BOOL SIGNAL_Init(void)
/**********************************************************************
* SIGNAL_Reset
* SIGNAL_Block
*
* Block the async signals.
*/
void
SIGNAL_
Reset
(
void
)
void
SIGNAL_
Block
(
void
)
{
sigset_t
block_set
;
/* block the async signals */
sigemptyset
(
&
block_set
);
sigaddset
(
&
block_set
,
SIGALRM
);
sigaddset
(
&
block_set
,
SIGIO
);
...
...
@@ -505,12 +506,36 @@ void SIGNAL_Reset(void)
sigaddset
(
&
block_set
,
SIGUSR1
);
sigaddset
(
&
block_set
,
SIGUSR2
);
sigprocmask
(
SIG_BLOCK
,
&
block_set
,
NULL
);
}
/* restore default handlers */
/***********************************************************************
* SIGNAL_Unblock
*
* Unblock signals. Called from EXC_RtlRaiseException.
*/
void
SIGNAL_Unblock
(
void
)
{
sigset_t
all_sigs
;
sigfillset
(
&
all_sigs
);
sigprocmask
(
SIG_UNBLOCK
,
&
all_sigs
,
NULL
);
}
/**********************************************************************
* SIGNAL_Reset
*
* Restore the default handlers.
*/
void
SIGNAL_Reset
(
void
)
{
signal
(
SIGINT
,
SIG_DFL
);
signal
(
SIGFPE
,
SIG_DFL
);
signal
(
SIGSEGV
,
SIG_DFL
);
signal
(
SIGILL
,
SIG_DFL
);
signal
(
SIGABRT
,
SIG_DFL
);
signal
(
SIGTERM
,
SIG_DFL
);
#ifdef SIGBUS
signal
(
SIGBUS
,
SIG_DFL
);
#endif
...
...
@@ -519,6 +544,7 @@ void SIGNAL_Reset(void)
#endif
}
/**********************************************************************
* __wine_enter_vm86 (NTDLL.@)
*/
...
...
dlls/ntdll/signal_sparc.c
View file @
6a26e3f7
...
...
@@ -49,8 +49,6 @@ typedef int (*wine_signal_handler)(unsigned int sig);
static
wine_signal_handler
handlers
[
256
];
static
sigset_t
all_sigs
;
extern
void
WINAPI
EXC_RtlRaiseException
(
PEXCEPTION_RECORD
,
PCONTEXT
);
/***********************************************************************
...
...
@@ -369,6 +367,17 @@ static HANDLER_DEF(abrt_handler)
/**********************************************************************
* term_handler
*
* Handler for SIGTERM.
*/
static
HANDLER_DEF
(
term_handler
)
{
SYSDEPS_AbortThread
(
0
);
}
/**********************************************************************
* usr1_handler
*
* Handler for SIGUSR1, used to signal a thread that it got suspended.
...
...
@@ -410,17 +419,6 @@ int __wine_set_signal_handler(unsigned int sig, wine_signal_handler wsh)
}
/***********************************************************************
* SIGNAL_Unblock
*
* Unblock signals. Called from EXC_RtlRaiseException.
*/
void
SIGNAL_Unblock
(
void
)
{
sigprocmask
(
SIG_UNBLOCK
,
&
all_sigs
,
NULL
);
}
/**********************************************************************
* SIGNAL_Init
*/
...
...
@@ -435,6 +433,7 @@ BOOL SIGNAL_Init(void)
if
(
set_handler
(
SIGBUS
,
(
void
(
*
)())
bus_handler
)
==
-
1
)
goto
error
;
if
(
set_handler
(
SIGTRAP
,
(
void
(
*
)())
trap_handler
)
==
-
1
)
goto
error
;
if
(
set_handler
(
SIGABRT
,
(
void
(
*
)())
abrt_handler
)
==
-
1
)
goto
error
;
if
(
set_handler
(
SIGTERM
,
(
void
(
*
)())
term_handler
)
==
-
1
)
goto
error
;
if
(
set_handler
(
SIGUSR1
,
(
void
(
*
)())
usr1_handler
)
==
-
1
)
goto
error
;
return
TRUE
;
...
...
@@ -445,13 +444,14 @@ BOOL SIGNAL_Init(void)
/**********************************************************************
* SIGNAL_Reset
* SIGNAL_Block
*
* Block the async signals.
*/
void
SIGNAL_
Reset
(
void
)
void
SIGNAL_
Block
(
void
)
{
sigset_t
block_set
;
/* block the async signals */
sigemptyset
(
&
block_set
);
sigaddset
(
&
block_set
,
SIGALRM
);
sigaddset
(
&
block_set
,
SIGIO
);
...
...
@@ -459,14 +459,38 @@ void SIGNAL_Reset(void)
sigaddset
(
&
block_set
,
SIGUSR1
);
sigaddset
(
&
block_set
,
SIGUSR2
);
sigprocmask
(
SIG_BLOCK
,
&
block_set
,
NULL
);
}
/***********************************************************************
* SIGNAL_Unblock
*
* Unblock signals. Called from EXC_RtlRaiseException.
*/
void
SIGNAL_Unblock
(
void
)
{
sigset_t
all_sigs
;
sigfillset
(
&
all_sigs
);
sigprocmask
(
SIG_UNBLOCK
,
&
all_sigs
,
NULL
);
}
/* restore default handlers */
/**********************************************************************
* SIGNAL_Reset
*
* Restore the default handlers.
*/
void
SIGNAL_Reset
(
void
)
{
signal
(
SIGINT
,
SIG_DFL
);
signal
(
SIGFPE
,
SIG_DFL
);
signal
(
SIGSEGV
,
SIG_DFL
);
signal
(
SIGILL
,
SIG_DFL
);
signal
(
SIGBUS
,
SIG_DFL
);
signal
(
SIGTRAP
,
SIG_DFL
);
signal
(
SIGABRT
,
SIG_DFL
);
signal
(
SIGTERM
,
SIG_DFL
);
}
...
...
include/thread.h
View file @
6a26e3f7
...
...
@@ -153,6 +153,8 @@ extern void DECLSPEC_NORETURN SYSDEPS_SwitchToThreadStack( void (*func)(void) );
/* signal handling */
extern
BOOL
SIGNAL_Init
(
void
);
extern
void
SIGNAL_Block
(
void
);
extern
void
SIGNAL_Unblock
(
void
);
extern
void
SIGNAL_Reset
(
void
);
#endif
/* __WINE_THREAD_H */
scheduler/sysdeps.c
View file @
6a26e3f7
...
...
@@ -284,6 +284,7 @@ void SYSDEPS_ExitThread( int status )
info
.
stack_size
=
meminfo
.
RegionSize
+
((
char
*
)
teb
->
stack_top
-
(
char
*
)
meminfo
.
AllocationBase
);
info
.
status
=
status
;
SIGNAL_Block
();
SIGNAL_Reset
();
VirtualFree
(
teb
->
stack_base
,
0
,
MEM_RELEASE
|
MEM_SYSTEM
);
...
...
@@ -304,6 +305,7 @@ void SYSDEPS_ExitThread( int status )
*/
void
SYSDEPS_AbortThread
(
int
status
)
{
SIGNAL_Block
();
SIGNAL_Reset
();
close
(
NtCurrentTeb
()
->
wait_fd
[
0
]
);
close
(
NtCurrentTeb
()
->
wait_fd
[
1
]
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment