diff options
| author | Dan Nicolaescu | 2010-08-22 08:14:37 -0700 |
|---|---|---|
| committer | Dan Nicolaescu | 2010-08-22 08:14:37 -0700 |
| commit | a7ebc409279c0d41ad60655d360d6c3c04ae77a1 (patch) | |
| tree | fe0cb3183e7b5e5e677f015e88e3666ba8d4835b /src/process.c | |
| parent | 91bdeb6639bb1613eb91d9bb04ef7d8c78dc1d9d (diff) | |
| download | emacs-a7ebc409279c0d41ad60655d360d6c3c04ae77a1.tar.gz emacs-a7ebc409279c0d41ad60655d360d6c3c04ae77a1.zip | |
Simplify termio code.
All non-MSDOS non-WINDOWSNT platforms define HAVE_TERMIOS, so
HAVE_TERMIO code is obsolete.
Replace HAVE_TERMIOS conditionals with !DOS_NT.
* src/systty.h: Do not define HAVE_TCATTR.
Remove HAVE_TERMIO, HAVE_LTCHARS and HAVE_TCHARS code.
Do not define EMACS_HAVE_TTY_PGRP. Only define
EMACS_GET_TTY_PGRP for !DOS_NT.
* src/sysdep.c: Include sysselect.h unconditionally. Do not include
sys/ioctl.h and termios.h, systty.h does it. Use
HAVE_SYS_UTSNAME_H instead of USG as an include guard.
(init_baud_rate): Remove HAVE_TERMIO code.
(child_setup_tty): Remove HAVE_TERMIO code.
(emacs_get_tty, emacs_set_tty): Remove HAVE_TERMIO, HAVE_TCHARS
and HAVE_LTCHARS code. Use !DOS_NT instead of HAVE_TCATTR.
(new_ltchars, new_tchars): Remove, unused.
(init_sys_modes): Remove HAVE_TERMIO, HAVE_TCHARS and HAVE_LTCHARS
code. Remove special casing for __mips__, it was a no-op. Remove
HAVE_TCATTR conditional, it is implied by HAVE_TERMIOS.
(init_sys_modes): Remove HPUX special case.
* src/process.c: Include stdlib.h unconditionally. Do not include
fcntl.h, systty.h does it. Remove conditional code for
HAVE_SERIAL, it is always true.
(process_send_signal): Remove HAVE_TERMIOS conditional, it's
always true when SIGNALS_VIA_CHARACTERS is true.
(Fcontinue_process, Fprocess_send_eof): Simplify conditionals:
!WINDOWSNT means HAVE_TERMIOS.
(create_process): Remove HAVE_TERMIOS, it's inside a HAVE_PTYS
conditional, which is true for all HAVE_TERMIOS systems.
* src/keyboard.c (init_keyboard): Do not use HAVE_TERMIO, use !DOS_NT
instead of HAVE_TERMIOS.
* src/emacs.c (shut_down_emacs): Use !defined DOS_NT instead of
EMACS_HAVE_TTY_PGRP.
* src/callproc.c (child_setup): Move EMACS_SET_TTY_PGRP use to the
non-MSDOS, non-WINDOWSNT code, it's only defined for such systems
anyway.
Diffstat (limited to 'src/process.c')
| -rw-r--r-- | src/process.c | 89 |
1 files changed, 5 insertions, 84 deletions
diff --git a/src/process.c b/src/process.c index 4a658623077..f348dca7d35 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -31,9 +31,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 31 | #ifdef HAVE_INTTYPES_H | 31 | #ifdef HAVE_INTTYPES_H |
| 32 | #include <inttypes.h> | 32 | #include <inttypes.h> |
| 33 | #endif | 33 | #endif |
| 34 | #ifdef STDC_HEADERS | ||
| 35 | #include <stdlib.h> | 34 | #include <stdlib.h> |
| 36 | #endif | ||
| 37 | 35 | ||
| 38 | #ifdef HAVE_UNISTD_H | 36 | #ifdef HAVE_UNISTD_H |
| 39 | #include <unistd.h> | 37 | #include <unistd.h> |
| @@ -61,9 +59,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 61 | 59 | ||
| 62 | #if defined(HAVE_SYS_IOCTL_H) | 60 | #if defined(HAVE_SYS_IOCTL_H) |
| 63 | #include <sys/ioctl.h> | 61 | #include <sys/ioctl.h> |
| 64 | #if !defined (O_NDELAY) && defined (HAVE_PTYS) && !defined(USG5) | ||
| 65 | #include <fcntl.h> | ||
| 66 | #endif /* HAVE_PTYS and no O_NDELAY */ | ||
| 67 | #if defined(HAVE_NET_IF_H) | 62 | #if defined(HAVE_NET_IF_H) |
| 68 | #include <net/if.h> | 63 | #include <net/if.h> |
| 69 | #endif /* HAVE_NET_IF_H */ | 64 | #endif /* HAVE_NET_IF_H */ |
| @@ -182,16 +177,9 @@ extern Lisp_Object QCfilter; | |||
| 182 | 177 | ||
| 183 | extern const char *get_operating_system_release (void); | 178 | extern const char *get_operating_system_release (void); |
| 184 | 179 | ||
| 185 | /* Serial processes require termios or Windows. */ | ||
| 186 | #if defined (HAVE_TERMIOS) || defined (WINDOWSNT) | ||
| 187 | #define HAVE_SERIAL | ||
| 188 | #endif | ||
| 189 | |||
| 190 | #ifdef HAVE_SERIAL | ||
| 191 | /* From sysdep.c or w32.c */ | 180 | /* From sysdep.c or w32.c */ |
| 192 | extern int serial_open (char *port); | 181 | extern int serial_open (char *port); |
| 193 | extern void serial_configure (struct Lisp_Process *p, Lisp_Object contact); | 182 | extern void serial_configure (struct Lisp_Process *p, Lisp_Object contact); |
| 194 | #endif | ||
| 195 | 183 | ||
| 196 | #ifndef HAVE_H_ERRNO | 184 | #ifndef HAVE_H_ERRNO |
| 197 | extern int h_errno; | 185 | extern int h_errno; |
| @@ -1903,7 +1891,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) | |||
| 1903 | setpgrp (); | 1891 | setpgrp (); |
| 1904 | #endif /* USG */ | 1892 | #endif /* USG */ |
| 1905 | #endif /* not HAVE_SETSID */ | 1893 | #endif /* not HAVE_SETSID */ |
| 1906 | #if defined (HAVE_TERMIOS) && defined (LDISC1) | 1894 | #if defined (LDISC1) |
| 1907 | if (pty_flag && xforkin >= 0) | 1895 | if (pty_flag && xforkin >= 0) |
| 1908 | { | 1896 | { |
| 1909 | struct termios t; | 1897 | struct termios t; |
| @@ -2569,7 +2557,6 @@ OPTION is not a supported option, return nil instead; otherwise return t. */) | |||
| 2569 | } | 2557 | } |
| 2570 | 2558 | ||
| 2571 | 2559 | ||
| 2572 | #ifdef HAVE_SERIAL | ||
| 2573 | DEFUN ("serial-process-configure", | 2560 | DEFUN ("serial-process-configure", |
| 2574 | Fserial_process_configure, | 2561 | Fserial_process_configure, |
| 2575 | Sserial_process_configure, | 2562 | Sserial_process_configure, |
| @@ -2865,7 +2852,6 @@ usage: (make-serial-process &rest ARGS) */) | |||
| 2865 | UNGCPRO; | 2852 | UNGCPRO; |
| 2866 | return proc; | 2853 | return proc; |
| 2867 | } | 2854 | } |
| 2868 | #endif /* HAVE_SERIAL */ | ||
| 2869 | 2855 | ||
| 2870 | /* Create a network stream/datagram client/server process. Treated | 2856 | /* Create a network stream/datagram client/server process. Treated |
| 2871 | exactly like a normal process when reading and writing. Primary | 2857 | exactly like a normal process when reading and writing. Primary |
| @@ -5801,9 +5787,6 @@ process_send_signal (Lisp_Object process, int signo, Lisp_Object current_group, | |||
| 5801 | /* If possible, send signals to the entire pgrp | 5787 | /* If possible, send signals to the entire pgrp |
| 5802 | by sending an input character to it. */ | 5788 | by sending an input character to it. */ |
| 5803 | 5789 | ||
| 5804 | /* TERMIOS is the latest and bestest, and seems most likely to | ||
| 5805 | work. If the system has it, use it. */ | ||
| 5806 | #ifdef HAVE_TERMIOS | ||
| 5807 | struct termios t; | 5790 | struct termios t; |
| 5808 | cc_t *sig_char = NULL; | 5791 | cc_t *sig_char = NULL; |
| 5809 | 5792 | ||
| @@ -5835,65 +5818,6 @@ process_send_signal (Lisp_Object process, int signo, Lisp_Object current_group, | |||
| 5835 | } | 5818 | } |
| 5836 | /* If we can't send the signal with a character, | 5819 | /* If we can't send the signal with a character, |
| 5837 | fall through and send it another way. */ | 5820 | fall through and send it another way. */ |
| 5838 | #else /* ! HAVE_TERMIOS */ | ||
| 5839 | |||
| 5840 | /* On Berkeley descendants, the following IOCTL's retrieve the | ||
| 5841 | current control characters. */ | ||
| 5842 | #if defined (TIOCGLTC) && defined (TIOCGETC) | ||
| 5843 | |||
| 5844 | struct tchars c; | ||
| 5845 | struct ltchars lc; | ||
| 5846 | |||
| 5847 | switch (signo) | ||
| 5848 | { | ||
| 5849 | case SIGINT: | ||
| 5850 | ioctl (p->infd, TIOCGETC, &c); | ||
| 5851 | send_process (proc, &c.t_intrc, 1, Qnil); | ||
| 5852 | return; | ||
| 5853 | case SIGQUIT: | ||
| 5854 | ioctl (p->infd, TIOCGETC, &c); | ||
| 5855 | send_process (proc, &c.t_quitc, 1, Qnil); | ||
| 5856 | return; | ||
| 5857 | #ifdef SIGTSTP | ||
| 5858 | case SIGTSTP: | ||
| 5859 | ioctl (p->infd, TIOCGLTC, &lc); | ||
| 5860 | send_process (proc, &lc.t_suspc, 1, Qnil); | ||
| 5861 | return; | ||
| 5862 | #endif /* ! defined (SIGTSTP) */ | ||
| 5863 | } | ||
| 5864 | |||
| 5865 | #else /* ! defined (TIOCGLTC) && defined (TIOCGETC) */ | ||
| 5866 | |||
| 5867 | /* On SYSV descendants, the TCGETA ioctl retrieves the current control | ||
| 5868 | characters. */ | ||
| 5869 | #ifdef TCGETA | ||
| 5870 | struct termio t; | ||
| 5871 | switch (signo) | ||
| 5872 | { | ||
| 5873 | case SIGINT: | ||
| 5874 | ioctl (p->infd, TCGETA, &t); | ||
| 5875 | send_process (proc, &t.c_cc[VINTR], 1, Qnil); | ||
| 5876 | return; | ||
| 5877 | case SIGQUIT: | ||
| 5878 | ioctl (p->infd, TCGETA, &t); | ||
| 5879 | send_process (proc, &t.c_cc[VQUIT], 1, Qnil); | ||
| 5880 | return; | ||
| 5881 | #ifdef SIGTSTP | ||
| 5882 | case SIGTSTP: | ||
| 5883 | ioctl (p->infd, TCGETA, &t); | ||
| 5884 | send_process (proc, &t.c_cc[VSWTCH], 1, Qnil); | ||
| 5885 | return; | ||
| 5886 | #endif /* ! defined (SIGTSTP) */ | ||
| 5887 | } | ||
| 5888 | #else /* ! defined (TCGETA) */ | ||
| 5889 | Your configuration files are messed up. | ||
| 5890 | /* If your system configuration files define SIGNALS_VIA_CHARACTERS, | ||
| 5891 | you'd better be using one of the alternatives above! */ | ||
| 5892 | #endif /* ! defined (TCGETA) */ | ||
| 5893 | #endif /* ! defined (TIOCGLTC) && defined (TIOCGETC) */ | ||
| 5894 | /* In this case, the code above should alway return. */ | ||
| 5895 | abort (); | ||
| 5896 | #endif /* ! defined HAVE_TERMIOS */ | ||
| 5897 | 5821 | ||
| 5898 | /* The code above may fall through if it can't | 5822 | /* The code above may fall through if it can't |
| 5899 | handle the signal. */ | 5823 | handle the signal. */ |
| @@ -6065,10 +5989,9 @@ traffic. */) | |||
| 6065 | #ifdef WINDOWSNT | 5989 | #ifdef WINDOWSNT |
| 6066 | if (fd_info[ p->infd ].flags & FILE_SERIAL) | 5990 | if (fd_info[ p->infd ].flags & FILE_SERIAL) |
| 6067 | PurgeComm (fd_info[ p->infd ].hnd, PURGE_RXABORT | PURGE_RXCLEAR); | 5991 | PurgeComm (fd_info[ p->infd ].hnd, PURGE_RXABORT | PURGE_RXCLEAR); |
| 6068 | #endif | 5992 | #else /* not WINDOWSNT */ |
| 6069 | #ifdef HAVE_TERMIOS | ||
| 6070 | tcflush (p->infd, TCIFLUSH); | 5993 | tcflush (p->infd, TCIFLUSH); |
| 6071 | #endif | 5994 | #endif /* not WINDOWSNT */ |
| 6072 | } | 5995 | } |
| 6073 | p->command = Qnil; | 5996 | p->command = Qnil; |
| 6074 | return process; | 5997 | return process; |
| @@ -6282,10 +6205,10 @@ process has been transmitted to the serial port. */) | |||
| 6282 | send_process (proc, "\004", 1, Qnil); | 6205 | send_process (proc, "\004", 1, Qnil); |
| 6283 | else if (EQ (XPROCESS (proc)->type, Qserial)) | 6206 | else if (EQ (XPROCESS (proc)->type, Qserial)) |
| 6284 | { | 6207 | { |
| 6285 | #ifdef HAVE_TERMIOS | 6208 | #ifndef WINDOWSNT |
| 6286 | if (tcdrain (XPROCESS (proc)->outfd) != 0) | 6209 | if (tcdrain (XPROCESS (proc)->outfd) != 0) |
| 6287 | error ("tcdrain() failed: %s", emacs_strerror (errno)); | 6210 | error ("tcdrain() failed: %s", emacs_strerror (errno)); |
| 6288 | #endif | 6211 | #endif /* not WINDOWSNT */ |
| 6289 | /* Do nothing on Windows because writes are blocking. */ | 6212 | /* Do nothing on Windows because writes are blocking. */ |
| 6290 | } | 6213 | } |
| 6291 | else | 6214 | else |
| @@ -7672,10 +7595,8 @@ The variable takes effect when `start-process' is called. */); | |||
| 7672 | defsubr (&Slist_processes); | 7595 | defsubr (&Slist_processes); |
| 7673 | defsubr (&Sprocess_list); | 7596 | defsubr (&Sprocess_list); |
| 7674 | defsubr (&Sstart_process); | 7597 | defsubr (&Sstart_process); |
| 7675 | #ifdef HAVE_SERIAL | ||
| 7676 | defsubr (&Sserial_process_configure); | 7598 | defsubr (&Sserial_process_configure); |
| 7677 | defsubr (&Smake_serial_process); | 7599 | defsubr (&Smake_serial_process); |
| 7678 | #endif /* HAVE_SERIAL */ | ||
| 7679 | defsubr (&Sset_network_process_option); | 7600 | defsubr (&Sset_network_process_option); |
| 7680 | defsubr (&Smake_network_process); | 7601 | defsubr (&Smake_network_process); |
| 7681 | defsubr (&Sformat_network_address); | 7602 | defsubr (&Sformat_network_address); |