aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1994-10-25 09:51:50 +0000
committerRichard M. Stallman1994-10-25 09:51:50 +0000
commit23dab951ecc505ba473d3f24716791b6b93b8938 (patch)
tree0e47ee9502ac5e074124dd0f53c67f53fd39a85d /src
parent6d73e33747cb5d62436760158d1eaf8e090061e9 (diff)
downloademacs-23dab951ecc505ba473d3f24716791b6b93b8938.tar.gz
emacs-23dab951ecc505ba473d3f24716791b6b93b8938.zip
Never use input_fd if using X.
(stuff_char): Do nothing if read_socket_hook. (setpgrp_of_tty): Function deleted. (init_sigio): Take fd as argument. Callers changed. Don't call request_sigio; do the work here. (request_sigio, unrequest_sigio): Do nothing if read_socket_hook. (init_sys_modes): Don't call EMACS_GET_TTY unless we are going to change the settings.
Diffstat (limited to 'src')
-rw-r--r--src/sysdep.c59
1 files changed, 42 insertions, 17 deletions
diff --git a/src/sysdep.c b/src/sysdep.c
index 7e1be187254..3067fe2ccbe 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -251,6 +251,9 @@ discard_tty_input ()
251stuff_char (c) 251stuff_char (c)
252 char c; 252 char c;
253{ 253{
254 if (read_socket_hook)
255 return;
256
254/* Should perhaps error if in batch mode */ 257/* Should perhaps error if in batch mode */
255#ifdef TIOCSTI 258#ifdef TIOCSTI
256 ioctl (input_fd, TIOCSTI, &c); 259 ioctl (input_fd, TIOCSTI, &c);
@@ -563,13 +566,6 @@ child_setup_tty (out)
563#endif /* not VMS */ 566#endif /* not VMS */
564 567
565#endif /* subprocesses */ 568#endif /* subprocesses */
566
567/*ARGSUSED*/
568setpgrp_of_tty (pid)
569 int pid;
570{
571 EMACS_SET_TTY_PGRP (input_fd, &pid);
572}
573 569
574/* Record a signal code and the handler for it. */ 570/* Record a signal code and the handler for it. */
575struct save_signal 571struct save_signal
@@ -766,12 +762,14 @@ restore_signal_handlers (saved_handlers)
766 762
767int old_fcntl_flags; 763int old_fcntl_flags;
768 764
769init_sigio () 765init_sigio (fd)
766 int fd;
770{ 767{
771#ifdef FASYNC 768#ifdef FASYNC
772 old_fcntl_flags = fcntl (input_fd, F_GETFL, 0) & ~FASYNC; 769 old_fcntl_flags = fcntl (fd, F_GETFL, 0) & ~FASYNC;
770 fcntl (fd, F_SETFL, old_fcntl_flags | FASYNC);
773#endif 771#endif
774 request_sigio (); 772 interrupts_deferred = 0;
775} 773}
776 774
777reset_sigio () 775reset_sigio ()
@@ -783,6 +781,9 @@ reset_sigio ()
783 781
784request_sigio () 782request_sigio ()
785{ 783{
784 if (read_socket_hook)
785 return;
786
786#ifdef SIGWINCH 787#ifdef SIGWINCH
787 sigunblock (sigmask (SIGWINCH)); 788 sigunblock (sigmask (SIGWINCH));
788#endif 789#endif
@@ -793,6 +794,9 @@ request_sigio ()
793 794
794unrequest_sigio () 795unrequest_sigio ()
795{ 796{
797 if (read_socket_hook)
798 return;
799
796#ifdef SIGWINCH 800#ifdef SIGWINCH
797 sigblock (sigmask (SIGWINCH)); 801 sigblock (sigmask (SIGWINCH));
798#endif 802#endif
@@ -806,6 +810,10 @@ unrequest_sigio ()
806request_sigio () 810request_sigio ()
807{ 811{
808 int on = 1; 812 int on = 1;
813
814 if (read_socket_hook)
815 return;
816
809 ioctl (input_fd, FIOASYNC, &on); 817 ioctl (input_fd, FIOASYNC, &on);
810 interrupts_deferred = 0; 818 interrupts_deferred = 0;
811} 819}
@@ -814,6 +822,9 @@ unrequest_sigio ()
814{ 822{
815 int off = 0; 823 int off = 0;
816 824
825 if (read_socket_hook)
826 return;
827
817 ioctl (input_fd, FIOASYNC, &off); 828 ioctl (input_fd, FIOASYNC, &off);
818 interrupts_deferred = 1; 829 interrupts_deferred = 1;
819} 830}
@@ -829,6 +840,9 @@ request_sigio ()
829 int on = 1; 840 int on = 1;
830 sigset_t st; 841 sigset_t st;
831 842
843 if (read_socket_hook)
844 return;
845
832 sigemptyset(&st); 846 sigemptyset(&st);
833 sigaddset(&st, SIGIO); 847 sigaddset(&st, SIGIO);
834 ioctl (input_fd, FIOASYNC, &on); 848 ioctl (input_fd, FIOASYNC, &on);
@@ -840,6 +854,9 @@ unrequest_sigio ()
840{ 854{
841 int off = 0; 855 int off = 0;
842 856
857 if (read_socket_hook)
858 return;
859
843 ioctl (input_fd, FIOASYNC, &off); 860 ioctl (input_fd, FIOASYNC, &off);
844 interrupts_deferred = 1; 861 interrupts_deferred = 1;
845} 862}
@@ -848,11 +865,17 @@ unrequest_sigio ()
848 865
849request_sigio () 866request_sigio ()
850{ 867{
868 if (read_socket_hook)
869 return;
870
851 croak ("request_sigio"); 871 croak ("request_sigio");
852} 872}
853 873
854unrequest_sigio () 874unrequest_sigio ()
855{ 875{
876 if (read_socket_hook)
877 return;
878
856 croak ("unrequest_sigio"); 879 croak ("unrequest_sigio");
857} 880}
858 881
@@ -1145,14 +1168,14 @@ init_sys_modes ()
1145 narrow_foreground_group (); 1168 narrow_foreground_group ();
1146#endif 1169#endif
1147 1170
1148 EMACS_GET_TTY (input_fd, &old_tty);
1149
1150#ifdef HAVE_X_WINDOWS 1171#ifdef HAVE_X_WINDOWS
1151 /* Emacs' window system on MSDOG uses the `internal terminal' and therefore 1172 /* Emacs' window system on MSDOG uses the `internal terminal' and therefore
1152 needs the initialization code below. */ 1173 needs the initialization code below. */
1153 if (!read_socket_hook && EQ (Vwindow_system, Qnil)) 1174 if (!read_socket_hook && EQ (Vwindow_system, Qnil))
1154#endif 1175#endif
1155 { 1176 {
1177 EMACS_GET_TTY (input_fd, &old_tty);
1178
1156 tty = old_tty; 1179 tty = old_tty;
1157 1180
1158#if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS) 1181#if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS)
@@ -1353,7 +1376,7 @@ init_sys_modes ()
1353 { 1376 {
1354 old_fcntl_owner = fcntl (input_fd, F_GETOWN, 0); 1377 old_fcntl_owner = fcntl (input_fd, F_GETOWN, 0);
1355 fcntl (input_fd, F_SETOWN, getpid ()); 1378 fcntl (input_fd, F_SETOWN, getpid ());
1356 init_sigio (); 1379 init_sigio (input_fd);
1357 } 1380 }
1358#endif /* F_GETOWN */ 1381#endif /* F_GETOWN */
1359#endif /* F_SETOWN_BUG */ 1382#endif /* F_SETOWN_BUG */
@@ -1361,7 +1384,7 @@ init_sys_modes ()
1361 1384
1362#ifdef BSD4_1 1385#ifdef BSD4_1
1363 if (interrupt_input) 1386 if (interrupt_input)
1364 init_sigio (); 1387 init_sigio (input_fd);
1365#endif 1388#endif
1366 1389
1367#ifdef VMS /* VMS sometimes has this symbol but lacks setvbuf. */ 1390#ifdef VMS /* VMS sometimes has this symbol but lacks setvbuf. */
@@ -1849,7 +1872,8 @@ sys_sleep (timeval)
1849 SYS$WAITFR (timer_ef); /* Wait for timer expiry only */ 1872 SYS$WAITFR (timer_ef); /* Wait for timer expiry only */
1850} 1873}
1851 1874
1852init_sigio () 1875init_sigio (fd)
1876 int fd;
1853{ 1877{
1854 request_sigio (); 1878 request_sigio ();
1855} 1879}
@@ -2380,12 +2404,13 @@ sys_open (path, oflag, mode)
2380 return open (path, oflag); 2404 return open (path, oflag);
2381} 2405}
2382 2406
2383init_sigio () 2407init_sigio (fd)
2408 int fd;
2384{ 2409{
2385 if (noninteractive) 2410 if (noninteractive)
2386 return; 2411 return;
2387 lmode = LINTRUP | lmode; 2412 lmode = LINTRUP | lmode;
2388 ioctl (0, TIOCLSET, &lmode); 2413 ioctl (fd, TIOCLSET, &lmode);
2389} 2414}
2390 2415
2391reset_sigio () 2416reset_sigio ()