diff options
| author | Paul Eggert | 2012-09-12 19:21:28 -0700 |
|---|---|---|
| committer | Paul Eggert | 2012-09-12 19:21:28 -0700 |
| commit | 4a4bbad21472cc0ede4691cbdbf8117b655b574f (patch) | |
| tree | 5c74092d854ca8b770578b8b7f99f5f3a9e65ca2 /src/process.c | |
| parent | bd8d610845a89c2cf5d7d75ff552df572b30f5e7 (diff) | |
| download | emacs-4a4bbad21472cc0ede4691cbdbf8117b655b574f.tar.gz emacs-4a4bbad21472cc0ede4691cbdbf8117b655b574f.zip | |
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/process.c')
| -rw-r--r-- | src/process.c | 29 |
1 files changed, 15 insertions, 14 deletions
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/>. */ | |||
| 75 | #include <bsdtty.h> | 75 | #include <bsdtty.h> |
| 76 | #endif | 76 | #endif |
| 77 | 77 | ||
| 78 | #ifdef USG5_4 | ||
| 79 | # include <sys/stream.h> | ||
| 80 | # include <sys/stropts.h> | ||
| 81 | #endif | ||
| 82 | |||
| 78 | #ifdef HAVE_RES_INIT | 83 | #ifdef HAVE_RES_INIT |
| 79 | #include <netinet/in.h> | 84 | #include <netinet/in.h> |
| 80 | #include <arpa/nameser.h> | 85 | #include <arpa/nameser.h> |
| @@ -212,17 +217,13 @@ static EMACS_INT update_tick; | |||
| 212 | "non-destructive" select. So we require either native select, | 217 | "non-destructive" select. So we require either native select, |
| 213 | or emulation of select using FIONREAD. */ | 218 | or emulation of select using FIONREAD. */ |
| 214 | 219 | ||
| 215 | #ifdef BROKEN_DATAGRAM_SOCKETS | 220 | #ifndef BROKEN_DATAGRAM_SOCKETS |
| 216 | #undef DATAGRAM_SOCKETS | 221 | # if defined HAVE_SELECT || defined USABLE_FIONREAD |
| 217 | #else | 222 | # if defined HAVE_SENDTO && defined HAVE_RECVFROM && defined EMSGSIZE |
| 218 | #ifndef DATAGRAM_SOCKETS | 223 | # define DATAGRAM_SOCKETS |
| 219 | #if defined (HAVE_SELECT) || defined (FIONREAD) | 224 | # endif |
| 220 | #if defined (HAVE_SENDTO) && defined (HAVE_RECVFROM) && defined (EMSGSIZE) | 225 | # endif |
| 221 | #define DATAGRAM_SOCKETS | 226 | #endif |
| 222 | #endif /* HAVE_SENDTO && HAVE_RECVFROM && EMSGSIZE */ | ||
| 223 | #endif /* HAVE_SELECT || FIONREAD */ | ||
| 224 | #endif /* DATAGRAM_SOCKETS */ | ||
| 225 | #endif /* BROKEN_DATAGRAM_SOCKETS */ | ||
| 226 | 227 | ||
| 227 | #if defined HAVE_LOCAL_SOCKETS && defined DATAGRAM_SOCKETS | 228 | #if defined HAVE_LOCAL_SOCKETS && defined DATAGRAM_SOCKETS |
| 228 | # define HAVE_SEQPACKET | 229 | # define HAVE_SEQPACKET |
| @@ -251,7 +252,7 @@ static int process_output_skip; | |||
| 251 | #endif | 252 | #endif |
| 252 | 253 | ||
| 253 | static void create_process (Lisp_Object, char **, Lisp_Object); | 254 | static void create_process (Lisp_Object, char **, Lisp_Object); |
| 254 | #ifdef SIGIO | 255 | #ifdef USABLE_SIGIO |
| 255 | static int keyboard_bit_set (SELECT_TYPE *); | 256 | static int keyboard_bit_set (SELECT_TYPE *); |
| 256 | #endif | 257 | #endif |
| 257 | static void deactivate_process (Lisp_Object); | 258 | static void deactivate_process (Lisp_Object); |
| @@ -4836,7 +4837,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, | |||
| 4836 | if (! NILP (wait_for_cell) && ! NILP (XCAR (wait_for_cell))) | 4837 | if (! NILP (wait_for_cell) && ! NILP (XCAR (wait_for_cell))) |
| 4837 | break; | 4838 | break; |
| 4838 | 4839 | ||
| 4839 | #ifdef SIGIO | 4840 | #ifdef USABLE_SIGIO |
| 4840 | /* If we think we have keyboard input waiting, but didn't get SIGIO, | 4841 | /* If we think we have keyboard input waiting, but didn't get SIGIO, |
| 4841 | go read it. This can happen with X on BSD after logging out. | 4842 | go read it. This can happen with X on BSD after logging out. |
| 4842 | In that case, there really is no input and no SIGIO, | 4843 | In that case, there really is no input and no SIGIO, |
| @@ -6853,7 +6854,7 @@ delete_gpm_wait_descriptor (int desc) | |||
| 6853 | 6854 | ||
| 6854 | # endif | 6855 | # endif |
| 6855 | 6856 | ||
| 6856 | # ifdef SIGIO | 6857 | # ifdef USABLE_SIGIO |
| 6857 | 6858 | ||
| 6858 | /* Return nonzero if *MASK has a bit set | 6859 | /* Return nonzero if *MASK has a bit set |
| 6859 | that corresponds to one of the keyboard input descriptors. */ | 6860 | that corresponds to one of the keyboard input descriptors. */ |