singals patch

SVN revision: 13104
This commit is contained in:
Carsten Haitzler 2005-01-27 10:14:22 +00:00
parent 49a65725c8
commit 750555dfb5
6 changed files with 60 additions and 4 deletions

3
TODO
View File

@ -31,9 +31,10 @@ ISSUES:
* clock module needs fixing to have right click menu per face
* clock module should only make 1 clock per container and allow u to enable/disable that clock on that container
* same for ibar, temperature and battery modules ad for clock
* same for ibar, temperature and battery modules
* pager needs 1 pager face per zone by default (optionally able to be turned off)
* pager needs to be able to split off each desk in a zone it a different gadget
* pager right click menu needs to do a lot more (as with clock)
* initial placement of pager and clock seems wrong (overlap deny code?)
* gadman overlay deny doesnt work for edge only gadgets
* gadman gadget menu needs icons :)

View File

@ -40,7 +40,8 @@ e_resist.h \
e_startup.h \
e_iconify.h \
e_hints.h \
e_gadman.h
e_gadman.h \
e_signals.h
enlightenment_SOURCES = \
@ -75,6 +76,7 @@ e_startup.c \
e_iconify.c \
e_hints.c \
e_gadman.c \
e_signals.c \
$(ENLIGHTENMENTHEADERS)
enlightenment_LDFLAGS = -export-dynamic @e_libs@ @dlopen_libs@

View File

@ -28,3 +28,4 @@
#include "e_iconify.h"
#include "e_hints.h"
#include "e_gadman.h"
#include "e_signals.h"

View File

@ -19,6 +19,7 @@ static int _e_main_ipc_shutdown(void);
static void _e_main_cb_x_fatal(void *data);
static int _e_main_cb_signal_exit(void *data, int ev_type, void *ev);
static int _e_main_cb_signal_hup(void *data, int ev_type, void *ev);
static int _e_main_cb_x_flusher(void *data);
static int _e_main_cb_idler_before(void *data);
static int _e_main_cb_idler_after(void *data);
@ -57,10 +58,17 @@ main(int argc, char **argv)
int after_restart = 0;
char buf[1024];
char *s;
/* install the signal handlers. */
struct sigaction sigsegv_action;
struct sigaction sighup_action;
sigsegv_action.sa_sigaction=&e_sigseg_act;
sigsegv_action.sa_flags=0;
sigaction(SIGSEGV, &sigsegv_action, NULL);
/* for debugging by redirecting stdout of e to a log file to tail */
setvbuf(stdout, NULL, _IONBF, 0);
if (getenv("NOSPLASH")) nosplash = 1;
if (getenv("NOSTARTUP")) nostartup = 1;
if (getenv("NOWELCOME")) nowelcome = 1;
@ -128,6 +136,12 @@ main(int argc, char **argv)
"Perhaps you are out of memory?");
_e_main_shutdown(-1);
}
if(!ecore_event_handler_add(ECORE_EVENT_SIGNAL_HUP, _e_main_cb_signal_hup, NULL))
{
e_error_message_show("Enlightenment cannot set up a HUP signal handler.\n"
"Perhaps you are out of memory?");
_e_main_shutdown(-1);
}
/* an idle enterer to be called before all others */
_e_main_idle_enterer_before = ecore_idle_enterer_add(_e_main_cb_idler_before, NULL);
@ -785,6 +799,14 @@ _e_main_cb_signal_exit(void *data, int ev_type, void *ev)
ecore_main_loop_quit();
return 1;
}
static int
_e_main_cb_signal_hup(void *data, int ev_type, void *ev)
{
/* called on SIGHUP to restart Enlightenment */
printf("RESTART ON!\n");
restart = 1;
ecore_main_loop_quit();
}
static int
_e_main_cb_x_flusher(void *data)
@ -851,3 +873,4 @@ _e_main_cb_startup_fake_end(void *data)
e_init_hide();
return 0;
}

23
src/bin/e_signals.c Normal file
View File

@ -0,0 +1,23 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#include "e.h"
/* a tricky little devil, requires e and it's libs to be built
* with the -rdynamic flag to GCC for any sort of decent output.
*/
void e_sigseg_act(int x, siginfo_t *info, void *data){
void *array[255];
size_t size;
char **strings;
size_t i;
write(2, "**** SEGMENTATION FAULT ****\n", 29);
write(2, "**** Printing Backtrace... *****\n\n", 34);
size = backtrace (array, 255);
backtrace_symbols_fd(array, size, 2);
exit(-11);
}

6
src/bin/e_signals.h Normal file
View File

@ -0,0 +1,6 @@
#ifndef E_SIGNALS_H
#define E_SIGNALS_H
/* signal handler functions for e */
void e_sigseg_act(int x, siginfo_t *info, void *data);
#endif