From 88de154b8a3b427df78e79310a3e4f01297a53b6 Mon Sep 17 00:00:00 2001 From: Chris Michael Date: Wed, 24 Apr 2013 08:29:49 +0100 Subject: [PATCH] Add signal traps on startup. Signed-off-by: Chris Michael --- src/bin/e_wayland/e_main.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/bin/e_wayland/e_main.c b/src/bin/e_wayland/e_main.c index b2bdc1ccf..bbd61e7af 100644 --- a/src/bin/e_wayland/e_main.c +++ b/src/bin/e_wayland/e_main.c @@ -1,4 +1,5 @@ #include "e.h" + #ifdef HAVE_ECORE_IMF # include #endif @@ -48,7 +49,32 @@ main(int argc, char **argv) /* wm/desktop vanishing and not knowing what happened */ if (!getenv("NOTIFY_SOCKET")) { - /* TODO: signals */ + TS("Signal Trap"); + action.sa_sigaction = e_sigseg_act; + action.sa_flags = SA_NODEFER | SA_RESETHAND | SA_SIGINFO; + sigemptyset(&action.sa_mask); + sigaction(SIGSEGV, &action, NULL); + + action.sa_sigaction = e_sigill_act; + action.sa_flags = SA_NODEFER | SA_RESETHAND | SA_SIGINFO; + sigemptyset(&action.sa_mask); + sigaction(SIGILL, &action, NULL); + + action.sa_sigaction = e_sigfpe_act; + action.sa_flags = SA_NODEFER | SA_RESETHAND | SA_SIGINFO; + sigemptyset(&action.sa_mask); + sigaction(SIGFPE, &action, NULL); + + action.sa_sigaction = e_sigbus_act; + action.sa_flags = SA_NODEFER | SA_RESETHAND | SA_SIGINFO; + sigemptyset(&action.sa_mask); + sigaction(SIGBUS, &action, NULL); + + action.sa_sigaction = e_sigabrt_act; + action.sa_flags = SA_NODEFER | SA_RESETHAND | SA_SIGINFO; + sigemptyset(&action.sa_mask); + sigaction(SIGABRT, &action, NULL); + TS("Signal Trap Done"); } t = ecore_time_unix_get();