]> code.delx.au - gnu-emacs/commitdiff
Simplify SIGIO usage.
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 13 Sep 2012 02:21:28 +0000 (19:21 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 13 Sep 2012 02:21:28 +0000 (19:21 -0700)
The code that dealt with SIGIO was crufty and confusing, e.g., it
played tricks like "#undef SIGIO" but these tricks were not used
consistently.  Simplify mostly by not #undeffing standard symbols,
e.g., use "defined USABLE_SIGIO" (our symbol, which we can define
or not as we please) rather than "defined SIGIO" (standard symbol
that we probably shouldn't #undef).
* configure.ac (NO_TERMIO, BROKEN_FIONREAD, BROKEN_SIGAIO)
(BROKEN_SIGPOLL, BROKEN_SIGPTY): Remove.
(USABLE_FIONREAD, USABLE_SIGIO): New symbols.  All uses of
'defined SIGIO' replaced with 'defined USABLE_SIGIO', with no need
to #undef SIGIO now (which was error-prone).  Likewise, all uses
of 'defined FIONREAD' replaced with 'defined USABLE_FIONREAD'.
* src/admin/CPP_DEFINES (BROKEN_SIGAIO, BROKEN_SIGIO, BROKEN_SIGPOLL)
(BROKEN_SIGPTY, NO_TERMIO): Remove.
* src/conf_post.h [USG5_4]: Do not include <sys/wait.h> here.
Modules that need it can include it.
[USG5_4 && emacs]: Likewise, do not include the streams stuff here.
* src/dispextern.h (ignore_sigio): New decl.
* src/emacs.c (shut_down_emacs): Invoke unrequest_sigio
unconditionally, since it's now a no-op if !USABLE_SIGIO.
* src/emacs.c (shut_down_emacs):
* src/keyboard.c (kbd_buffer_store_event_hold):
Use ignore_sigio rather than invoking 'signal' directly.
* src/keyboard.c (USABLE_FIONREAD && USG5_4): Include <sys/filio.h>,
for FIONREAD.
(FIONREAD, SIGIO): Do not #undef.
(tty_read_avail_input): Use #error rather than a syntax error.
* src/process.c [USG5_4]: Include <sys/stream.h> and <sys/stropts.h>,
for I_PIPE, used by SETUP_SLAVE_PTY.
(DATAGRAM_SOCKETS): Simplify defn, based on USABLE_FIONREAD.
* src/sysdep.c (croak): Remove; no longer needed.  This bit of
temporary code, with Fred N. Fish's comment that it's temporary,
has been in Emacs since at least 1992!
(init_sigio, reset_sigio, request_sigio, unrequest_sigio):
Arrange for them to be no-ops in all cases when ! USABLE_SIGIO.
* src/syssignal.h (croak): Remove decl.
(SIGIO, SIGPOO, SIGAIO, SIGPTY): Do not #undef; that's too fragile.
* src/systty.h [!NO_TERMIO]: Do not include <termio.h>; no longer needed
now that we're termios-only.
(FIONREAD, ASYNC) [BROKEN_FIONREAD]: Do not #undef.
* src/term.c (dissociate_if_controlling_tty): Use #error rather than
a run-time error.

Fixes: debbugs:12408
18 files changed:
ChangeLog
admin/CPP-DEFINES
admin/ChangeLog
configure.ac
src/ChangeLog
src/blockinput.h
src/conf_post.h
src/dispextern.h
src/dispnew.c
src/emacs.c
src/keyboard.c
src/process.c
src/sound.c
src/sysdep.c
src/syssignal.h
src/systty.h
src/term.c
src/xterm.c

index a8a7fdc2966fe3db6fc9bc5fb9a12dd43cfb3a7d..96cb4b2b89c112eadf8ad98b72ac1654389c9003 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2012-09-13  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Simplify SIGIO usage (Bug#12408).
+       * configure.ac (NO_TERMIO, BROKEN_FIONREAD, BROKEN_SIGAIO)
+       (BROKEN_SIGPOLL, BROKEN_SIGPTY): Remove.
+       (USABLE_FIONREAD, USABLE_SIGIO): New symbols.  All uses of
+       'defined SIGIO' replaced with 'defined USABLE_SIGIO', with no need
+       to #undef SIGIO now (which was error-prone).  Likewise, all uses
+       of 'defined FIONREAD' replaced with 'defined USABLE_FIONREAD'.
+
 2012-09-12  Jan Djärv  <jan.h.d@swipnet.se>
 
        * configure.ac: No --with-x-toolkit given: Try gtk3 toolkit first
index cf6ffee2c639c5f0c641daa530710fd6f2edabaf..834695d6c7827688a038860dcb2ac7a728b4c3ff 100644 (file)
@@ -91,10 +91,6 @@ BROKEN_GET_CURRENT_DIR_NAME
 BROKEN_NON_BLOCKING_CONNECT
 BROKEN_PTY_READ_AFTER_EAGAIN
 BROKEN_SA_RESTART
-BROKEN_SIGAIO
-BROKEN_SIGIO
-BROKEN_SIGPOLL
-BROKEN_SIGPTY
 CLASH_DETECTION
 DATA_SEG_BITS
 DATA_START
@@ -423,7 +419,6 @@ MAIL_USE_SYSTEM_LOCK
 MAXPATHLEN
 NLIST_STRUCT
 NO_EDITRES
-NO_TERMIO
 NSIG
 NSIG_MINIMUM
 NULL_DEVICE
index b70067d7465583eb6bcefeaf5a5ef4c4c435b58e..25eed8af5e334a93d45176e6af8171f11fab11a4 100644 (file)
@@ -1,3 +1,9 @@
+2012-09-13  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Simplify SIGIO usage (Bug#12408).
+       * CPP_DEFINES (BROKEN_SIGAIO, BROKEN_SIGIO, BROKEN_SIGPOLL)
+       (BROKEN_SIGPTY, NO_TERMIO): Remove.
+
 2012-09-11  Paul Eggert  <eggert@cs.ucla.edu>
 
        Simplify, document, and port floating-point (Bug#12381).
index ed1849514c1e737d367f37c85cfb63ef45d2f490..3761d8143647a77f52b6fe1dce22dc347960befd 100644 (file)
@@ -3271,10 +3271,6 @@ esac
 
 
 case $opsys in
-  darwin | gnu | hpux* | *bsd )
-    AC_DEFINE(NO_TERMIO, 1, [Define if termio.h should not be included.])
-    ;;
-
   irix6-5 | sol2* | unixware )
     dnl Some SVr4s don't define NSIG in sys/signal.h for ANSI environments;
     dnl instead, there's a system variable _sys_nsig.  Unfortunately, we
@@ -3284,26 +3280,16 @@ case $opsys in
     ;;
 esac
 
+emacs_broken_SIGIO=no
 
 case $opsys in
   dnl SIGIO exists, but the feature doesn't work in the way Emacs needs.
   dnl See eg <http://article.gmane.org/gmane.os.openbsd.ports/46831>.
   hpux* | irix6-5 | openbsd | sol2* | unixware )
-    AC_DEFINE(BROKEN_SIGIO, 1, [Define if SIGIO should not be used.])
+    emacs_broken_SIGIO=yes
     ;;
 
   aix4-2)
-    dnl BUILD 9008 - FIONREAD problem still exists in X-Windows.
-    AC_DEFINE(BROKEN_FIONREAD, 1, [Define if FIONREAD should not be used.])
-    dnl As we define BROKEN_FIONREAD, SIGIO will be undefined in systty.h.
-    dnl But, on AIX, SIGAIO, SIGPTY, and SIGPOLL are defined as SIGIO,
-    dnl which causes compilation error at init_signals in sysdep.c.
-    dnl So, we define these macros so that syssignal.h detects them
-    dnl and undefine SIGAIO, SIGPTY and SIGPOLL.
-    AC_DEFINE(BROKEN_SIGAIO, 1, [Define if SIGAIO should not be used.])
-    AC_DEFINE(BROKEN_SIGPOLL,1, [Define if SIGPOLL should not be used.])
-    AC_DEFINE(BROKEN_SIGPTY, 1, [Define if SIGPTY should not be used.])
-
     dnl On AIX Emacs uses the gmalloc.c malloc implementation.  But given
     dnl the way this system works, libc functions that return malloced
     dnl memory use the libc malloc implementation. Calling xfree or
@@ -3379,7 +3365,7 @@ dnl The choice is controlled by the variable interrupt_input.
 dnl
 dnl Define INTERRUPT_INPUT to make interrupt_input = 1 the default (use SIGIO)
 dnl
-dnl Emacs uses the presence or absence of the SIGIO and BROKEN_SIGIO macros
+dnl Emacs uses the presence of the USABLE_SIGIO macro
 dnl to indicate whether or not signal-driven I/O is possible.  It uses
 dnl INTERRUPT_INPUT to decide whether to use it by default.
 dnl
@@ -3900,6 +3886,46 @@ case $opsys in
     ;;
 esac
 
+AC_CACHE_CHECK([for usable FIONREAD], [emacs_cv_usable_FIONREAD],
+  [case $opsys in
+     aix4-2)
+       dnl BUILD 9008 - FIONREAD problem still exists in X-Windows.
+       emacs_cv_usable_FIONREAD=no
+       ;;
+
+     *)
+       AC_COMPILE_IFELSE(
+        [AC_LANG_PROGRAM([[#include <sys/types.h>
+                           #include <sys/ioctl.h>
+                           #ifdef USG5_4
+                           # include <sys/filio.h>
+                           #endif
+                         ]],
+                         [[int foo = ioctl (0, FIONREAD, &foo);]])],
+        [emacs_cv_usable_FIONREAD=yes],
+        [emacs_cv_usable_FIONREAD=no])
+       ;;
+   esac])
+if test $emacs_cv_usable_FIONREAD = yes; then
+  AC_DEFINE([USABLE_FIONREAD], [1], [Define to 1 if FIONREAD is usable.])
+
+  if test $emacs_broken_SIGIO = no; then
+    AC_CACHE_CHECK([for usable SIGIO], [emacs_cv_usable_SIGIO],
+      [AC_COMPILE_IFELSE(
+        [AC_LANG_PROGRAM([[#include <fcntl.h>
+                           #include <signal.h>
+                         ]],
+                         [[int foo = SIGIO | F_SETFL | FASYNC;]])],
+        [emacs_cv_usable_SIGIO=yes],
+        [emacs_cv_usable_SIGIO=no])],
+      [emacs_cv_usable_SIGIO=yes],
+      [emacs_cv_usable_SIGIO=no])
+    if test $emacs_cv_usable_SIGIO = yes; then
+      AC_DEFINE([USABLE_SIGIO], [1], [Define to 1 if SIGIO is usable.])
+    fi
+  fi
+fi
+
 
 case $opsys in
   dnl Emacs supplies its own malloc, but glib (part of Gtk+) calls
index 29e8ea4232ebb1ef65e9cf81f93c62eb39c938b3..c8588b973f8942d2e2a2a2db01b9d484aa891a54 100644 (file)
@@ -1,5 +1,41 @@
 2012-09-13  Paul Eggert  <eggert@cs.ucla.edu>
 
+       Simplify SIGIO usage (Bug#12408).
+       The code that dealt with SIGIO was crufty and confusing, e.g., it
+       played tricks like "#undef SIGIO" but these tricks were not used
+       consistently.  Simplify mostly by not #undeffing standard symbols,
+       e.g., use "defined USABLE_SIGIO" (our symbol, which we can define
+       or not as we please) rather than "defined SIGIO" (standard symbol
+       that we probably shouldn't #undef).
+       * conf_post.h [USG5_4]: Do not include <sys/wait.h> here.
+       Modules that need it can include it.
+       [USG5_4 && emacs]: Likewise, do not include the streams stuff here.
+       * dispextern.h (ignore_sigio): New decl.
+       * emacs.c (shut_down_emacs): Invoke unrequest_sigio
+       unconditionally, since it's now a no-op if !USABLE_SIGIO.
+       * emacs.c (shut_down_emacs):
+       * keyboard.c (kbd_buffer_store_event_hold):
+       Use ignore_sigio rather than invoking 'signal' directly.
+       * keyboard.c (USABLE_FIONREAD && USG5_4): Include <sys/filio.h>,
+       for FIONREAD.
+       (FIONREAD, SIGIO): Do not #undef.
+       (tty_read_avail_input): Use #error rather than a syntax error.
+       * process.c [USG5_4]: Include <sys/stream.h> and <sys/stropts.h>,
+       for I_PIPE, used by SETUP_SLAVE_PTY.
+       (DATAGRAM_SOCKETS): Simplify defn, based on USABLE_FIONREAD.
+       * sysdep.c (croak): Remove; no longer needed.  This bit of
+       temporary code, with Fred N. Fish's comment that it's temporary,
+       has been in Emacs since at least 1992!
+       (init_sigio, reset_sigio, request_sigio, unrequest_sigio):
+       Arrange for them to be no-ops in all cases when ! USABLE_SIGIO.
+       * syssignal.h (croak): Remove decl.
+       (SIGIO, SIGPOO, SIGAIO, SIGPTY): Do not #undef; that's too fragile.
+       * systty.h [!NO_TERMIO]: Do not include <termio.h>; no longer needed
+       now that we're termios-only.
+       (FIONREAD, ASYNC) [BROKEN_FIONREAD]: Do not #undef.
+       * term.c (dissociate_if_controlling_tty): Use #error rather than
+       a run-time error.
+
        Work around GCC and GNOME bugs when --enable-gcc-warnings.
        * emacsgtkfixed.c (G_STATIC_ASSERT): Redefine to use 'verify',
        to work around GNOME bug 683906.
index 3f61b2b27b90ea91b516d41aa729af3b7a1551c3..7501bfc91a058358295153a8b57c277465b3bcf1 100644 (file)
@@ -67,15 +67,10 @@ extern int pending_atimers;
    If doing signal-driven input, and a signal came in when input was
    blocked, reinvoke the signal handler now to deal with it.
 
-   We used to have two possible definitions of this macro - one for
-   when SIGIO was #defined, and one for when it wasn't; when SIGIO
-   wasn't #defined, we wouldn't bother to check if we should re-invoke
-   the signal handler.  But that doesn't work very well; some of the
-   files which use this macro don't #include the right files to get
-   SIGIO.
-
-   So, we always test interrupt_input_pending now; that's not too
-   expensive, and it'll never get set if we don't need to resignal.  */
+   Always test interrupt_input_pending; that's not too expensive, and
+   it'll never get set if we don't need to resignal.  This is simpler
+   than dealing here with every configuration option that might affect
+   whether interrupt_input_pending can be nonzero.  */
 
 #define UNBLOCK_INPUT                          \
   do                                           \
index 1bf40af260bee56ceae9bac1cdcbd45cbba2a2d0..94934ffeadf7a390f8e2c53188919dcb15006846 100644 (file)
@@ -133,22 +133,6 @@ You lose; /* Emacs for DOS must be compiled with DJGPP */
 #endif
 #endif  /* MSDOS */
 
-#ifdef USG5_4
-/* Get FIONREAD from <sys/filio.h>.  Get <sys/ttold.h> to get struct tchars.
-   But get <termio.h> first to make sure ttold.h doesn't interfere.  */
-#include <sys/wait.h>
-
-#ifdef emacs
-#include <sys/filio.h>
-#include <termio.h>
-#include <sys/ttold.h>
-#include <signal.h>
-#include <sys/stream.h>
-#include <sys/stropts.h>
-#include <sys/termios.h>
-#endif
-#endif  /* USG5_4 */
-
 /* Mac OS X / GNUstep need a bit more pure memory.  Of the existing knobs,
    SYSTEM_PURESIZE_EXTRA seems like the least likely to cause problems.  */
 #ifdef HAVE_NS
index 73f3350713fd49a1a0fc9184b26acbb26efbe5cc..365e8bcdcee13dfc7571857f42d0b89c354079cd 100644 (file)
@@ -3193,6 +3193,7 @@ void unrequest_sigio (void);
 int tabs_safe_p (int);
 void init_baud_rate (int);
 void init_sigio (int);
+void ignore_sigio (void);
 
 /* Defined in xfaces.c */
 
index fae415dcaf2cd9302229ebb198fafc3dbb9334e5..f6186e86048f717894000074c66b4f19f68cae23 100644 (file)
@@ -5971,7 +5971,7 @@ sit_for (Lisp_Object timeout, bool reading, int do_display)
     wrong_type_argument (Qnumberp, timeout);
 
 
-#ifdef SIGIO
+#ifdef USABLE_SIGIO
   gobble_input (0);
 #endif
 
index deaed25d9e8d7a7e4c81ebc2977ca337e4ee0475..e815063131148cd15c27c049dc3e7d6c9635faf0 100644 (file)
@@ -2035,12 +2035,10 @@ shut_down_emacs (int sig, Lisp_Object stuff)
   unlock_all_files ();
 #endif
 
-#ifdef SIGIO
   /* There is a tendency for a SIGIO signal to arrive within exit,
      and cause a SIGHUP because the input descriptor is already closed.  */
   unrequest_sigio ();
-  signal (SIGIO, SIG_IGN);
-#endif
+  ignore_sigio ();
 
 #ifdef WINDOWSNT
   term_ntproc ();
index 7be3e9e118e128a45f10d45ae101889f80ac24e2..aec9028ae943aec49309ecf6cbe66148c3eefd16 100644 (file)
@@ -56,6 +56,10 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <sys/ioctl.h>
 #endif /* not MSDOS */
 
+#if defined USABLE_FIONREAD && defined USG5_4
+# include <sys/filio.h>
+#endif
+
 #include "syssignal.h"
 
 #include <sys/types.h>
@@ -385,19 +389,6 @@ int interrupt_input;
 /* Nonzero while interrupts are temporarily deferred during redisplay.  */
 int interrupts_deferred;
 
-/* Allow configure to inhibit use of FIONREAD.  */
-#ifdef BROKEN_FIONREAD
-#undef FIONREAD
-#endif
-
-/* We are unable to use interrupts if FIONREAD is not available,
-   so flush SIGIO so we won't try.  */
-#if !defined (FIONREAD)
-#ifdef SIGIO
-#undef SIGIO
-#endif
-#endif
-
 /* If we support a window system, turn on the code to poll periodically
    to detect C-g.  It isn't actually used when doing interrupt input.  */
 #if defined (HAVE_WINDOW_SYSTEM) && !defined (USE_ASYNC_EVENTS)
@@ -448,7 +439,7 @@ static void restore_getcjmp (jmp_buf);
 static Lisp_Object apply_modifiers (int, Lisp_Object);
 static void clear_event (struct input_event *);
 static Lisp_Object restore_kboard_configuration (Lisp_Object);
-#ifdef SIGIO
+#ifdef USABLE_SIGIO
 static void deliver_input_available_signal (int signo);
 #endif
 static void handle_interrupt (void);
@@ -3646,10 +3637,8 @@ kbd_buffer_store_event_hold (register struct input_event *event,
           /* Don't read keyboard input until we have processed kbd_buffer.
              This happens when pasting text longer than KBD_BUFFER_SIZE/2.  */
           hold_keyboard_input ();
-#ifdef SIGIO
           if (!noninteractive)
-            signal (SIGIO, SIG_IGN);
-#endif
+            ignore_sigio ();
           stop_polling ();
         }
 #endif /* subprocesses */
@@ -3818,14 +3807,14 @@ kbd_buffer_get_event (KBOARD **kbp,
       /* Start reading input again, we have processed enough so we can
          accept new events again.  */
       unhold_keyboard_input ();
-#ifdef SIGIO
+#ifdef USABLE_SIGIO
       if (!noninteractive)
        {
          struct sigaction action;
          emacs_sigaction_init (&action, deliver_input_available_signal);
          sigaction (SIGIO, &action, 0);
        }
-#endif /* SIGIO */
+#endif
       start_polling ();
     }
 #endif /* subprocesses */
@@ -3867,10 +3856,9 @@ kbd_buffer_get_event (KBOARD **kbp,
       /* One way or another, wait until input is available; then, if
         interrupt handlers have not read it, read it now.  */
 
-/* Note SIGIO has been undef'd if FIONREAD is missing.  */
-#ifdef SIGIO
+#ifdef USABLE_SIGIO
       gobble_input (0);
-#endif /* SIGIO */
+#endif
       if (kbd_fetch_ptr != kbd_store_ptr)
        break;
 #if defined (HAVE_MOUSE) || defined (HAVE_GPM)
@@ -6769,7 +6757,7 @@ get_input_pending (int *addr, int flags)
 void
 gobble_input (int expected)
 {
-#ifdef SIGIO
+#ifdef USABLE_SIGIO
   if (interrupt_input)
     {
       sigset_t blocked, procmask;
@@ -6824,7 +6812,7 @@ record_asynch_buffer_change (void)
     return;
 
   /* Make sure no interrupt happens while storing the event.  */
-#ifdef SIGIO
+#ifdef USABLE_SIGIO
   if (interrupt_input)
     {
       sigset_t blocked, procmask;
@@ -7050,7 +7038,7 @@ tty_read_avail_input (struct terminal *terminal,
 #endif /* HAVE_GPM */
 
 /* Determine how many characters we should *try* to read.  */
-#ifdef FIONREAD
+#ifdef USABLE_FIONREAD
   /* Find out how much input is available.  */
   if (ioctl (fileno (tty->input), FIONREAD, &n_to_read) < 0)
     {
@@ -7063,14 +7051,12 @@ tty_read_avail_input (struct terminal *terminal,
     return 0;
   if (n_to_read > sizeof cbuf)
     n_to_read = sizeof cbuf;
-#else /* no FIONREAD */
-#if defined (USG) || defined (CYGWIN)
+#elif defined USG || defined CYGWIN
   /* Read some input if available, but don't wait.  */
   n_to_read = sizeof cbuf;
   fcntl (fileno (tty->input), F_SETFL, O_NDELAY);
 #else
-  you lose;
-#endif
+# error "Cannot read without possibly delaying"
 #endif
 
 #ifdef subprocesses
@@ -7119,7 +7105,7 @@ tty_read_avail_input (struct terminal *terminal,
 #endif
          );
 
-#ifndef FIONREAD
+#ifndef USABLE_FIONREAD
 #if defined (USG) || defined (CYGWIN)
   fcntl (fileno (tty->input), F_SETFL, 0);
 #endif /* USG or CYGWIN */
@@ -7190,7 +7176,7 @@ tty_read_avail_input (struct terminal *terminal,
   return nread;
 }
 \f
-#if defined SYNC_INPUT || defined SIGIO
+#if defined SYNC_INPUT || defined USABLE_SIGIO
 static void
 handle_async_input (void)
 {
@@ -7217,7 +7203,7 @@ handle_async_input (void)
   --handling_signal;
 #endif
 }
-#endif /* SYNC_INPUT || SIGIO */
+#endif /* SYNC_INPUT || USABLE_SIGIO */
 
 #ifdef SYNC_INPUT
 void
@@ -7229,8 +7215,7 @@ process_pending_signals (void)
 }
 #endif
 
-#ifdef SIGIO   /* for entire page */
-/* Note SIGIO has been undef'd if FIONREAD is missing.  */
+#ifdef USABLE_SIGIO
 
 static void
 handle_input_available_signal (int sig)
@@ -7253,7 +7238,7 @@ deliver_input_available_signal (int sig)
 {
   handle_on_main_thread (sig, handle_input_available_signal);
 }
-#endif /* SIGIO */
+#endif /* USABLE_SIGIO */
 
 /* Send ourselves a SIGIO.
 
@@ -7264,7 +7249,7 @@ deliver_input_available_signal (int sig)
 void
 reinvoke_input_signal (void)
 {
-#ifdef SIGIO
+#ifdef USABLE_SIGIO
   handle_async_input ();
 #endif
 }
@@ -7338,7 +7323,7 @@ handle_user_signal (int sig)
           }
 
        p->npending++;
-#ifdef SIGIO
+#ifdef USABLE_SIGIO
        if (interrupt_input)
          kill (getpid (), SIGIO);
        else
@@ -11007,8 +10992,7 @@ See also `current-input-mode'.  */)
   (Lisp_Object interrupt)
 {
   int new_interrupt_input;
-#ifdef SIGIO
-/* Note SIGIO has been undef'd if FIONREAD is missing.  */
+#ifdef USABLE_SIGIO
 #ifdef HAVE_X_WINDOWS
   if (x_display_list != NULL)
     {
@@ -11019,9 +11003,9 @@ See also `current-input-mode'.  */)
   else
 #endif /* HAVE_X_WINDOWS */
     new_interrupt_input = !NILP (interrupt);
-#else /* not SIGIO */
+#else /* not USABLE_SIGIO */
   new_interrupt_input = 0;
-#endif /* not SIGIO */
+#endif /* not USABLE_SIGIO */
 
   if (new_interrupt_input != interrupt_input)
     {
@@ -11415,15 +11399,14 @@ init_keyboard (void)
       sigaction (SIGQUIT, &action, 0);
 #endif /* not DOS_NT */
     }
-/* Note SIGIO has been undef'd if FIONREAD is missing.  */
-#ifdef SIGIO
+#ifdef USABLE_SIGIO
   if (!noninteractive)
     {
       struct sigaction action;
       emacs_sigaction_init (&action, deliver_input_available_signal);
       sigaction (SIGIO, &action, 0);
     }
-#endif /* SIGIO */
+#endif
 
 /* Use interrupt input by default, if it works and noninterrupt input
    has deficiencies.  */
index f80b5e80c76abca2ca962e3d61a3576c1aff8f55..b4b05a4b2e28414e8ffd0579302764fa93da4141 100644 (file)
@@ -75,6 +75,11 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <bsdtty.h>
 #endif
 
+#ifdef USG5_4
+# include <sys/stream.h>
+# include <sys/stropts.h>
+#endif
+
 #ifdef HAVE_RES_INIT
 #include <netinet/in.h>
 #include <arpa/nameser.h>
@@ -212,17 +217,13 @@ static EMACS_INT update_tick;
    "non-destructive" select.  So we require either native select,
    or emulation of select using FIONREAD.  */
 
-#ifdef BROKEN_DATAGRAM_SOCKETS
-#undef DATAGRAM_SOCKETS
-#else
-#ifndef DATAGRAM_SOCKETS
-#if defined (HAVE_SELECT) || defined (FIONREAD)
-#if defined (HAVE_SENDTO) && defined (HAVE_RECVFROM) && defined (EMSGSIZE)
-#define DATAGRAM_SOCKETS
-#endif /* HAVE_SENDTO && HAVE_RECVFROM && EMSGSIZE */
-#endif /* HAVE_SELECT || FIONREAD */
-#endif /* DATAGRAM_SOCKETS */
-#endif /* BROKEN_DATAGRAM_SOCKETS */
+#ifndef BROKEN_DATAGRAM_SOCKETS
+# if defined HAVE_SELECT || defined USABLE_FIONREAD
+#  if defined HAVE_SENDTO && defined HAVE_RECVFROM && defined EMSGSIZE
+#   define DATAGRAM_SOCKETS
+#  endif
+# endif
+#endif
 
 #if defined HAVE_LOCAL_SOCKETS && defined DATAGRAM_SOCKETS
 # define HAVE_SEQPACKET
@@ -251,7 +252,7 @@ static int process_output_skip;
 #endif
 
 static void create_process (Lisp_Object, char **, Lisp_Object);
-#ifdef SIGIO
+#ifdef USABLE_SIGIO
 static int keyboard_bit_set (SELECT_TYPE *);
 #endif
 static void deactivate_process (Lisp_Object);
@@ -4836,7 +4837,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
       if (! NILP (wait_for_cell) && ! NILP (XCAR (wait_for_cell)))
        break;
 
-#ifdef SIGIO
+#ifdef USABLE_SIGIO
       /* If we think we have keyboard input waiting, but didn't get SIGIO,
         go read it.  This can happen with X on BSD after logging out.
         In that case, there really is no input and no SIGIO,
@@ -6853,7 +6854,7 @@ delete_gpm_wait_descriptor (int desc)
 
 # endif
 
-# ifdef SIGIO
+# ifdef USABLE_SIGIO
 
 /* Return nonzero if *MASK has a bit set
    that corresponds to one of the keyboard input descriptors.  */
index 5729d704b6ac3efb058a7afd14729497aa14a420..fe48bb277b2188b577561d0c25ffbb27ead505fb 100644 (file)
@@ -314,7 +314,7 @@ sound_perror (const char *msg)
   int saved_errno = errno;
 
   turn_on_atimers (1);
-#ifdef SIGIO
+#ifdef USABLE_SIGIO
   {
     sigset_t unblocked;
     sigemptyset (&unblocked);
@@ -732,7 +732,7 @@ static void
 vox_configure (struct sound_device *sd)
 {
   int val;
-#ifdef SIGIO
+#ifdef USABLE_SIGIO
   sigset_t blocked;
 #endif
 
@@ -742,7 +742,7 @@ vox_configure (struct sound_device *sd)
      interrupted by a signal.  Block the ones we know to cause
      troubles.  */
   turn_on_atimers (0);
-#ifdef SIGIO
+#ifdef USABLE_SIGIO
   sigemptyset (&blocked);
   sigaddset (&blocked, SIGIO);
   pthread_sigmask (SIG_BLOCK, &blocked, 0);
@@ -778,7 +778,7 @@ vox_configure (struct sound_device *sd)
     }
 
   turn_on_atimers (1);
-#ifdef SIGIO
+#ifdef USABLE_SIGIO
   pthread_sigmask (SIG_UNBLOCK, &blocked, 0);
 #endif
 }
@@ -794,7 +794,7 @@ vox_close (struct sound_device *sd)
       /* On GNU/Linux, it seems that the device driver doesn't like to
         be interrupted by a signal.  Block the ones we know to cause
         troubles.  */
-#ifdef SIGIO
+#ifdef USABLE_SIGIO
       sigset_t blocked;
       sigemptyset (&blocked);
       sigaddset (&blocked, SIGIO);
@@ -806,7 +806,7 @@ vox_close (struct sound_device *sd)
       ioctl (sd->fd, SNDCTL_DSP_SYNC, NULL);
 
       turn_on_atimers (1);
-#ifdef SIGIO
+#ifdef USABLE_SIGIO
       pthread_sigmask (SIG_UNBLOCK, &blocked, 0);
 #endif
 
index 0f16d1a76459522dbb8159576cfb124b42b4a294..b8f35e791468f878be8b5f893714d081145894e3 100644 (file)
@@ -107,9 +107,6 @@ extern char *getwd (char *);
 
 static int emacs_get_tty (int, struct emacs_tty *);
 static int emacs_set_tty (int, struct emacs_tty *, int);
-#if defined TIOCNOTTY || defined USG5 || defined CYGWIN
-static _Noreturn void croak (char *);
-#endif
 
 /* ULLONG_MAX is missing on Red Hat Linux 7.3; see Bug#11781.  */
 #ifndef ULLONG_MAX
@@ -513,7 +510,7 @@ sys_subshell (void)
   saved_handlers[0].code = SIGINT;
   saved_handlers[1].code = SIGQUIT;
   saved_handlers[2].code = SIGTERM;
-#ifdef SIGIO
+#ifdef USABLE_SIGIO
   saved_handlers[3].code = SIGIO;
   saved_handlers[4].code = 0;
 #else
@@ -642,121 +639,75 @@ restore_signal_handlers (struct save_signal *saved_handlers)
     }
 }
 \f
-#ifndef SIGIO
-/* If SIGIO is broken, don't do anything. */
-void
-init_sigio (int fd)
-{
-}
-
-static void
-reset_sigio (int fd)
-{
-}
-
-void
-request_sigio (void)
-{
-}
-
-void
-unrequest_sigio (void)
-{
-}
-
-#else
-#ifdef F_SETFL
-
+#ifdef USABLE_SIGIO
 static int old_fcntl_flags[MAXDESC];
+#endif
 
 void
 init_sigio (int fd)
 {
-#ifdef FASYNC
+#ifdef USABLE_SIGIO
   old_fcntl_flags[fd] = fcntl (fd, F_GETFL, 0) & ~FASYNC;
   fcntl (fd, F_SETFL, old_fcntl_flags[fd] | FASYNC);
-#endif
   interrupts_deferred = 0;
+#endif
 }
 
 static void
 reset_sigio (int fd)
 {
-#ifdef FASYNC
+#ifdef USABLE_SIGIO
   fcntl (fd, F_SETFL, old_fcntl_flags[fd]);
 #endif
 }
 
-#ifdef FASYNC          /* F_SETFL does not imply existence of FASYNC */
-/* XXX Uhm, FASYNC is not used anymore here. */
-/* XXX Yeah, but you need it for SIGIO, don't you? */
-
 void
 request_sigio (void)
 {
+#ifdef USABLE_SIGIO
   sigset_t unblocked;
 
   if (noninteractive)
     return;
 
   sigemptyset (&unblocked);
-#ifdef SIGWINCH
+# ifdef SIGWINCH
   sigaddset (&unblocked, SIGWINCH);
-#endif
+# endif
   sigaddset (&unblocked, SIGIO);
   pthread_sigmask (SIG_UNBLOCK, &unblocked, 0);
 
   interrupts_deferred = 0;
+#endif
 }
 
 void
 unrequest_sigio (void)
 {
+#ifdef USABLE_SIGIO
   sigset_t blocked;
 
   if (noninteractive)
     return;
 
-#if 0 /* XXX What's wrong with blocking SIGIO under X?  */
-  if (x_display_list)
-    return;
-#endif
-
   sigemptyset (&blocked);
-#ifdef SIGWINCH
+# ifdef SIGWINCH
   sigaddset (&blocked, SIGWINCH);
-#endif
+# endif
   sigaddset (&blocked, SIGIO);
   pthread_sigmask (SIG_BLOCK, &blocked, 0);
   interrupts_deferred = 1;
-}
-
-#else /* no FASYNC */
-#ifndef MSDOS
-
-void
-request_sigio (void)
-{
-  if (noninteractive || read_socket_hook)
-    return;
-
-  croak ("request_sigio");
+#endif
 }
 
 void
-unrequest_sigio (void)
+ignore_sigio (void)
 {
-  if (noninteractive || read_socket_hook)
-    return;
-
-  croak ("unrequest_sigio");
+#ifdef USABLE_SIGIO
+  signal (SIGIO, SIG_IGN);
+#endif
 }
 
-#endif /* MSDOS */
-#endif /* FASYNC */
-#endif /* F_SETFL */
-#endif /* SIGIO */
-
 \f
 /* Getting and setting emacs_tty structures.  */
 
@@ -2051,19 +2002,6 @@ getwd (char *pathname)
 }
 
 #endif /* !defined (HAVE_GETWD) || defined (BROKEN_GETWD) */
-
-/*
- *     This function will go away as soon as all the stubs fixed. (fnf)
- */
-
-void
-croak (char *badfunc)
-{
-  printf ("%s not yet implemented\r\n", badfunc);
-  reset_all_sys_modes ();
-  exit (1);
-}
-
 #endif /* USG */
 \f
 /* Directory routines for systems that don't have them. */
index c5529ae718a51a178a34f85113435f853ad8c53c..5e733dd812da6d5902e0c4a2fba17599731ab268 100644 (file)
@@ -34,27 +34,6 @@ typedef void (*signal_handler_t) (int);
 
 extern void emacs_sigaction_init (struct sigaction *, signal_handler_t);
 
-#if ! (defined TIOCNOTTY || defined USG5 || defined CYGWIN)
-_Noreturn void croak (char *);
-#endif
-
-/* Interrupt input is not used if there is no FIONREAD.  */
-#include <sys/ioctl.h>
-#if defined BROKEN_SIGIO || ! defined FIONREAD || defined BROKEN_FIONREAD
-# undef SIGIO
-#endif
-
-/* These are only used by AIX  */
-#if defined (SIGPOLL) && defined (BROKEN_SIGPOLL)
-#undef SIGPOLL
-#endif
-#if defined (SIGAIO) && defined (BROKEN_SIGAIO)
-#undef SIGAIO
-#endif
-#if defined (SIGPTY) && defined (BROKEN_SIGPTY)
-#undef SIGPTY
-#endif
-
 #if NSIG < NSIG_MINIMUM
 # undef NSIG
 # define NSIG NSIG_MINIMUM
index b660441a91eb0986d2278b2d0923d84cf850ac26..b7f36c6c25908df3da1d6502937d36d292685cf3 100644 (file)
@@ -17,10 +17,8 @@ You should have received a copy of the GNU General Public License
 along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* Include the proper files.  */
+
 #ifndef DOS_NT
-#ifndef NO_TERMIO
-#include <termio.h>
-#endif /* not NO_TERMIO */
 #include <termios.h>
 #include <fcntl.h>
 #endif /* not DOS_NT */
@@ -38,15 +36,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <unistd.h>
 
-\f
-/* Special cases - inhibiting the use of certain features.  */
-
-/* Allow configure to inhibit use of FIONREAD.  */
-#ifdef BROKEN_FIONREAD
-#undef FIONREAD
-#undef ASYNC
-#endif
-
 \f
 /* Try to establish the correct character to disable terminal functions
    in a system-independent manner.  Note that USG (at least) define
index 0eaf76a13df144e6bc06d059b1527f962b354ce9..47bde5ac240c7bd7d1fc5567cacec8adce9f9d9c 100644 (file)
@@ -2944,8 +2944,7 @@ dissociate_if_controlling_tty (int fd)
         emacs_close (fd);
       pthread_sigmask (SIG_UNBLOCK, &blocked, 0);
 #else
-      /* Unknown system. */
-      croak ();
+# error "Unknown system."
 #endif  /* ! TIOCNOTTY */
 #endif  /* ! USG */
     }
index e5a5932beaedf95f6800c9cfea84969699010893..54d4f14bdd0f567a516cd8ecb4eb2f3f4901dd94 100644 (file)
@@ -7878,7 +7878,7 @@ For details, see etc/PROBLEMS.\n",
   {
     sigset_t unblocked;
     sigemptyset (&unblocked);
-#ifdef SIGIO
+#ifdef USABLE_SIGIO
     sigaddset (&unblocked, SIGIO);
 #endif
     sigaddset (&unblocked, SIGALRM);
@@ -10421,10 +10421,8 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
   fcntl (connection, F_SETOWN, getpid ());
 #endif /* ! defined (F_SETOWN) */
 
-#ifdef SIGIO
   if (interrupt_input)
     init_sigio (connection);
-#endif /* ! defined (SIGIO) */
 
 #ifdef USE_LUCID
   {