aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c84
1 files changed, 30 insertions, 54 deletions
diff --git a/src/process.c b/src/process.c
index 9ba48ef7d56..68bdfa334e6 100644
--- a/src/process.c
+++ b/src/process.c
@@ -65,41 +65,12 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
65#include <bsdtty.h> 65#include <bsdtty.h>
66#endif 66#endif
67 67
68#ifdef HPUX
69#undef TIOCGPGRP
70#endif
71
72#ifdef IRIS 68#ifdef IRIS
73#include <sys/sysmacros.h> /* for "minor" */ 69#include <sys/sysmacros.h> /* for "minor" */
74#endif /* not IRIS */ 70#endif /* not IRIS */
75 71
76#include "systime.h" 72#include "systime.h"
77 73#include "systerm.h"
78#if defined (HPUX) && defined (HAVE_PTYS)
79#include <sys/ptyio.h>
80#endif
81
82#ifdef AIX
83#include <sys/pty.h>
84#include <unistd.h>
85#endif
86
87#ifdef SYSV_PTYS
88#include <sys/tty.h>
89#ifdef titan
90#include <sys/ttyhw.h>
91#include <sys/stream.h>
92#endif
93#include <sys/pty.h>
94#endif
95
96#ifdef XENIX
97#undef TIOCGETC /* Avoid confusing some conditionals that test this. */
98#endif
99
100#ifdef BROKEN_TIOCGETC
101#undef TIOCGETC
102#endif
103 74
104#include "lisp.h" 75#include "lisp.h"
105#include "window.h" 76#include "window.h"
@@ -1690,10 +1661,6 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display)
1690 EMACS_ADD_TIME (end_time, end_time, timeout); 1661 EMACS_ADD_TIME (end_time, end_time, timeout);
1691 } 1662 }
1692 1663
1693 /* Turn off periodic alarms (in case they are in use)
1694 because the select emulator uses alarms. */
1695 stop_polling ();
1696
1697 while (1) 1664 while (1)
1698 { 1665 {
1699 /* If calling from keyboard input, do not quit 1666 /* If calling from keyboard input, do not quit
@@ -1752,6 +1719,13 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display)
1752 if (!read_kbd) 1719 if (!read_kbd)
1753 FD_CLR (0, &Available); 1720 FD_CLR (0, &Available);
1754 1721
1722 /* If screen size has changed or the window is newly mapped,
1723 redisplay now, before we start to wait. There is a race
1724 condition here; if a SIGIO arrives between now and the select
1725 and indicates that a screen is trashed, we lose. */
1726 if (screen_garbaged)
1727 redisplay_preserve_echo_area ();
1728
1755 if (read_kbd && detect_input_pending ()) 1729 if (read_kbd && detect_input_pending ())
1756 nfds = 0; 1730 nfds = 0;
1757 else 1731 else
@@ -1765,7 +1739,7 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display)
1765 /* If we woke up due to SIGWINCH, actually change size now. */ 1739 /* If we woke up due to SIGWINCH, actually change size now. */
1766 do_pending_window_change (); 1740 do_pending_window_change ();
1767 1741
1768 if (time_limit && nfds == 0) /* timeout elapsed */ 1742 if (time_limit && nfds == 0) /* timeout elapsed */
1769 break; 1743 break;
1770 if (nfds < 0) 1744 if (nfds < 0)
1771 { 1745 {
@@ -1787,7 +1761,7 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display)
1787 So, SIGHUP is ignored (see def of PTY_TTY_NAME_SPRINTF 1761 So, SIGHUP is ignored (see def of PTY_TTY_NAME_SPRINTF
1788 in m-ibmrt-aix.h), and here we just ignore the select error. 1762 in m-ibmrt-aix.h), and here we just ignore the select error.
1789 Cleanup occurs c/o status_notify after SIGCLD. */ 1763 Cleanup occurs c/o status_notify after SIGCLD. */
1790 FD_ZERO (&Available); /* Cannot depend on values returned */ 1764 FD_ZERO (&Available); /* Cannot depend on values returned */
1791#else 1765#else
1792 abort (); 1766 abort ();
1793#endif 1767#endif
@@ -1815,8 +1789,8 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display)
1815 but select says there is input. */ 1789 but select says there is input. */
1816 1790
1817 /* 1791 /*
1818 if (read_kbd && interrupt_input && (Available & fileno (stdin))) 1792 if (read_kbd && interrupt_input && (Available & fileno (stdin)))
1819 */ 1793 */
1820 if (read_kbd && interrupt_input && (FD_ISSET (fileno (stdin), &Available))) 1794 if (read_kbd && interrupt_input && (FD_ISSET (fileno (stdin), &Available)))
1821 kill (0, SIGIO); 1795 kill (0, SIGIO);
1822#endif 1796#endif
@@ -1839,11 +1813,6 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display)
1839 if (read_kbd) 1813 if (read_kbd)
1840 do_pending_window_change (); 1814 do_pending_window_change ();
1841 1815
1842 /* If screen size has changed, redisplay now
1843 for either sit-for or keyboard input. */
1844 if (read_kbd && screen_garbaged)
1845 redisplay_preserve_echo_area ();
1846
1847 /* Check for data from a process or a command channel */ 1816 /* Check for data from a process or a command channel */
1848 for (channel = FIRST_PROC_DESC; channel < MAXDESC; channel++) 1817 for (channel = FIRST_PROC_DESC; channel < MAXDESC; channel++)
1849 { 1818 {
@@ -1880,7 +1849,7 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display)
1880 } 1849 }
1881 continue; 1850 continue;
1882 } 1851 }
1883#endif /* vipc */ 1852#endif /* vipc */
1884 1853
1885 /* Read data from the process, starting with our 1854 /* Read data from the process, starting with our
1886 buffered-ahead character if we have one. */ 1855 buffered-ahead character if we have one. */
@@ -1914,9 +1883,9 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display)
1914 subprocess termination and SIGCHLD. */ 1883 subprocess termination and SIGCHLD. */
1915 else if (nread == 0 && !NETCONN_P (proc)) 1884 else if (nread == 0 && !NETCONN_P (proc))
1916 ; 1885 ;
1917#endif /* O_NDELAY */ 1886#endif /* O_NDELAY */
1918#endif /* O_NONBLOCK */ 1887#endif /* O_NONBLOCK */
1919#endif /* EWOULDBLOCK */ 1888#endif /* EWOULDBLOCK */
1920#ifdef HAVE_PTYS 1889#ifdef HAVE_PTYS
1921 /* On some OSs with ptys, when the process on one end of 1890 /* On some OSs with ptys, when the process on one end of
1922 a pty exits, the other end gets an error reading with 1891 a pty exits, the other end gets an error reading with
@@ -1927,9 +1896,9 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display)
1927 get a SIGCHLD). */ 1896 get a SIGCHLD). */
1928 else if (nread == -1 && errno == EIO) 1897 else if (nread == -1 && errno == EIO)
1929 ; 1898 ;
1930#endif /* HAVE_PTYS */ 1899#endif /* HAVE_PTYS */
1931/* If we can detect process termination, don't consider the process 1900 /* If we can detect process termination, don't consider the process
1932 gone just because its pipe is closed. */ 1901 gone just because its pipe is closed. */
1933#ifdef SIGCHLD 1902#ifdef SIGCHLD
1934 else if (nread == 0 && !NETCONN_P (proc)) 1903 else if (nread == 0 && !NETCONN_P (proc))
1935 ; 1904 ;
@@ -1946,11 +1915,18 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display)
1946 = Fcons (Qexit, Fcons (make_number (256), Qnil)); 1915 = Fcons (Qexit, Fcons (make_number (256), Qnil));
1947 } 1916 }
1948 } 1917 }
1949 } /* end for each file descriptor */ 1918 } /* end for each file descriptor */
1950 } /* end while exit conditions not met */ 1919 } /* end while exit conditions not met */
1951 1920
1952 /* Resume periodic signals to poll for input, if necessary. */ 1921 /* If calling from keyboard input, do not quit
1953 start_polling (); 1922 since we want to return C-g as an input character.
1923 Otherwise, do pending quit if requested. */
1924 if (read_kbd >= 0)
1925 {
1926 /* Prevent input_pending from remaining set if we quit. */
1927 clear_input_pending ();
1928 QUIT;
1929 }
1954 1930
1955 return got_some_input; 1931 return got_some_input;
1956} 1932}