2012-06-20 23:19:43 -07:00
|
|
|
/*
|
|
|
|
* NOTE TO FreeBSD users. Install libexecinfo from
|
2005-03-18 09:02:47 -08:00
|
|
|
* ports/devel/libexecinfo and add -lexecinfo to LDFLAGS
|
|
|
|
* to add backtrace support.
|
2005-01-27 02:14:22 -08:00
|
|
|
*/
|
|
|
|
#include "e.h"
|
2009-03-26 19:23:13 -07:00
|
|
|
|
2009-11-11 13:04:21 -08:00
|
|
|
#ifdef HAVE_EXECINFO_H
|
2012-06-20 23:19:43 -07:00
|
|
|
# include <execinfo.h>
|
2009-11-11 13:04:21 -08:00
|
|
|
#endif
|
|
|
|
|
2009-03-26 19:23:13 -07:00
|
|
|
static volatile Eina_Bool _e_x_composite_shutdown_try = 0;
|
2010-08-18 11:32:48 -07:00
|
|
|
|
2009-03-26 19:23:13 -07:00
|
|
|
static void
|
|
|
|
_e_x_composite_shutdown(void)
|
|
|
|
{
|
2014-10-03 10:17:52 -07:00
|
|
|
#ifndef HAVE_WAYLAND_ONLY
|
2011-07-25 02:40:18 -07:00
|
|
|
// Ecore_X_Display *dpy;
|
2009-03-26 19:23:13 -07:00
|
|
|
Ecore_X_Window root;
|
|
|
|
|
2012-11-14 01:57:11 -08:00
|
|
|
if (_e_x_composite_shutdown_try) return; /* we failed :-( */
|
2009-03-26 19:23:13 -07:00
|
|
|
_e_x_composite_shutdown_try = 1;
|
|
|
|
|
2011-07-25 02:40:18 -07:00
|
|
|
// dpy = ecore_x_display_get();
|
|
|
|
root = ecore_x_window_root_first_get();
|
2009-03-26 19:23:13 -07:00
|
|
|
|
|
|
|
/* ignore errors, we really don't care at this point */
|
|
|
|
ecore_x_composite_unredirect_subwindows(root, ECORE_X_COMPOSITE_UPDATE_MANUAL);
|
|
|
|
_e_x_composite_shutdown_try = 0;
|
2014-03-11 04:24:41 -07:00
|
|
|
#endif
|
2009-03-26 19:23:13 -07:00
|
|
|
}
|
2005-03-30 19:21:58 -08:00
|
|
|
|
2012-11-09 13:54:12 -08:00
|
|
|
#if 0
|
2009-07-11 09:27:37 -07:00
|
|
|
#define _e_write_safe(fd, buf) _e_write_safe_int(fd, buf, sizeof(buf))
|
2010-08-18 11:32:48 -07:00
|
|
|
|
2009-07-11 09:27:37 -07:00
|
|
|
static void
|
|
|
|
_e_write_safe_int(int fd, const char *buf, size_t size)
|
|
|
|
{
|
|
|
|
while (size > 0)
|
|
|
|
{
|
2012-11-14 01:57:11 -08:00
|
|
|
ssize_t done = write(fd, buf, size);
|
|
|
|
if (done >= 0)
|
|
|
|
{
|
|
|
|
buf += done;
|
|
|
|
size -= done;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ((errno == EAGAIN) || (errno == EINTR))
|
|
|
|
continue;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
perror("write");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2009-07-11 09:27:37 -07:00
|
|
|
}
|
|
|
|
}
|
2012-11-14 01:57:11 -08:00
|
|
|
|
2012-11-09 13:54:12 -08:00
|
|
|
#endif
|
2009-07-11 09:27:37 -07:00
|
|
|
|
2005-01-27 02:14:22 -08:00
|
|
|
/* a tricky little devil, requires e and it's libs to be built
|
2012-06-20 23:19:43 -07:00
|
|
|
* with the -rdynamic flag to GCC for any sort of decent output.
|
2005-01-27 02:14:22 -08:00
|
|
|
*/
|
2006-01-07 02:39:46 -08:00
|
|
|
EAPI void
|
2010-08-18 11:32:48 -07:00
|
|
|
e_sigseg_act(int x __UNUSED__, siginfo_t *info __UNUSED__, void *data __UNUSED__)
|
2005-04-11 13:25:52 -07:00
|
|
|
{
|
2009-03-26 19:23:13 -07:00
|
|
|
_e_x_composite_shutdown();
|
2014-10-03 10:17:52 -07:00
|
|
|
#ifndef HAVE_WAYLAND_ONLY
|
2005-06-15 23:29:32 -07:00
|
|
|
ecore_x_pointer_ungrab();
|
|
|
|
ecore_x_keyboard_ungrab();
|
|
|
|
ecore_x_ungrab();
|
|
|
|
ecore_x_sync();
|
2012-10-31 23:23:49 -07:00
|
|
|
e_alert_show();
|
2015-02-25 00:15:41 -08:00
|
|
|
#endif
|
2005-01-27 02:14:22 -08:00
|
|
|
}
|
|
|
|
|
2006-01-07 02:39:46 -08:00
|
|
|
EAPI void
|
2010-08-18 11:32:48 -07:00
|
|
|
e_sigill_act(int x __UNUSED__, siginfo_t *info __UNUSED__, void *data __UNUSED__)
|
2005-06-14 22:06:45 -07:00
|
|
|
{
|
2012-11-07 12:56:57 -08:00
|
|
|
// In case of a sigill in Enlightenment, Enlightenment start will catch the sigill and continue,
|
|
|
|
// because evas cpu detection use that behaviour. But if we get a SIGILL after that, we endup in
|
|
|
|
// this sig handler. So E start remember the SIGILL, and we will commit succide with a USR1, followed
|
|
|
|
// by a SEGV.
|
|
|
|
kill(getpid(), SIGUSR1);
|
|
|
|
kill(getpid(), SIGSEGV);
|
|
|
|
pause();
|
|
|
|
/* _e_x_composite_shutdown(); */
|
|
|
|
/* ecore_x_pointer_ungrab(); */
|
|
|
|
/* ecore_x_keyboard_ungrab(); */
|
|
|
|
/* ecore_x_ungrab(); */
|
|
|
|
/* ecore_x_sync(); */
|
|
|
|
/* e_alert_show(); */
|
2005-06-14 22:06:45 -07:00
|
|
|
}
|
|
|
|
|
2006-01-07 02:39:46 -08:00
|
|
|
EAPI void
|
2010-08-18 11:32:48 -07:00
|
|
|
e_sigfpe_act(int x __UNUSED__, siginfo_t *info __UNUSED__, void *data __UNUSED__)
|
2005-06-14 22:06:45 -07:00
|
|
|
{
|
2009-03-26 19:23:13 -07:00
|
|
|
_e_x_composite_shutdown();
|
2014-10-03 10:17:52 -07:00
|
|
|
#ifndef HAVE_WAYLAND_ONLY
|
2005-06-15 23:29:32 -07:00
|
|
|
ecore_x_pointer_ungrab();
|
|
|
|
ecore_x_keyboard_ungrab();
|
|
|
|
ecore_x_ungrab();
|
|
|
|
ecore_x_sync();
|
2012-10-31 23:23:49 -07:00
|
|
|
e_alert_show();
|
2015-02-25 00:15:41 -08:00
|
|
|
#endif
|
2005-06-14 22:06:45 -07:00
|
|
|
}
|
|
|
|
|
2006-01-07 02:39:46 -08:00
|
|
|
EAPI void
|
2010-08-18 11:32:48 -07:00
|
|
|
e_sigbus_act(int x __UNUSED__, siginfo_t *info __UNUSED__, void *data __UNUSED__)
|
2005-06-14 22:06:45 -07:00
|
|
|
{
|
2009-03-26 19:23:13 -07:00
|
|
|
_e_x_composite_shutdown();
|
2014-10-03 10:17:52 -07:00
|
|
|
#ifndef HAVE_WAYLAND_ONLY
|
2005-06-15 23:29:32 -07:00
|
|
|
ecore_x_pointer_ungrab();
|
|
|
|
ecore_x_keyboard_ungrab();
|
|
|
|
ecore_x_ungrab();
|
|
|
|
ecore_x_sync();
|
2012-10-31 23:23:49 -07:00
|
|
|
e_alert_show();
|
2015-02-25 00:15:41 -08:00
|
|
|
#endif
|
2005-06-14 22:06:45 -07:00
|
|
|
}
|
2006-04-01 20:18:18 -08:00
|
|
|
|
|
|
|
EAPI void
|
2010-08-18 11:32:48 -07:00
|
|
|
e_sigabrt_act(int x __UNUSED__, siginfo_t *info __UNUSED__, void *data __UNUSED__)
|
2006-04-01 20:18:18 -08:00
|
|
|
{
|
2009-03-26 19:23:13 -07:00
|
|
|
_e_x_composite_shutdown();
|
2014-10-03 10:17:52 -07:00
|
|
|
#ifndef HAVE_WAYLAND_ONLY
|
2006-04-01 20:18:18 -08:00
|
|
|
ecore_x_pointer_ungrab();
|
|
|
|
ecore_x_keyboard_ungrab();
|
|
|
|
ecore_x_ungrab();
|
|
|
|
ecore_x_sync();
|
2012-10-31 23:23:49 -07:00
|
|
|
e_alert_show();
|
2015-02-25 00:15:41 -08:00
|
|
|
#endif
|
2006-04-01 20:18:18 -08:00
|
|
|
}
|