Enlightenment CVS committal
Author : kwo
Project : e16
Module : e
Dir : e16/e/src
Modified Files:
E.h handlers.c main.c misc.c scursor.c setup.c
Log Message:
Gathered signal stuff in handlers.c.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.134
retrieving revision 1.135
diff -u -3 -r1.134 -r1.135
--- E.h 17 Aug 2003 10:09:07 -0000 1.134
+++ E.h 18 Aug 2003 21:54:27 -0000 1.135
@@ -32,7 +32,6 @@
#include <X11/Xlocale.h>
#include <X11/cursorfont.h>
#include <X11/extensions/shape.h>
-/*#include <X11/extensions/XTest.h> */
#include <X11/extensions/XShm.h>
#include <Imlib.h>
#if USE_FNLIB
@@ -1834,28 +1833,15 @@
void SetupInit(void);
void MapUnmap(int start);
-void SetupSignals(void);
void SetupX(void);
void SetupDirs(void);
void SetupEnv(void);
Window MakeExtInitWin(void);
void SetupUserInitialization(void);
-void HandleSigHup(int num);
-void HandleSigInt(int num);
-void HandleSigQuit(int num);
-void HandleSigIll(int num);
-void HandleSigAbrt(int num);
-void HandleSigFpe(int num);
-void HandleSigSegv(int num);
-void HandleSigPipe(int num);
-void HandleSigAlrm(int num);
-void HandleSigTerm(int num);
-void HandleSigUsr1(int num);
-void HandleSigUsr2(int num);
-void HandleSigChild(int num);
-void HandleSigTstp(int num);
-void HandleSigBus(int num);
+/* handlers.c functions */
+void SignalsSetup(void);
+void SignalsRestore(void);
void EHandleXError(Display * d, XErrorEvent * ev);
void HandleXIOError(Display * d);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/handlers.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -3 -r1.27 -r1.28
--- handlers.c 22 May 2003 19:15:01 -0000 1.27
+++ handlers.c 18 Aug 2003 21:54:27 -0000 1.28
@@ -22,184 +22,158 @@
*/
#include "E.h"
-void
-HandleSigHup(int num)
-{
- EDBUG(7, "HandleSigHup");
- num = 0;
- doExit("restart");
- EDBUG_RETURN_;
-}
-
-void
-HandleSigInt(int num)
-{
- EDBUG(7, "HandleSigQuit");
- num = 0;
- doExit("error");
- EDBUG_RETURN_;
-}
-
-void
-HandleSigQuit(int num)
-{
- EDBUG(7, "HandleSigQuit");
- num = 0;
- doExit("error");
- EDBUG_RETURN_;
-}
-
-void
-HandleSigIll(int num)
-{
- EDBUG(7, "HandleSigIll");
- num = 0;
- if (disp)
- UngrabX();
- DialogAlert(_
- ("Enlightenment performed an Illegal Instruction.\n" "\n"
- "This most likely is due to you having installed an run a\n"
- "binary of Enlightenment that was compiled for a make or model\n"
- "of CPU not 100%% identical or compatible with yours. Please\n"
- "either obtain the correct package for your system, or\n"
- "re-compile Enlightenment and possibly any support libraries\n"
- "that you got in binary format to run Enlightenment.\n"));
- doExit("error");
- EDBUG_RETURN_;
-}
-
-void
-HandleSigAbrt(int num)
-{
- EDBUG(7, "HandleSigAbrt");
- num = 0;
- doExit("error");
- EDBUG_RETURN_;
-}
-
-void
-HandleSigFpe(int num)
-{
- EDBUG(7, "HandleSigFpe");
- num = 0;
- if (disp)
- UngrabX();
- DialogAlert(_
- ("Enlightenment caused a Floating Point Exception.\n" "\n"
- "This means that Enlightenment or support library routines it calls\n"
- "have performed an illegal mathematical operation (most likely\n"
- "dividing a number by zero). This is most likely a bug. It is\n"
- "recommended to restart now. If you wish to help fix this please\n"
- "compile Enlightenment with debugging symbols in and run\n"
- "Enlightenment under gdb so you can backtrace for where it died and\n"
- "send in a useful bug report with backtrace information and variable\n"
- "dumps etc.\n"));
- doExit("error");
- EDBUG_RETURN_;
-}
-
-void
-HandleSigSegv(int num)
+static void
+SignalHandler(int sig)
{
static int loop_count = 0;
+ int status;
- EDBUG(7, "HandleSigSegv");
- if (loop_count > 0)
- abort();
- loop_count++;
- if (disp)
- UngrabX();
- DialogAlert(_
- ("Enlightenment caused Segment Violation (Segfault)\n" "\n"
- "This means that Enlightenment or support library routines it calls\n"
- "have accessed areas of your system's memory that they are not\n"
- "allowed access to. This is most likely a bug. It is recommended to\n"
- "restart now. If you wish to help fix this please compile\n"
- "Enlightenment with debugging symbols in and run Enlightenment\n"
- "under gdb so you can backtrace for where it died and send in a\n"
- "useful bug report with backtrace information and variable\n"
- "dumps etc.\n"));
- abort();
- num = 0;
- EDBUG_RETURN_;
-}
-
-void
-HandleSigPipe(int num)
-{
- EDBUG(7, "HandleSigPipe");
- num = 0;
- EDBUG_RETURN_;
-}
+ EDBUG(7, "SignalHandler");
-void
-HandleSigAlrm(int num)
-{
- EDBUG(7, "HandleSigAlrm");
- num = 0;
- EDBUG_RETURN_;
-}
+ switch (sig)
+ {
+ case SIGHUP:
+ doExit("restart");
+ break;
+
+ default:
+ case SIGINT:
+ case SIGQUIT:
+ case SIGABRT:
+ case SIGTERM:
+ doExit("error");
+ break;
+
+ case SIGPIPE:
+ case SIGALRM:
+ case SIGUSR1:
+ case SIGUSR2:
+ break;
+
+ case SIGILL:
+ if (disp)
+ UngrabX();
+ DialogAlert(_
+ ("Enlightenment performed an Illegal Instruction.\n" "\n"
+ "This most likely is due to you having installed an run a\n"
+ "binary of Enlightenment that was compiled for a make or model\n"
+ "of CPU not 100%% identical or compatible with yours. Please\n"
+ "either obtain the correct package for your system, or\n"
+ "re-compile Enlightenment and possibly any support libraries\n"
+ "that you got in binary format to run Enlightenment.\n"));
+ doExit("error");
+ break;
+
+ case SIGFPE:
+ if (disp)
+ UngrabX();
+ DialogAlert(_
+ ("Enlightenment caused a Floating Point Exception.\n" "\n"
+ "This means that Enlightenment or support library routines it
calls\n"
+ "have performed an illegal mathematical operation (most likely\n"
+ "dividing a number by zero). This is most likely a bug. It is\n"
+ "recommended to restart now. If you wish to help fix this
please\n"
+ "compile Enlightenment with debugging symbols in and run\n"
+ "Enlightenment under gdb so you can backtrace for where it died
and\n"
+ "send in a useful bug report with backtrace information and
variable\n"
+ "dumps etc.\n"));
+ doExit("error");
+ break;
+
+ case SIGSEGV:
+ if (loop_count > 0)
+ abort();
+ loop_count++;
+ if (disp)
+ UngrabX();
+ DialogAlert(_
+ ("Enlightenment caused Segment Violation (Segfault)\n" "\n"
+ "This means that Enlightenment or support library routines it
calls\n"
+ "have accessed areas of your system's memory that they are not\n"
+ "allowed access to. This is most likely a bug. It is recommended
to\n"
+ "restart now. If you wish to help fix this please compile\n"
+ "Enlightenment with debugging symbols in and run Enlightenment\n"
+ "under gdb so you can backtrace for where it died and send in a\n"
+ "useful bug report with backtrace information and variable\n"
+ "dumps etc.\n"));
+ abort();
+ break;
+
+ case SIGBUS:
+ if (disp)
+ UngrabX();
+ DialogAlert(_
+ ("Enlightenment caused Bus Error.\n" "\n"
+ "It is suggested you check your hardware and OS installation.\n"
+ "It is highly unusual to cause Bus Errors on operational\n"
+ "hardware.\n"));
+ break;
-void
-HandleSigTerm(int num)
-{
- EDBUG(7, "HandleSigTerm");
- num = 0;
- doExit("error");
+ case SIGCHLD:
+#ifndef __EMX__
+ while (waitpid(-1, &status, WNOHANG) > 0);
+#else
+ waitpid(-1, &status, WNOHANG);
+#endif
+ break;
+ }
EDBUG_RETURN_;
}
void
-HandleSigUsr1(int num)
+SignalsSetup(void)
{
- EDBUG(7, "HandleSigUsr1");
- num = 0;
- EDBUG_RETURN_;
-}
+ /* This function will set up all the signal handlers for E */
-void
-HandleSigUsr2(int num)
-{
- EDBUG(7, "HandleSigUsr2");
- num = 0;
- EDBUG_RETURN_;
-}
+ static const int signals[] = {
+ SIGHUP, SIGINT, SIGQUIT, SIGILL, SIGABRT, SIGFPE, SIGSEGV, SIGPIPE,
+ SIGALRM, SIGTERM, SIGUSR1, SIGUSR2, SIGCHLD, SIGBUS
+ };
+ int i;
+ struct sigaction sa;
-void
-HandleSigChild(int num)
-{
- int status;
+ EDBUG(6, "SignalsSetup");
- EDBUG(7, "HandleSigChild");
- num = 0;
+ for (i = 0; i < sizeof(signals) / sizeof(int); i++)
+ {
+ sa.sa_handler = SignalHandler;
#ifndef __EMX__
- while (waitpid(-1, &status, WNOHANG) > 0);
+ sa.sa_flags = (signals[i] == SIGCHLD) ? SA_RESTART : 0;
#else
- waitpid(-1, &status, WNOHANG);
+ sa.sa_flags = 0;
#endif
- EDBUG_RETURN_;
-}
+ sigemptyset(&sa.sa_mask);
+ sigaction(signals[i], &sa, (struct sigaction *)0);
+ }
-void
-HandleSigTstp(int num)
-{
- EDBUG(7, "HandleSigTstp");
- num = 0;
EDBUG_RETURN_;
}
void
-HandleSigBus(int num)
+SignalsRestore(void)
{
- EDBUG(7, "HandleSigBus");
- num = 0;
- if (disp)
- UngrabX();
- DialogAlert(_
- ("Enlightenment caused Bus Error.\n" "\n"
- "It is suggested you check your hardware and OS installation.\n"
- "It is highly unusual to cause Bus Errors on operational\n"
- "hardware.\n"));
+ /* This function will restore all the signal handlers for E */
+
+ EDBUG(6, "SignalsRestore");
+
+ signal(SIGHUP, SIG_DFL);
+ signal(SIGINT, SIG_DFL);
+ signal(SIGQUIT, SIG_DFL);
+ signal(SIGILL, SIG_DFL);
+ signal(SIGABRT, SIG_DFL);
+ signal(SIGFPE, SIG_IGN);
+ signal(SIGSEGV, SIG_IGN);
+ signal(SIGPIPE, SIG_DFL);
+ signal(SIGALRM, SIG_DFL);
+ signal(SIGTERM, SIG_DFL);
+ signal(SIGUSR1, SIG_DFL);
+ signal(SIGUSR2, SIG_DFL);
+ signal(SIGCHLD, SIG_DFL);
+#ifdef SIGTSTP
+ signal(SIGTSTP, SIG_DFL);
+#endif
+ signal(SIGBUS, SIG_IGN);
+
EDBUG_RETURN_;
}
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/main.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -3 -r1.58 -r1.59
--- main.c 10 Aug 2003 15:44:47 -0000 1.58
+++ main.c 18 Aug 2003 21:54:27 -0000 1.59
@@ -228,7 +228,7 @@
SetSMUserThemePath(themepath);
/* run most of the setup */
- SetupSignals();
+ SignalsSetup();
SetupX();
BlumFlimFrub();
ZoomInit();
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/misc.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -3 -r1.34 -r1.35
--- misc.c 17 Aug 2003 10:15:16 -0000 1.34
+++ misc.c 18 Aug 2003 21:54:27 -0000 1.35
@@ -190,25 +190,11 @@
XSelectInput(disp, root.win, 0);
XCloseDisplay(disp);
}
+
XSetErrorHandler((XErrorHandler) NULL);
XSetIOErrorHandler((XIOErrorHandler) NULL);
- signal(SIGHUP, SIG_DFL);
- signal(SIGINT, SIG_DFL);
- signal(SIGQUIT, SIG_DFL);
- signal(SIGILL, SIG_DFL);
- signal(SIGABRT, SIG_DFL);
- signal(SIGFPE, SIG_IGN);
- signal(SIGSEGV, SIG_IGN);
- signal(SIGPIPE, SIG_DFL);
- signal(SIGALRM, SIG_DFL);
- signal(SIGTERM, SIG_DFL);
- signal(SIGUSR1, SIG_DFL);
- signal(SIGUSR2, SIG_DFL);
- signal(SIGCHLD, SIG_DFL);
-#ifdef SIGTSTP
- signal(SIGTSTP, SIG_DFL);
-#endif
- signal(SIGBUS, SIG_IGN);
+
+ SignalsRestore();
if (master_pid == getpid())
{
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/scursor.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -3 -r1.42 -r1.43
--- scursor.c 12 Jul 2003 15:04:32 -0000 1.42
+++ scursor.c 18 Aug 2003 21:54:27 -0000 1.43
@@ -215,25 +215,12 @@
XFree(retval);
return;
}
+
XSetErrorHandler((XErrorHandler) NULL);
XSetIOErrorHandler((XIOErrorHandler) NULL);
- signal(SIGHUP, SIG_DFL);
- signal(SIGINT, SIG_DFL);
- signal(SIGQUIT, SIG_DFL);
- signal(SIGILL, SIG_DFL);
- signal(SIGABRT, SIG_DFL);
- signal(SIGFPE, SIG_IGN);
- signal(SIGSEGV, SIG_IGN);
- signal(SIGPIPE, SIG_DFL);
- signal(SIGALRM, SIG_DFL);
- signal(SIGTERM, SIG_DFL);
- signal(SIGUSR1, SIG_DFL);
- signal(SIGUSR2, SIG_DFL);
- signal(SIGCHLD, SIG_DFL);
-#ifdef SIGTSTP
- signal(SIGTSTP, SIG_DFL);
-#endif
- signal(SIGBUS, SIG_IGN);
+
+ SignalsRestore();
+
sc_disp = XOpenDisplay(DisplayString(disp));
XGrabServer(sc_disp);
#ifdef HAVE_LIBXTST
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/setup.c,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -3 -r1.91 -r1.92
--- setup.c 10 Aug 2003 15:44:47 -0000 1.91
+++ setup.c 18 Aug 2003 21:54:27 -0000 1.92
@@ -110,93 +110,6 @@
}
void
-SetupSignals()
-{
-
- /* This function will set up all the signal handlers for E */
-
- struct sigaction sa;
-
- EDBUG(6, "SetupSignals");
-
- sa.sa_handler = HandleSigHup;
- sa.sa_flags = 0;
- sigemptyset(&sa.sa_mask);
- sigaction(SIGHUP, &sa, (struct sigaction *)0);
-
- sa.sa_handler = HandleSigInt;
- sa.sa_flags = 0;
- sigemptyset(&sa.sa_mask);
- sigaction(SIGINT, &sa, (struct sigaction *)0);
-
- sa.sa_handler = HandleSigQuit;
- sa.sa_flags = 0;
- sigemptyset(&sa.sa_mask);
- sigaction(SIGQUIT, &sa, (struct sigaction *)0);
-
- sa.sa_handler = HandleSigIll;
- sa.sa_flags = 0;
- sigemptyset(&sa.sa_mask);
- sigaction(SIGILL, &sa, (struct sigaction *)0);
-
- sa.sa_handler = HandleSigAbrt;
- sa.sa_flags = 0;
- sigemptyset(&sa.sa_mask);
- sigaction(SIGABRT, &sa, (struct sigaction *)0);
-
- sa.sa_handler = HandleSigFpe;
- sa.sa_flags = 0;
- sigemptyset(&sa.sa_mask);
- sigaction(SIGFPE, &sa, (struct sigaction *)0);
-
- sa.sa_handler = HandleSigSegv;
- sa.sa_flags = 0;
- sigemptyset(&sa.sa_mask);
- sigaction(SIGSEGV, &sa, (struct sigaction *)0);
-
- sa.sa_handler = HandleSigPipe;
- sa.sa_flags = 0;
- sigemptyset(&sa.sa_mask);
- sigaction(SIGPIPE, &sa, (struct sigaction *)0);
-
- sa.sa_handler = HandleSigAlrm;
- sa.sa_flags = 0;
- sigemptyset(&sa.sa_mask);
- sigaction(SIGALRM, &sa, (struct sigaction *)0);
-
- sa.sa_handler = HandleSigTerm;
- sa.sa_flags = 0;
- sigemptyset(&sa.sa_mask);
- sigaction(SIGTERM, &sa, (struct sigaction *)0);
-
- sa.sa_handler = HandleSigUsr1;
- sa.sa_flags = 0;
- sigemptyset(&sa.sa_mask);
- sigaction(SIGUSR1, &sa, (struct sigaction *)0);
-
- sa.sa_handler = HandleSigUsr2;
- sa.sa_flags = 0;
- sigemptyset(&sa.sa_mask);
- sigaction(SIGUSR2, &sa, (struct sigaction *)0);
-
- sa.sa_handler = HandleSigChild;
-#ifndef __EMX__
- sa.sa_flags = SA_RESTART;
-#else
- sa.sa_flags = 0;
-#endif
- sigemptyset(&sa.sa_mask);
- sigaction(SIGCHLD, &sa, (struct sigaction *)0);
-
- sa.sa_handler = HandleSigBus;
- sa.sa_flags = 0;
- sigemptyset(&sa.sa_mask);
- sigaction(SIGBUS, &sa, (struct sigaction *)0);
-
- EDBUG_RETURN_;
-}
-
-void
SetupX()
{
@@ -777,26 +690,12 @@
return win;
}
+
/* on solairs connection stays up - close */
XSetErrorHandler((XErrorHandler) NULL);
XSetIOErrorHandler((XIOErrorHandler) NULL);
- signal(SIGHUP, SIG_DFL);
- signal(SIGINT, SIG_DFL);
- signal(SIGQUIT, SIG_DFL);
- signal(SIGILL, SIG_DFL);
- signal(SIGABRT, SIG_DFL);
- signal(SIGFPE, SIG_IGN);
- signal(SIGSEGV, SIG_IGN);
- signal(SIGPIPE, SIG_IGN);
- signal(SIGALRM, SIG_DFL);
- signal(SIGTERM, SIG_DFL);
- signal(SIGUSR1, SIG_DFL);
- signal(SIGUSR2, SIG_DFL);
- signal(SIGCHLD, SIG_DFL);
-#ifdef SIGTSTP
- signal(SIGTSTP, SIG_DFL);
-#endif
- signal(SIGBUS, SIG_IGN);
+
+ SignalsRestore();
d2 = XOpenDisplay(DisplayString(disp));
close(ConnectionNumber(disp));
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs