diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2012-09-12 19:21:28 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2012-09-12 19:21:28 -0700 |
commit | 4a4bbad21472cc0ede4691cbdbf8117b655b574f (patch) | |
tree | 5c74092d854ca8b770578b8b7f99f5f3a9e65ca2 /src | |
parent | bd8d610845a89c2cf5d7d75ff552df572b30f5e7 (diff) | |
download | emacs-4a4bbad21472cc0ede4691cbdbf8117b655b574f.tar.gz |
Simplify SIGIO usage.
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
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 36 | ||||
-rw-r--r-- | src/blockinput.h | 13 | ||||
-rw-r--r-- | src/conf_post.h | 16 | ||||
-rw-r--r-- | src/dispextern.h | 1 | ||||
-rw-r--r-- | src/dispnew.c | 2 | ||||
-rw-r--r-- | src/emacs.c | 4 | ||||
-rw-r--r-- | src/keyboard.c | 71 | ||||
-rw-r--r-- | src/process.c | 29 | ||||
-rw-r--r-- | src/sound.c | 12 | ||||
-rw-r--r-- | src/sysdep.c | 98 | ||||
-rw-r--r-- | src/syssignal.h | 21 | ||||
-rw-r--r-- | src/systty.h | 13 | ||||
-rw-r--r-- | src/term.c | 3 | ||||
-rw-r--r-- | src/xterm.c | 4 |
14 files changed, 112 insertions, 211 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 29e8ea4232e..c8588b973f8 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -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. diff --git a/src/blockinput.h b/src/blockinput.h index 3f61b2b27b9..7501bfc91a0 100644 --- a/src/blockinput.h +++ b/src/blockinput.h @@ -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 \ diff --git a/src/conf_post.h b/src/conf_post.h index 1bf40af260b..94934ffeadf 100644 --- a/src/conf_post.h +++ b/src/conf_post.h @@ -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 diff --git a/src/dispextern.h b/src/dispextern.h index 73f3350713f..365e8bcdcee 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -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 */ diff --git a/src/dispnew.c b/src/dispnew.c index fae415dcaf2..f6186e86048 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -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 diff --git a/src/emacs.c b/src/emacs.c index deaed25d9e8..e8150631311 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -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 (); diff --git a/src/keyboard.c b/src/keyboard.c index 7be3e9e118e..aec9028ae94 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -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; } -#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. */ diff --git a/src/process.c b/src/process.c index f80b5e80c76..b4b05a4b2e2 100644 --- a/src/process.c +++ b/src/process.c @@ -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. */ diff --git a/src/sound.c b/src/sound.c index 5729d704b6a..fe48bb277b2 100644 --- a/src/sound.c +++ b/src/sound.c @@ -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 diff --git a/src/sysdep.c b/src/sysdep.c index 0f16d1a7645..b8f35e79146 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -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) } } -#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 */ - /* 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 */ /* Directory routines for systems that don't have them. */ diff --git a/src/syssignal.h b/src/syssignal.h index c5529ae718a..5e733dd812d 100644 --- a/src/syssignal.h +++ b/src/syssignal.h @@ -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 diff --git a/src/systty.h b/src/systty.h index b660441a91e..b7f36c6c259 100644 --- a/src/systty.h +++ b/src/systty.h @@ -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 */ @@ -39,15 +37,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <unistd.h> -/* Special cases - inhibiting the use of certain features. */ - -/* Allow configure to inhibit use of FIONREAD. */ -#ifdef BROKEN_FIONREAD -#undef FIONREAD -#undef ASYNC -#endif - - /* Try to establish the correct character to disable terminal functions in a system-independent manner. Note that USG (at least) define _POSIX_VDISABLE as 0! */ diff --git a/src/term.c b/src/term.c index 0eaf76a13df..47bde5ac240 100644 --- a/src/term.c +++ b/src/term.c @@ -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 */ } diff --git a/src/xterm.c b/src/xterm.c index e5a5932beae..54d4f14bdd0 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -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 { |