mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-18 06:51:47 +00:00
signal handling improvements
This commit is contained in:
parent
6aa4a690d6
commit
180c517771
2 changed files with 26 additions and 14 deletions
|
@ -56,7 +56,7 @@ void Sys_Print (FILE *stream, const char *fmt, va_list args);
|
||||||
void Sys_Printf (const char *fmt, ...) __attribute__((format(printf,1,2)));
|
void Sys_Printf (const char *fmt, ...) __attribute__((format(printf,1,2)));
|
||||||
void Sys_DPrintf (const char *fmt, ...) __attribute__((format(printf,1,2)));
|
void Sys_DPrintf (const char *fmt, ...) __attribute__((format(printf,1,2)));
|
||||||
void Sys_Error (const char *error, ...) __attribute__((format(printf,1,2), noreturn));
|
void Sys_Error (const char *error, ...) __attribute__((format(printf,1,2), noreturn));
|
||||||
void Sys_Quit (void);
|
void Sys_Quit (void) __attribute__((noreturn));;
|
||||||
void Sys_Shutdown (void);
|
void Sys_Shutdown (void);
|
||||||
void Sys_RegisterShutdown (void (*func) (void));
|
void Sys_RegisterShutdown (void (*func) (void));
|
||||||
double Sys_DoubleTime (void);
|
double Sys_DoubleTime (void);
|
||||||
|
|
|
@ -207,22 +207,34 @@ aiee (int sig)
|
||||||
static void
|
static void
|
||||||
TragicDeath (int sig)
|
TragicDeath (int sig)
|
||||||
{
|
{
|
||||||
signal (SIGHUP, aiee);
|
printf ("Received signal %d, exiting...\n", sig);
|
||||||
signal (SIGINT, aiee);
|
|
||||||
|
switch (sig) {
|
||||||
|
case SIGHUP:
|
||||||
|
case SIGINT:
|
||||||
|
case SIGTERM:
|
||||||
|
signal (SIGHUP, SIG_DFL);
|
||||||
|
signal (SIGINT, SIG_DFL);
|
||||||
|
signal (SIGTERM, SIG_DFL);
|
||||||
|
Sys_Quit ();
|
||||||
|
default:
|
||||||
signal (SIGQUIT, aiee);
|
signal (SIGQUIT, aiee);
|
||||||
signal (SIGILL, aiee);
|
signal (SIGILL, aiee);
|
||||||
signal (SIGTRAP, aiee);
|
signal (SIGTRAP, aiee);
|
||||||
signal (SIGIOT, aiee);
|
signal (SIGIOT, aiee);
|
||||||
signal (SIGBUS, aiee);
|
signal (SIGBUS, aiee);
|
||||||
signal (SIGSEGV, aiee);
|
signal (SIGSEGV, aiee);
|
||||||
signal (SIGTERM, aiee);
|
|
||||||
|
|
||||||
printf ("Received signal %d, exiting...\n", sig);
|
|
||||||
|
|
||||||
if (!setjmp (aiee_abort))
|
if (!setjmp (aiee_abort))
|
||||||
Sys_Shutdown ();
|
Sys_Shutdown ();
|
||||||
|
|
||||||
signal (sig, SIG_DFL);
|
signal (SIGQUIT, SIG_DFL);
|
||||||
|
signal (SIGILL, SIG_DFL);
|
||||||
|
signal (SIGTRAP, SIG_DFL);
|
||||||
|
signal (SIGIOT, SIG_DFL);
|
||||||
|
signal (SIGBUS, SIG_DFL);
|
||||||
|
signal (SIGSEGV, SIG_DFL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in a new issue