# HG changeset patch # User jwe # Date 782590756 0 # Node ID 44ce29d8cb7b72c985872bebfa1172520a7a28da # Parent bd2e9171b66a635588abb92853cf468a5dfa53ce [project @ 1994-10-19 18:17:44 by jwe] diff -r bd2e9171b66a -r 44ce29d8cb7b configure.in --- a/configure.in Wed Oct 19 15:28:39 1994 +0000 +++ b/configure.in Wed Oct 19 18:19:16 1994 +0000 @@ -21,7 +21,7 @@ dnl along with Octave; see the file COPYING. If not, write to the Free dnl Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. dnl -AC_REVISION($Revision: 1.63 $)dnl +AC_REVISION($Revision: 1.64 $)dnl AC_PREREQ(1.122) AC_INIT(src/octave.cc) AC_CONFIG_HEADER(config.h kpathsea/c-auto.h) @@ -648,9 +648,13 @@ dnl AC_SUBST(TERMLIBS) dnl +dnl Signal stuff. +dnl +AC_TYPE_SIGNAL +AC_SYS_SIGLIST_DECLARED +dnl dnl Define VOID_SIGHANDLER for readline. dnl -AC_TYPE_SIGNAL case "$RETSIGTYPE" in int) ;; diff -r bd2e9171b66a -r 44ce29d8cb7b src/sighandlers.cc --- a/src/sighandlers.cc Wed Oct 19 15:28:39 1994 +0000 +++ b/src/sighandlers.cc Wed Oct 19 18:19:16 1994 +0000 @@ -25,6 +25,10 @@ #include "config.h" #endif +#include +#ifdef HAVE_UNISTD_H +#include +#endif #include #include @@ -56,55 +60,31 @@ clean_up_and_exit (1); } -// Some of these may eventually perform different actions... - static RETSIGTYPE -sigabrt_handler (int i) +generic_sig_handler (int i) { - my_friendly_exit ("SIGABRT", i); -} - -static RETSIGTYPE -sigalrm_handler (int i) -{ - my_friendly_exit ("SIGALRM", i); -} - -static RETSIGTYPE -sigbus_handler (int i) -{ - my_friendly_exit ("SIGBUS", i); -} + my_friendly_exit (sys_siglist[i], i); -static RETSIGTYPE -sigemt_handler (int i) -{ - my_friendly_exit ("SIGEMT", i); -} - -static RETSIGTYPE -sigfpe_handler (int i) -{ - my_friendly_exit ("SIGFPE", i); -} - -static RETSIGTYPE -sighup_handler (int i) -{ - my_friendly_exit ("SIGHUP", i); -} - -static RETSIGTYPE -sigill_handler (int i) -{ - my_friendly_exit ("SIGILL", i); +#if RETSIGTYPE == void + return; +#else + return 0; +#endif } // Handle SIGINT by restarting the parser (see octave.cc). +// XXX FIXME XXX -- it would probably be good to try to use POSIX +// signal interface if it is available. + static RETSIGTYPE sigint_handler (int i) { +// Can this ever cause trouble on systems that don't forget signal +// handlers when they are invoked? + + signal (SIGINT, sigint_handler); + if (can_interrupt) { jump_to_top_level (); @@ -119,20 +99,13 @@ } static RETSIGTYPE -sigiot_handler (int i) -{ - my_friendly_exit ("SIGIOT", i); -} - -static RETSIGTYPE -siglost_handler (int i) -{ - my_friendly_exit ("SIGLOST", i); -} - -static RETSIGTYPE sigpipe_handler (int i) { +// Can this ever cause trouble on systems that don't forget signal +// handlers when they are invoked? + + signal (SIGPIPE, sigpipe_handler); + if (pipe_handler_error_count++ == 0) message (0, "broken pipe"); @@ -147,78 +120,6 @@ #endif } -static RETSIGTYPE -sigpoll_handler (int i) -{ - my_friendly_exit ("SIGPOLL", i); -} - -static RETSIGTYPE -sigprof_handler (int i) -{ - my_friendly_exit ("SIGPROF", i); -} - -static RETSIGTYPE -sigquit_handler (int i) -{ - my_friendly_exit ("SIGQUIT", i); -} - -static RETSIGTYPE -sigsegv_handler (int i) -{ - my_friendly_exit ("SIGSEGV", i); -} - -static RETSIGTYPE -sigsys_handler (int i) -{ - my_friendly_exit ("SIGSYS", i); -} - -static RETSIGTYPE -sigterm_handler (int i) -{ - my_friendly_exit ("SIGTERM", i); -} - -static RETSIGTYPE -sigtrap_handler (int i) -{ - my_friendly_exit ("SIGTRAP", i); -} - -static RETSIGTYPE -sigusr1_handler (int i) -{ - my_friendly_exit ("SIGUSR1", i); -} - -static RETSIGTYPE -sigusr2_handler (int i) -{ - my_friendly_exit ("SIGUSR2", i); -} - -static RETSIGTYPE -sigvtalrm_handler (int i) -{ - my_friendly_exit ("SIGVTALRM", i); -} - -static RETSIGTYPE -sigxcpu_handler (int i) -{ - my_friendly_exit ("SIGXCPU", i); -} - -static RETSIGTYPE -sigxfsz_handler (int i) -{ - my_friendly_exit ("SIGXFSZ", i); -} - // Install all the handlers for the signals we might care about. void @@ -227,31 +128,31 @@ set_new_handler (octave_new_handler); #ifdef SIGABRT - signal (SIGABRT, sigabrt_handler); + signal (SIGABRT, generic_sig_handler); #endif #ifdef SIGALRM - signal (SIGALRM, sigalrm_handler); + signal (SIGALRM, generic_sig_handler); #endif #ifdef SIGBUS - signal (SIGBUS, sigbus_handler); + signal (SIGBUS, generic_sig_handler); #endif #ifdef SIGEMT - signal (SIGEMT, sigemt_handler); + signal (SIGEMT, generic_sig_handler); #endif #ifdef SIGFPE - signal (SIGFPE, sigfpe_handler); + signal (SIGFPE, generic_sig_handler); #endif #ifdef SIGHUP - signal (SIGHUP, sighup_handler); + signal (SIGHUP, generic_sig_handler); #endif #ifdef SIGILL - signal (SIGILL, sigill_handler); + signal (SIGILL, generic_sig_handler); #endif #ifdef SIGINT @@ -259,11 +160,11 @@ #endif #ifdef SIGIOT - signal (SIGIOT, sigiot_handler); + signal (SIGIOT, generic_sig_handler); #endif #ifdef SIGLOST - signal (SIGLOST, siglost_handler); + signal (SIGLOST, generic_sig_handler); #endif #ifdef SIGPIPE @@ -271,51 +172,51 @@ #endif #ifdef SIGPOLL - signal (SIGPOLL, sigpoll_handler); + signal (SIGPOLL, generic_sig_handler); #endif #ifdef SIGPROF - signal (SIGPROF, sigprof_handler); + signal (SIGPROF, generic_sig_handler); #endif #ifdef SIGQUIT - signal (SIGQUIT, sigquit_handler); + signal (SIGQUIT, generic_sig_handler); #endif #ifdef SIGSEGV - signal (SIGSEGV, sigsegv_handler); + signal (SIGSEGV, generic_sig_handler); #endif #ifdef SIGSYS - signal (SIGSYS, sigsys_handler); + signal (SIGSYS, generic_sig_handler); #endif #ifdef SIGTERM - signal (SIGTERM, sigterm_handler); + signal (SIGTERM, generic_sig_handler); #endif #ifdef SIGTRAP - signal (SIGTRAP, sigtrap_handler); + signal (SIGTRAP, generic_sig_handler); #endif #ifdef SIGUSR1 - signal (SIGUSR1, sigusr1_handler); + signal (SIGUSR1, generic_sig_handler); #endif #ifdef SIGUSR2 - signal (SIGUSR2, sigusr2_handler); + signal (SIGUSR2, generic_sig_handler); #endif #ifdef SIGVTALRM - signal (SIGVTALRM, sigvtalrm_handler); + signal (SIGVTALRM, generic_sig_handler); #endif #ifdef SIGXCPU - signal (SIGXCPU, sigxcpu_handler); + signal (SIGXCPU, generic_sig_handler); #endif #ifdef SIGXFSZ - signal (SIGXFSZ, sigxfsz_handler); + signal (SIGXFSZ, generic_sig_handler); #endif } diff -r bd2e9171b66a -r 44ce29d8cb7b src/sighandlers.h --- a/src/sighandlers.h Wed Oct 19 15:28:39 1994 +0000 +++ b/src/sighandlers.h Wed Oct 19 18:19:16 1994 +0000 @@ -21,6 +21,8 @@ */ +// This file should always be included after config.h! + #if !defined (octave_sighandlers_h) #define octave_sighandlers_h 1 @@ -43,6 +45,93 @@ extern void install_signal_handlers (void); +// This is taken directly from Emacs 19: + +#ifndef HAVE_SYS_SIGLIST +char *sys_siglist[NSIG + 1] = +{ +#ifdef AIX +/* AIX has changed the signals a bit */ + "bogus signal", /* 0 */ + "hangup", /* 1 SIGHUP */ + "interrupt", /* 2 SIGINT */ + "quit", /* 3 SIGQUIT */ + "illegal instruction", /* 4 SIGILL */ + "trace trap", /* 5 SIGTRAP */ + "IOT instruction", /* 6 SIGIOT */ + "crash likely", /* 7 SIGDANGER */ + "floating point exception", /* 8 SIGFPE */ + "kill", /* 9 SIGKILL */ + "bus error", /* 10 SIGBUS */ + "segmentation violation", /* 11 SIGSEGV */ + "bad argument to system call", /* 12 SIGSYS */ + "write on a pipe with no one to read it", /* 13 SIGPIPE */ + "alarm clock", /* 14 SIGALRM */ + "software termination signum", /* 15 SIGTERM */ + "user defined signal 1", /* 16 SIGUSR1 */ + "user defined signal 2", /* 17 SIGUSR2 */ + "death of a child", /* 18 SIGCLD */ + "power-fail restart", /* 19 SIGPWR */ + "bogus signal", /* 20 */ + "bogus signal", /* 21 */ + "bogus signal", /* 22 */ + "bogus signal", /* 23 */ + "bogus signal", /* 24 */ + "LAN I/O interrupt", /* 25 SIGAIO */ + "PTY I/O interrupt", /* 26 SIGPTY */ + "I/O intervention required", /* 27 SIGIOINT */ + "HFT grant", /* 28 SIGGRANT */ + "HFT retract", /* 29 SIGRETRACT */ + "HFT sound done", /* 30 SIGSOUND */ + "HFT input ready", /* 31 SIGMSG */ +#else /* not AIX */ + "bogus signal", /* 0 */ + "hangup", /* 1 SIGHUP */ + "interrupt", /* 2 SIGINT */ + "quit", /* 3 SIGQUIT */ + "illegal instruction", /* 4 SIGILL */ + "trace trap", /* 5 SIGTRAP */ + "IOT instruction", /* 6 SIGIOT */ + "EMT instruction", /* 7 SIGEMT */ + "floating point exception", /* 8 SIGFPE */ + "kill", /* 9 SIGKILL */ + "bus error", /* 10 SIGBUS */ + "segmentation violation", /* 11 SIGSEGV */ + "bad argument to system call", /* 12 SIGSYS */ + "write on a pipe with no one to read it", /* 13 SIGPIPE */ + "alarm clock", /* 14 SIGALRM */ + "software termination signum", /* 15 SIGTERM */ + "user defined signal 1", /* 16 SIGUSR1 */ + "user defined signal 2", /* 17 SIGUSR2 */ + "death of a child", /* 18 SIGCLD */ + "power-fail restart", /* 19 SIGPWR */ +#ifdef sun + "window size change", /* 20 SIGWINCH */ + "urgent socket condition", /* 21 SIGURG */ + "pollable event occured", /* 22 SIGPOLL */ + "stop (cannot be caught or ignored)", /* 23 SIGSTOP */ + "user stop requested from tty", /* 24 SIGTSTP */ + "stopped process has been continued", /* 25 SIGCONT */ + "background tty read attempted", /* 26 SIGTTIN */ + "background tty write attempted", /* 27 SIGTTOU */ + "virtual timer expired", /* 28 SIGVTALRM */ + "profiling timer expired", /* 29 SIGPROF */ + "exceeded cpu limit", /* 30 SIGXCPU */ + "exceeded file size limit", /* 31 SIGXFSZ */ + "process's lwps are blocked", /* 32 SIGWAITING */ + "special signal used by thread library", /* 33 SIGLWP */ +#ifdef SIGFREEZE + "Special Signal Used By CPR", /* 34 SIGFREEZE */ +#endif +#ifdef SIGTHAW + "Special Signal Used By CPR", /* 35 SIGTHAW */ +#endif +#endif /* sun */ +#endif /* not AIX */ + 0 + }; +#endif + #endif /*