diff options
| -rw-r--r-- | src/process.c | 53 |
1 files changed, 14 insertions, 39 deletions
diff --git a/src/process.c b/src/process.c index 247c5e21357..31613f30769 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -211,13 +211,6 @@ char *sys_siglist[] = | |||
| 211 | #endif | 211 | #endif |
| 212 | #endif /* VMS */ | 212 | #endif /* VMS */ |
| 213 | 213 | ||
| 214 | #ifdef vipc | ||
| 215 | |||
| 216 | #include "vipc.h" | ||
| 217 | extern int comm_server; | ||
| 218 | extern int net_listen_address; | ||
| 219 | #endif /* vipc */ | ||
| 220 | |||
| 221 | /* t means use pty, nil means use a pipe, | 214 | /* t means use pty, nil means use a pipe, |
| 222 | maybe other values to come. */ | 215 | maybe other values to come. */ |
| 223 | Lisp_Object Vprocess_connection_type; | 216 | Lisp_Object Vprocess_connection_type; |
| @@ -1658,8 +1651,9 @@ static int waiting_for_user_input_p; | |||
| 1658 | read_kbd is a lisp value: | 1651 | read_kbd is a lisp value: |
| 1659 | 0 to ignore keyboard input, or | 1652 | 0 to ignore keyboard input, or |
| 1660 | 1 to return when input is available, or | 1653 | 1 to return when input is available, or |
| 1661 | -1 means caller will actually read the input, so don't throw to | 1654 | -1 meaning caller will actually read the input, so don't throw to |
| 1662 | the quit handler, or | 1655 | the quit handler, or |
| 1656 | a cons cell, meaning wait wait until its car is non-nil, or | ||
| 1663 | a process object, meaning wait until something arrives from that | 1657 | a process object, meaning wait until something arrives from that |
| 1664 | process. The return value is true iff we read some input from | 1658 | process. The return value is true iff we read some input from |
| 1665 | that process. | 1659 | that process. |
| @@ -1686,6 +1680,7 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display) | |||
| 1686 | int wait_channel = 0; | 1680 | int wait_channel = 0; |
| 1687 | struct Lisp_Process *wait_proc = 0; | 1681 | struct Lisp_Process *wait_proc = 0; |
| 1688 | int got_some_input = 0; | 1682 | int got_some_input = 0; |
| 1683 | Lisp_Object *wait_for_cell = 0; | ||
| 1689 | 1684 | ||
| 1690 | FD_ZERO (&Available); | 1685 | FD_ZERO (&Available); |
| 1691 | 1686 | ||
| @@ -1698,6 +1693,13 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display) | |||
| 1698 | XFASTINT (read_kbd) = 0; | 1693 | XFASTINT (read_kbd) = 0; |
| 1699 | } | 1694 | } |
| 1700 | 1695 | ||
| 1696 | /* If waiting for non-nil in a cell, record where. */ | ||
| 1697 | if (XTYPE (read_kbd) == Lisp_Cons) | ||
| 1698 | { | ||
| 1699 | wait_for_cell = &XCONS (read_kbd)->car; | ||
| 1700 | XFASTINT (read_kbd) = 0; | ||
| 1701 | } | ||
| 1702 | |||
| 1701 | waiting_for_user_input_p = XINT (read_kbd); | 1703 | waiting_for_user_input_p = XINT (read_kbd); |
| 1702 | 1704 | ||
| 1703 | /* Since we may need to wait several times, | 1705 | /* Since we may need to wait several times, |
| @@ -1846,29 +1848,20 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display) | |||
| 1846 | if (XINT (read_kbd) && detect_input_pending ()) | 1848 | if (XINT (read_kbd) && detect_input_pending ()) |
| 1847 | break; | 1849 | break; |
| 1848 | 1850 | ||
| 1851 | /* Exit now if the cell we're waiting for became non-nil. */ | ||
| 1852 | if (wait_for_cell && ! NILP (*wait_for_cell)) | ||
| 1853 | break; | ||
| 1854 | |||
| 1849 | #ifdef SIGIO | 1855 | #ifdef SIGIO |
| 1850 | /* If we think we have keyboard input waiting, but didn't get SIGIO | 1856 | /* If we think we have keyboard input waiting, but didn't get SIGIO |
| 1851 | go read it. This can happen with X on BSD after logging out. | 1857 | go read it. This can happen with X on BSD after logging out. |
| 1852 | In that case, there really is no input and no SIGIO, | 1858 | In that case, there really is no input and no SIGIO, |
| 1853 | but select says there is input. */ | 1859 | but select says there is input. */ |
| 1854 | 1860 | ||
| 1855 | /* | ||
| 1856 | if (XINT (read_kbd) && interrupt_input && (Available & fileno (stdin))) | ||
| 1857 | */ | ||
| 1858 | if (XINT (read_kbd) && interrupt_input && (FD_ISSET (fileno (stdin), &Available))) | 1861 | if (XINT (read_kbd) && interrupt_input && (FD_ISSET (fileno (stdin), &Available))) |
| 1859 | kill (0, SIGIO); | 1862 | kill (0, SIGIO); |
| 1860 | #endif | 1863 | #endif |
| 1861 | 1864 | ||
| 1862 | #ifdef vipc | ||
| 1863 | /* Check for connection from other process */ | ||
| 1864 | |||
| 1865 | if (Available & ChannelMask (comm_server)) | ||
| 1866 | { | ||
| 1867 | Available &= ~(ChannelMask (comm_server)); | ||
| 1868 | create_commchan (); | ||
| 1869 | } | ||
| 1870 | #endif /* vipc */ | ||
| 1871 | |||
| 1872 | if (! wait_proc) | 1865 | if (! wait_proc) |
| 1873 | got_some_input |= nfds > 0; | 1866 | got_some_input |= nfds > 0; |
| 1874 | 1867 | ||
| @@ -1897,24 +1890,6 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display) | |||
| 1897 | if (NILP (proc)) | 1890 | if (NILP (proc)) |
| 1898 | continue; | 1891 | continue; |
| 1899 | 1892 | ||
| 1900 | #ifdef vipc | ||
| 1901 | /* It's a command channel */ | ||
| 1902 | if (!NILP (XPROCESS (proc)->command_channel_p)) | ||
| 1903 | { | ||
| 1904 | ProcessCommChan (channel, proc); | ||
| 1905 | if (NILP (XPROCESS (proc)->command_channel_p)) | ||
| 1906 | { | ||
| 1907 | /* It has ceased to be a command channel! */ | ||
| 1908 | int bytes_available; | ||
| 1909 | if (ioctl (channel, FIONREAD, &bytes_available) < 0) | ||
| 1910 | bytes_available = 0; | ||
| 1911 | if (bytes_available) | ||
| 1912 | FD_SET (channel, &Available); | ||
| 1913 | } | ||
| 1914 | continue; | ||
| 1915 | } | ||
| 1916 | #endif /* vipc */ | ||
| 1917 | |||
| 1918 | /* Read data from the process, starting with our | 1893 | /* Read data from the process, starting with our |
| 1919 | buffered-ahead character if we have one. */ | 1894 | buffered-ahead character if we have one. */ |
| 1920 | 1895 | ||