make signalHandler work on DARWIN
This commit is contained in:
@@ -16,7 +16,7 @@ SaveSignals *saved_sigs;
|
|||||||
static int signals[] = {
|
static int signals[] = {
|
||||||
SIGALRM, SIGBUS, SIGFPE, SIGHUP, SIGILL, SIGINT, SIGABRT,
|
SIGALRM, SIGBUS, SIGFPE, SIGHUP, SIGILL, SIGINT, SIGABRT,
|
||||||
SIGQUIT, SIGSEGV, SIGTRAP, SIGTERM, SIGVTALRM, SIGXCPU, SIGXFSZ,
|
SIGQUIT, SIGSEGV, SIGTRAP, SIGTERM, SIGVTALRM, SIGXCPU, SIGXFSZ,
|
||||||
#if defined(HAVE_DECL_SIGPWR) && HAVE_DECL_SIGPWR
|
#if defined(HAVE_DECL_SIGPWR)
|
||||||
SIGPWR,
|
SIGPWR,
|
||||||
#endif
|
#endif
|
||||||
-1
|
-1
|
||||||
@@ -65,6 +65,7 @@ static int find_stack_direction()
|
|||||||
return find_stack_direction2( &c );
|
return find_stack_direction2( &c );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(LINUX)
|
||||||
/* Create a stack with a barrier page at the end to guard against stack overflow. */
|
/* Create a stack with a barrier page at the end to guard against stack overflow. */
|
||||||
static void *CreateStack( int size )
|
static void *CreateStack( int size )
|
||||||
{
|
{
|
||||||
@@ -100,6 +101,7 @@ static void *CreateStack( int size )
|
|||||||
|
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Hook up events to fatal signals, so we can clean up if we're killed. */
|
/* Hook up events to fatal signals, so we can clean up if we're killed. */
|
||||||
void SignalHandler::OnClose(handler h)
|
void SignalHandler::OnClose(handler h)
|
||||||
@@ -108,15 +110,17 @@ void SignalHandler::OnClose(handler h)
|
|||||||
{
|
{
|
||||||
saved_sigs = new SaveSignals;
|
saved_sigs = new SaveSignals;
|
||||||
|
|
||||||
/* Allocate a separate signal stack. This makes the crash handler work
|
void *p = NULL;
|
||||||
* if we run out of stack space. */
|
|
||||||
|
#if defined(LINUX)
|
||||||
/* Ugh. Signal stack + pthreads + Linux 2.4 = crash or hang. */
|
/* Ugh. Signal stack + pthreads + Linux 2.4 = crash or hang. */
|
||||||
CString system;
|
CString system;
|
||||||
int version;
|
int version;
|
||||||
GetKernel( system, version );
|
GetKernel( system, version );
|
||||||
|
|
||||||
|
/* Allocate a separate signal stack. This makes the crash handler work
|
||||||
|
* if we run out of stack space. */
|
||||||
const int AltStackSize = 1024*64;
|
const int AltStackSize = 1024*64;
|
||||||
void *p = NULL;
|
|
||||||
if( version > 20500 )
|
if( version > 20500 )
|
||||||
p = CreateStack( AltStackSize );
|
p = CreateStack( AltStackSize );
|
||||||
|
|
||||||
@@ -132,6 +136,7 @@ void SignalHandler::OnClose(handler h)
|
|||||||
p = NULL; /* no SA_ONSTACK */
|
p = NULL; /* no SA_ONSTACK */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
struct sigaction sa;
|
struct sigaction sa;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user