diff src/syssignal.h @ 613:023b83f4e54b

[xemacs-hg @ 2001-06-10 10:42:16 by ben] ------ signal-code changes ------ data.c, device-tty.c, emacs.c, floatfns.c, linuxplay.c, nas.c, process-unix.c, signal.c, sunplay.c, sysdep.c, syssignal.h: use EMACS_SIGNAL everywhere instead of playing preprocessing games with signal(). s\windowsnt.h, s\mingw32.h, syssignal.h: Remove mswindows signal code from s+m headers and move to syssignal.h as one of the five ways of signal handling, instead of playing preprocessing games. fileio.c, sysdep.c: Rename sys_do_signal to qxe_reliable_signal. signal.c, process-unix.c, profile.c: Create set_timeout_signal(); use instead of just EMACS_SIGNAL to establish a signal handler on a timeout signal; this does special things under Cygwin. nt.c: Eliminate term_ntproc(), which is blank; used as a SIGABRT handler, which was wrong anyway. nt.c, win32.c: Move signal code from nt.c to win32.c, since Cygwin needs it too when dealing with timeout signals. s\cygwin32.h: Define CYGWIN_BROKEN_SIGNALS. ------ other changes ------ s\mingw32.h: Fix problems with NOT_C_CODE being in the wrong place and excluding defines needed when building Makefile.in.in. filelock.c, mule-canna.c, mule-ccl.c, mule-ccl.h, ralloc.c, unexalpha.c, unexapollo.c, unexcw.c, unexelfsgi.c, unexnt.c, unexsni.c, s\aix3-1.h, s\bsd4-1.h, s\bsd4-2.h, s\bsd4-3.h, s\cxux.h, s\cygwin32.h, s\dgux.h, s\dgux5-4r2.h, s\dgux5-4r3.h, s\dgux5-4r4.h, s\ewsux5r4.h, s\gnu.h, s\hpux.h, s\iris3-5.h, s\iris3-6.h, s\irix3-3.h, s\linux.h, s\mingw32.h, s\newsos5.h, s\nextstep.h, s\ptx.h, s\riscix1-1.h, s\riscix1-2.h, s\rtu.h, s\sco4.h, s\sco5.h, s\template.h, s\ultrix.h, s\umax.h, s\umips.h, s\unipl5-0.h, s\unipl5-2.h, s\usg5-0.h, s\usg5-2-2.h, s\usg5-2.h, s\usg5-3.h, s\usg5-4.h, s\windowsnt.h, s\xenix.h: Rename 'GNU Emacs' to XEmacs in the copyright and comments. nas.c: Stylistic cleanup. Avoid preprocessing games with names such as play_sound_file. ------ signal-code changes ------ data.c, device-tty.c, emacs.c, floatfns.c, linuxplay.c, nas.c, process-unix.c, signal.c, sunplay.c, sysdep.c, syssignal.h: use EMACS_SIGNAL everywhere instead of playing preprocessing games with signal(). s\windowsnt.h, s\mingw32.h, syssignal.h: Remove mswindows signal code from s+m headers and move to syssignal.h as one of the five ways of signal handling, instead of playing preprocessing games. fileio.c, sysdep.c: Rename sys_do_signal to qxe_reliable_signal. signal.c, process-unix.c, profile.c: Create set_timeout_signal(); use instead of just EMACS_SIGNAL to establish a signal handler on a timeout signal; this does special things under Cygwin. nt.c: Eliminate term_ntproc(), which is blank; used as a SIGABRT handler, which was wrong anyway. nt.c, win32.c: Move signal code from nt.c to win32.c, since Cygwin needs it too when dealing with timeout signals. s\cygwin32.h: Define CYGWIN_BROKEN_SIGNALS. ------ other changes ------ s\mingw32.h: Fix problems with NOT_C_CODE being in the wrong place and excluding defines needed when building Makefile.in.in. filelock.c, mule-canna.c, mule-ccl.c, mule-ccl.h, ralloc.c, unexalpha.c, unexapollo.c, unexcw.c, unexelfsgi.c, unexnt.c, unexsni.c, s\aix3-1.h, s\bsd4-1.h, s\bsd4-2.h, s\bsd4-3.h, s\cxux.h, s\cygwin32.h, s\dgux.h, s\dgux5-4r2.h, s\dgux5-4r3.h, s\dgux5-4r4.h, s\ewsux5r4.h, s\gnu.h, s\hpux.h, s\iris3-5.h, s\iris3-6.h, s\irix3-3.h, s\linux.h, s\mingw32.h, s\newsos5.h, s\nextstep.h, s\ptx.h, s\riscix1-1.h, s\riscix1-2.h, s\rtu.h, s\sco4.h, s\sco5.h, s\template.h, s\ultrix.h, s\umax.h, s\umips.h, s\unipl5-0.h, s\unipl5-2.h, s\usg5-0.h, s\usg5-2-2.h, s\usg5-2.h, s\usg5-3.h, s\usg5-4.h, s\windowsnt.h, s\xenix.h: Rename 'GNU Emacs' to XEmacs in the copyright and comments. nas.c: Stylistic cleanup. Avoid preprocessing games with names such as play_sound_file. xemacs-faq.texi: Update sections on Windows and MacOS availability. alist.el, apropos.el, autoload.el, bytecomp.el, cl-compat.el, cl-extra.el, cl-macs.el, cl-seq.el, cl.el, cmdloop.el, cus-edit.el, derived.el, gpm.el, itimer.el, lisp-mode.el, shadow.el, version.el, wid-browse.el: Rename 'GNU Emacs' to XEmacs in the copyright. Fix other references to GNU Emacs that should be XEmacs or just Emacs. files.el: Fix warning. simple.el: transpose-line-up/down will now move the region up or down by a line if active. cvtmail.c, fakemail.c, gnuserv.c, gnuserv.h, gnuslib.c, make-msgfile.c, make-path.c, pop.c, pop.h, profile.c, tcp.c: Rename 'GNU Emacs' to XEmacs in the copyright. Fix comments in similar ways. digest-doc.c, sorted-doc.c: Fix program and author name to reflect XEmacs.
author ben
date Sun, 10 Jun 2001 10:42:39 +0000
parents abe6d1db359e
children 943eaba38521
line wrap: on
line diff
--- a/src/syssignal.h	Sat Jun 09 09:02:04 2001 +0000
+++ b/src/syssignal.h	Sun Jun 10 10:42:39 2001 +0000
@@ -89,11 +89,22 @@
    (typically, the POSIX sigaction/sigprocmask and either the older
    SYSV or BSD way).  In such a case, we prefer the POSIX way.
 
-   NOTE: We use EMACS_* macros for most signal operations, but
+   We used to say this:
+
+   [[ NOTE: We use EMACS_* macros for most signal operations, but
    just signal() for the standard signal-setting operation.
    Perhaps we should change this to EMACS_SIGNAL(), but that runs
    the risk of someone forgetting this convention and calling
-   signal() directly. */
+   signal() directly. ]]
+
+   But current policy is to avoid playing with macros as much as
+   possible, since in the long run it really just ends up creating
+   unmaintainable code -- someone newly reading the code is never
+   going to realize exactly which calls are redirected, and on
+   which systems, and where the redirection occurs.
+
+   Possibly we should use the new "qxe" convention.
+*/
 
 #ifndef NeXT
 typedef SIGTYPE (*signal_handler_t) (int);
@@ -103,12 +114,10 @@
 
 /* The POSIX way (sigaction, sigprocmask, sigpending, sigsuspend) */
 
-signal_handler_t sys_do_signal (int signal_number, signal_handler_t action);
-/* Provide our own version of signal(), that calls sigaction().  The
-   name is not sys_signal() because a function of that name exists in
-   libenergize.a */
-#undef signal
-#define signal sys_do_signal
+signal_handler_t qxe_reliable_signal (int signal_number,
+				      signal_handler_t action);
+
+#define EMACS_SIGNAL qxe_reliable_signal
 
 #define EMACS_BLOCK_SIGNAL(sig) do		\
 {						\
@@ -147,7 +156,7 @@
    problems.  However, we use sigvec() because it allows us to
    request interruptible I/O. */
 
-#define signal sys_do_signal
+#define EMACS_SIGNAL qxe_reliable_signal
 
 /* Is it necessary to define sigmask like this? */
 #ifndef sigmask
@@ -169,7 +178,7 @@
 /* The older SYSV way (signal/sigset, sighold, sigrelse, sigignore,
    sigpause) */
 
-#define signal sigset
+#define EMACS_SIGNAL sigset
 #define EMACS_BLOCK_SIGNAL(sig) sighold (sig)
 #define EMACS_UNBLOCK_SIGNAL(sig) sigrelse (sig)
 /* #### There's not really any simple way to implement this.
@@ -179,6 +188,28 @@
 #define EMACS_WAIT_FOR_SIGNAL(sig) sigpause (sig)
 #define EMACS_REESTABLISH_SIGNAL(sig, handler)
 
+#elif defined (WIN32_NATIVE)
+
+/* MS Windows signal emulation (in turns emulates the sigset/sighold
+   paradigm) */
+
+#define EMACS_SIGNAL mswindows_sigset
+#define EMACS_BLOCK_SIGNAL(sig) mswindows_sighold (sig)
+#define EMACS_UNBLOCK_SIGNAL(sig) mswindows_sigrelse (sig)
+/* #### There's not really any simple way to implement this.
+   Since EMACS_UNBLOCK_ALL_SIGNALS() is only called once (at startup),
+   it's probably OK to just ignore it. */
+#define EMACS_UNBLOCK_ALL_SIGNALS() 0
+#define EMACS_WAIT_FOR_SIGNAL(sig) mswindows_sigpause (sig)
+#define EMACS_REESTABLISH_SIGNAL(sig, handler)
+
+/* Defines that we need that aren't in the standard signal.h  */
+#define SIGHUP  1               /* Hang up */
+#define SIGQUIT 3               /* Quit process */
+#define SIGKILL 9               /* Die, die die */
+#define SIGALRM 14              /* Alarm */
+#define SIGPROF 29		/* Profiling timer exp */
+
 #else
 
 /* The oldest SYSV way (signal only; unreliable signals) */
@@ -186,6 +217,7 @@
 /* Old USG systems don't really have signal blocking.
    We indicate this by not defining EMACS_BLOCK_SIGNAL or
    EMACS_WAIT_FOR_SIGNAL. */
+#define EMACS_SIGNAL signal
 #define EMACS_UNBLOCK_SIGNAL(sig) 0
 #define EMACS_UNBLOCK_ALL_SIGNALS() 0
 #define EMACS_REESTABLISH_SIGNAL(sig, handler) do	\
@@ -205,7 +237,7 @@
    reestablished (SYSV Release 2 and earlier). */
 #define OBNOXIOUS_SYSV_SIGCLD_BEHAVIOR
 
-#endif
+#endif /* different signalling methods */
 
 /* On bsd, [man says] kill does not accept a negative number to kill a pgrp.
    Must do that using the killpg call.  */
@@ -234,14 +266,20 @@
 SIGTYPE memory_warning_signal (int sig);
 #endif
 
-#ifdef WIN32_NATIVE
-/* Prototypes for signal functions, see nt.c */
+#if defined (WIN32_NATIVE) || defined (CYGWIN_BROKEN_SIGNALS)
 typedef void (__cdecl *mswindows_sighandler) (int);
-mswindows_sighandler mswindows_sigset (int sig, mswindows_sighandler handler);
+
+/* Prototypes for signal functions, see win32.c */
 int mswindows_sighold (int nsig);
 int mswindows_sigrelse (int nsig);
 int mswindows_sigpause (int nsig);
 int mswindows_raise (int nsig);
-#endif /* WIN32_NATIVE */
+mswindows_sighandler mswindows_sigset (int sig, mswindows_sighandler handler);
+
+#endif /* defined (WIN32_NATIVE) || defined (CYGWIN_BROKEN_SIGNALS) */
+
+signal_handler_t set_timeout_signal (int signal_number,
+				     signal_handler_t action);
+
 
 #endif /* INCLUDED_syssignal_h_ */