diff options
| author | root | 2013-08-12 12:27:22 +0200 |
|---|---|---|
| committer | root | 2013-08-12 12:27:22 +0200 |
| commit | c39e73975f7371a6458cd63967d39ba77a1e871a (patch) | |
| tree | 145fb3d8489ecd65ac6b1887e17a204bff751286 /src/process.c | |
| parent | 2427b15992fe47646a2bf2b55891f1e482dedaa0 (diff) | |
| parent | 6edea0a595d292c4d3f1a7e862195be07c874e40 (diff) | |
| download | emacs-c39e73975f7371a6458cd63967d39ba77a1e871a.tar.gz emacs-c39e73975f7371a6458cd63967d39ba77a1e871a.zip | |
merge from trunk
Conflicts:
src/Makefile.in
Diffstat (limited to 'src/process.c')
| -rw-r--r-- | src/process.c | 184 |
1 files changed, 73 insertions, 111 deletions
diff --git a/src/process.c b/src/process.c index f4ae662468b..99c707ff97b 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -323,10 +323,10 @@ static SELECT_TYPE connect_wait_mask; | |||
| 323 | static int num_pending_connects; | 323 | static int num_pending_connects; |
| 324 | #endif /* NON_BLOCKING_CONNECT */ | 324 | #endif /* NON_BLOCKING_CONNECT */ |
| 325 | 325 | ||
| 326 | /* The largest descriptor currently in use for a process object. */ | 326 | /* The largest descriptor currently in use for a process object; -1 if none. */ |
| 327 | static int max_process_desc; | 327 | static int max_process_desc; |
| 328 | 328 | ||
| 329 | /* The largest descriptor currently in use for input. */ | 329 | /* The largest descriptor currently in use for input; -1 if none. */ |
| 330 | static int max_input_desc; | 330 | static int max_input_desc; |
| 331 | 331 | ||
| 332 | /* Indexed by descriptor, gives the process (if any) for that descriptor */ | 332 | /* Indexed by descriptor, gives the process (if any) for that descriptor */ |
| @@ -500,13 +500,27 @@ add_write_fd (int fd, fd_callback func, void *data) | |||
| 500 | fd_callback_info[fd].condition |= FOR_WRITE; | 500 | fd_callback_info[fd].condition |= FOR_WRITE; |
| 501 | } | 501 | } |
| 502 | 502 | ||
| 503 | /* FD is no longer an input descriptor; update max_input_desc accordingly. */ | ||
| 504 | |||
| 505 | static void | ||
| 506 | delete_input_desc (int fd) | ||
| 507 | { | ||
| 508 | if (fd == max_input_desc) | ||
| 509 | { | ||
| 510 | do | ||
| 511 | fd--; | ||
| 512 | while (0 <= fd && ! (FD_ISSET (fd, &input_wait_mask) | ||
| 513 | || FD_ISSET (fd, &write_mask))); | ||
| 514 | |||
| 515 | max_input_desc = fd; | ||
| 516 | } | ||
| 517 | } | ||
| 518 | |||
| 503 | /* Stop monitoring file descriptor FD for when write is possible. */ | 519 | /* Stop monitoring file descriptor FD for when write is possible. */ |
| 504 | 520 | ||
| 505 | void | 521 | void |
| 506 | delete_write_fd (int fd) | 522 | delete_write_fd (int fd) |
| 507 | { | 523 | { |
| 508 | int lim = max_input_desc; | ||
| 509 | |||
| 510 | eassert (fd < MAXDESC); | 524 | eassert (fd < MAXDESC); |
| 511 | FD_CLR (fd, &write_mask); | 525 | FD_CLR (fd, &write_mask); |
| 512 | fd_callback_info[fd].condition &= ~FOR_WRITE; | 526 | fd_callback_info[fd].condition &= ~FOR_WRITE; |
| @@ -514,15 +528,7 @@ delete_write_fd (int fd) | |||
| 514 | { | 528 | { |
| 515 | fd_callback_info[fd].func = 0; | 529 | fd_callback_info[fd].func = 0; |
| 516 | fd_callback_info[fd].data = 0; | 530 | fd_callback_info[fd].data = 0; |
| 517 | 531 | delete_input_desc (fd); | |
| 518 | if (fd == max_input_desc) | ||
| 519 | for (fd = lim; fd >= 0; fd--) | ||
| 520 | if (FD_ISSET (fd, &input_wait_mask) || FD_ISSET (fd, &write_mask)) | ||
| 521 | { | ||
| 522 | max_input_desc = fd; | ||
| 523 | break; | ||
| 524 | } | ||
| 525 | |||
| 526 | } | 532 | } |
| 527 | } | 533 | } |
| 528 | 534 | ||
| @@ -640,19 +646,16 @@ status_message (struct Lisp_Process *p) | |||
| 640 | return Fcopy_sequence (Fsymbol_name (symbol)); | 646 | return Fcopy_sequence (Fsymbol_name (symbol)); |
| 641 | } | 647 | } |
| 642 | 648 | ||
| 643 | #ifdef HAVE_PTYS | 649 | enum { PTY_NAME_SIZE = 24 }; |
| 644 | |||
| 645 | /* The file name of the pty opened by allocate_pty. */ | ||
| 646 | static char pty_name[24]; | ||
| 647 | 650 | ||
| 648 | /* Open an available pty, returning a file descriptor. | 651 | /* Open an available pty, returning a file descriptor. |
| 649 | Return -1 on failure. | 652 | Store into PTY_NAME the file name of the terminal corresponding to the pty. |
| 650 | The file name of the terminal corresponding to the pty | 653 | Return -1 on failure. */ |
| 651 | is left in the variable pty_name. */ | ||
| 652 | 654 | ||
| 653 | static int | 655 | static int |
| 654 | allocate_pty (void) | 656 | allocate_pty (char pty_name[PTY_NAME_SIZE]) |
| 655 | { | 657 | { |
| 658 | #ifdef HAVE_PTYS | ||
| 656 | int fd; | 659 | int fd; |
| 657 | 660 | ||
| 658 | #ifdef PTY_ITERATION | 661 | #ifdef PTY_ITERATION |
| @@ -697,9 +700,9 @@ allocate_pty (void) | |||
| 697 | return fd; | 700 | return fd; |
| 698 | } | 701 | } |
| 699 | } | 702 | } |
| 703 | #endif /* HAVE_PTYS */ | ||
| 700 | return -1; | 704 | return -1; |
| 701 | } | 705 | } |
| 702 | #endif /* HAVE_PTYS */ | ||
| 703 | 706 | ||
| 704 | static Lisp_Object | 707 | static Lisp_Object |
| 705 | make_process (Lisp_Object name) | 708 | make_process (Lisp_Object name) |
| @@ -1333,7 +1336,7 @@ Returns nil if format of ADDRESS is invalid. */) | |||
| 1333 | } | 1336 | } |
| 1334 | 1337 | ||
| 1335 | DEFUN ("process-list", Fprocess_list, Sprocess_list, 0, 0, 0, | 1338 | DEFUN ("process-list", Fprocess_list, Sprocess_list, 0, 0, 0, |
| 1336 | doc: /* Return a list of all processes. */) | 1339 | doc: /* Return a list of all processes that are Emacs sub-processes. */) |
| 1337 | (void) | 1340 | (void) |
| 1338 | { | 1341 | { |
| 1339 | return Fmapcar (Qcdr, Vprocess_alist); | 1342 | return Fmapcar (Qcdr, Vprocess_alist); |
| @@ -1602,12 +1605,6 @@ start_process_unwind (Lisp_Object proc) | |||
| 1602 | remove_process (proc); | 1605 | remove_process (proc); |
| 1603 | } | 1606 | } |
| 1604 | 1607 | ||
| 1605 | static void | ||
| 1606 | create_process_1 (struct atimer *timer) | ||
| 1607 | { | ||
| 1608 | /* Nothing to do. */ | ||
| 1609 | } | ||
| 1610 | |||
| 1611 | 1608 | ||
| 1612 | static void | 1609 | static void |
| 1613 | create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) | 1610 | create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) |
| @@ -1621,14 +1618,14 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) | |||
| 1621 | #endif | 1618 | #endif |
| 1622 | int forkin, forkout; | 1619 | int forkin, forkout; |
| 1623 | bool pty_flag = 0; | 1620 | bool pty_flag = 0; |
| 1621 | char pty_name[PTY_NAME_SIZE]; | ||
| 1624 | Lisp_Object lisp_pty_name = Qnil; | 1622 | Lisp_Object lisp_pty_name = Qnil; |
| 1625 | Lisp_Object encoded_current_dir; | 1623 | Lisp_Object encoded_current_dir; |
| 1626 | 1624 | ||
| 1627 | inchannel = outchannel = -1; | 1625 | inchannel = outchannel = -1; |
| 1628 | 1626 | ||
| 1629 | #ifdef HAVE_PTYS | ||
| 1630 | if (!NILP (Vprocess_connection_type)) | 1627 | if (!NILP (Vprocess_connection_type)) |
| 1631 | outchannel = inchannel = allocate_pty (); | 1628 | outchannel = inchannel = allocate_pty (pty_name); |
| 1632 | 1629 | ||
| 1633 | if (inchannel >= 0) | 1630 | if (inchannel >= 0) |
| 1634 | { | 1631 | { |
| @@ -1647,7 +1644,6 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) | |||
| 1647 | lisp_pty_name = build_string (pty_name); | 1644 | lisp_pty_name = build_string (pty_name); |
| 1648 | } | 1645 | } |
| 1649 | else | 1646 | else |
| 1650 | #endif /* HAVE_PTYS */ | ||
| 1651 | { | 1647 | { |
| 1652 | if (emacs_pipe (sv) != 0) | 1648 | if (emacs_pipe (sv) != 0) |
| 1653 | report_file_error ("Creating pipe", Qnil); | 1649 | report_file_error ("Creating pipe", Qnil); |
| @@ -1704,7 +1700,6 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) | |||
| 1704 | Lisp_Object volatile encoded_current_dir_volatile = encoded_current_dir; | 1700 | Lisp_Object volatile encoded_current_dir_volatile = encoded_current_dir; |
| 1705 | Lisp_Object volatile lisp_pty_name_volatile = lisp_pty_name; | 1701 | Lisp_Object volatile lisp_pty_name_volatile = lisp_pty_name; |
| 1706 | Lisp_Object volatile process_volatile = process; | 1702 | Lisp_Object volatile process_volatile = process; |
| 1707 | bool volatile pty_flag_volatile = pty_flag; | ||
| 1708 | char **volatile new_argv_volatile = new_argv; | 1703 | char **volatile new_argv_volatile = new_argv; |
| 1709 | int volatile forkin_volatile = forkin; | 1704 | int volatile forkin_volatile = forkin; |
| 1710 | int volatile forkout_volatile = forkout; | 1705 | int volatile forkout_volatile = forkout; |
| @@ -1716,12 +1711,13 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) | |||
| 1716 | encoded_current_dir = encoded_current_dir_volatile; | 1711 | encoded_current_dir = encoded_current_dir_volatile; |
| 1717 | lisp_pty_name = lisp_pty_name_volatile; | 1712 | lisp_pty_name = lisp_pty_name_volatile; |
| 1718 | process = process_volatile; | 1713 | process = process_volatile; |
| 1719 | pty_flag = pty_flag_volatile; | ||
| 1720 | new_argv = new_argv_volatile; | 1714 | new_argv = new_argv_volatile; |
| 1721 | forkin = forkin_volatile; | 1715 | forkin = forkin_volatile; |
| 1722 | forkout = forkout_volatile; | 1716 | forkout = forkout_volatile; |
| 1723 | wait_child_setup[0] = wait_child_setup_0_volatile; | 1717 | wait_child_setup[0] = wait_child_setup_0_volatile; |
| 1724 | wait_child_setup[1] = wait_child_setup_1_volatile; | 1718 | wait_child_setup[1] = wait_child_setup_1_volatile; |
| 1719 | |||
| 1720 | pty_flag = XPROCESS (process)->pty_flag; | ||
| 1725 | } | 1721 | } |
| 1726 | 1722 | ||
| 1727 | if (pid == 0) | 1723 | if (pid == 0) |
| @@ -1791,15 +1787,15 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) | |||
| 1791 | if (pty_flag) | 1787 | if (pty_flag) |
| 1792 | { | 1788 | { |
| 1793 | 1789 | ||
| 1794 | /* I wonder if emacs_close (emacs_open (pty_name, ...)) | 1790 | /* I wonder if emacs_close (emacs_open (SSDATA (lisp_pty_name), ...)) |
| 1795 | would work? */ | 1791 | would work? */ |
| 1796 | if (xforkin >= 0) | 1792 | if (xforkin >= 0) |
| 1797 | emacs_close (xforkin); | 1793 | emacs_close (xforkin); |
| 1798 | xforkout = xforkin = emacs_open (pty_name, O_RDWR, 0); | 1794 | xforkout = xforkin = emacs_open (SSDATA (lisp_pty_name), O_RDWR, 0); |
| 1799 | 1795 | ||
| 1800 | if (xforkin < 0) | 1796 | if (xforkin < 0) |
| 1801 | { | 1797 | { |
| 1802 | emacs_perror (pty_name); | 1798 | emacs_perror (SSDATA (lisp_pty_name)); |
| 1803 | _exit (EXIT_CANCELED); | 1799 | _exit (EXIT_CANCELED); |
| 1804 | } | 1800 | } |
| 1805 | 1801 | ||
| @@ -1845,14 +1841,13 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) | |||
| 1845 | unblock_child_signal (); | 1841 | unblock_child_signal (); |
| 1846 | unblock_input (); | 1842 | unblock_input (); |
| 1847 | 1843 | ||
| 1844 | if (forkin >= 0) | ||
| 1845 | emacs_close (forkin); | ||
| 1846 | if (forkin != forkout && forkout >= 0) | ||
| 1847 | emacs_close (forkout); | ||
| 1848 | |||
| 1848 | if (pid < 0) | 1849 | if (pid < 0) |
| 1849 | { | 1850 | report_file_errno ("Doing vfork", Qnil, vfork_errno); |
| 1850 | if (forkin >= 0) | ||
| 1851 | emacs_close (forkin); | ||
| 1852 | if (forkin != forkout && forkout >= 0) | ||
| 1853 | emacs_close (forkout); | ||
| 1854 | report_file_errno ("Doing vfork", Qnil, vfork_errno); | ||
| 1855 | } | ||
| 1856 | else | 1851 | else |
| 1857 | { | 1852 | { |
| 1858 | /* vfork succeeded. */ | 1853 | /* vfork succeeded. */ |
| @@ -1861,26 +1856,6 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) | |||
| 1861 | register_child (pid, inchannel); | 1856 | register_child (pid, inchannel); |
| 1862 | #endif /* WINDOWSNT */ | 1857 | #endif /* WINDOWSNT */ |
| 1863 | 1858 | ||
| 1864 | /* If the subfork execv fails, and it exits, | ||
| 1865 | this close hangs. I don't know why. | ||
| 1866 | So have an interrupt jar it loose. */ | ||
| 1867 | { | ||
| 1868 | struct atimer *timer; | ||
| 1869 | EMACS_TIME offset = make_emacs_time (1, 0); | ||
| 1870 | |||
| 1871 | stop_polling (); | ||
| 1872 | timer = start_atimer (ATIMER_RELATIVE, offset, create_process_1, 0); | ||
| 1873 | |||
| 1874 | if (forkin >= 0) | ||
| 1875 | emacs_close (forkin); | ||
| 1876 | |||
| 1877 | cancel_atimer (timer); | ||
| 1878 | start_polling (); | ||
| 1879 | } | ||
| 1880 | |||
| 1881 | if (forkin != forkout && forkout >= 0) | ||
| 1882 | emacs_close (forkout); | ||
| 1883 | |||
| 1884 | pset_tty_name (XPROCESS (process), lisp_pty_name); | 1859 | pset_tty_name (XPROCESS (process), lisp_pty_name); |
| 1885 | 1860 | ||
| 1886 | #ifndef WINDOWSNT | 1861 | #ifndef WINDOWSNT |
| @@ -1899,17 +1874,16 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) | |||
| 1899 | } | 1874 | } |
| 1900 | } | 1875 | } |
| 1901 | 1876 | ||
| 1902 | void | 1877 | static void |
| 1903 | create_pty (Lisp_Object process) | 1878 | create_pty (Lisp_Object process) |
| 1904 | { | 1879 | { |
| 1880 | char pty_name[PTY_NAME_SIZE]; | ||
| 1905 | int inchannel, outchannel; | 1881 | int inchannel, outchannel; |
| 1906 | bool pty_flag = 0; | ||
| 1907 | 1882 | ||
| 1908 | inchannel = outchannel = -1; | 1883 | inchannel = outchannel = -1; |
| 1909 | 1884 | ||
| 1910 | #ifdef HAVE_PTYS | ||
| 1911 | if (!NILP (Vprocess_connection_type)) | 1885 | if (!NILP (Vprocess_connection_type)) |
| 1912 | outchannel = inchannel = allocate_pty (); | 1886 | outchannel = inchannel = allocate_pty (pty_name); |
| 1913 | 1887 | ||
| 1914 | if (inchannel >= 0) | 1888 | if (inchannel >= 0) |
| 1915 | { | 1889 | { |
| @@ -1928,40 +1902,34 @@ create_pty (Lisp_Object process) | |||
| 1928 | child_setup_tty (forkout); | 1902 | child_setup_tty (forkout); |
| 1929 | #endif /* DONT_REOPEN_PTY */ | 1903 | #endif /* DONT_REOPEN_PTY */ |
| 1930 | #endif /* not USG, or USG_SUBTTY_WORKS */ | 1904 | #endif /* not USG, or USG_SUBTTY_WORKS */ |
| 1931 | pty_flag = 1; | ||
| 1932 | } | ||
| 1933 | #endif /* HAVE_PTYS */ | ||
| 1934 | 1905 | ||
| 1935 | fcntl (inchannel, F_SETFL, O_NONBLOCK); | 1906 | fcntl (inchannel, F_SETFL, O_NONBLOCK); |
| 1936 | fcntl (outchannel, F_SETFL, O_NONBLOCK); | 1907 | fcntl (outchannel, F_SETFL, O_NONBLOCK); |
| 1937 | 1908 | ||
| 1938 | /* Record this as an active process, with its channels. | 1909 | /* Record this as an active process, with its channels. |
| 1939 | As a result, child_setup will close Emacs's side of the pipes. */ | 1910 | As a result, child_setup will close Emacs's side of the pipes. */ |
| 1940 | chan_process[inchannel] = process; | 1911 | chan_process[inchannel] = process; |
| 1941 | XPROCESS (process)->infd = inchannel; | 1912 | XPROCESS (process)->infd = inchannel; |
| 1942 | XPROCESS (process)->outfd = outchannel; | 1913 | XPROCESS (process)->outfd = outchannel; |
| 1943 | 1914 | ||
| 1944 | /* Previously we recorded the tty descriptor used in the subprocess. | 1915 | /* Previously we recorded the tty descriptor used in the subprocess. |
| 1945 | It was only used for getting the foreground tty process, so now | 1916 | It was only used for getting the foreground tty process, so now |
| 1946 | we just reopen the device (see emacs_get_tty_pgrp) as this is | 1917 | we just reopen the device (see emacs_get_tty_pgrp) as this is |
| 1947 | more portable (see USG_SUBTTY_WORKS above). */ | 1918 | more portable (see USG_SUBTTY_WORKS above). */ |
| 1948 | 1919 | ||
| 1949 | XPROCESS (process)->pty_flag = pty_flag; | 1920 | XPROCESS (process)->pty_flag = 1; |
| 1950 | pset_status (XPROCESS (process), Qrun); | 1921 | pset_status (XPROCESS (process), Qrun); |
| 1951 | setup_process_coding_systems (process); | 1922 | setup_process_coding_systems (process); |
| 1952 | 1923 | ||
| 1953 | FD_SET (inchannel, &input_wait_mask); | 1924 | FD_SET (inchannel, &input_wait_mask); |
| 1954 | FD_SET (inchannel, &non_keyboard_wait_mask); | 1925 | FD_SET (inchannel, &non_keyboard_wait_mask); |
| 1955 | if (inchannel > max_process_desc) | 1926 | if (inchannel > max_process_desc) |
| 1956 | max_process_desc = inchannel; | 1927 | max_process_desc = inchannel; |
| 1928 | |||
| 1929 | pset_tty_name (XPROCESS (process), build_string (pty_name)); | ||
| 1930 | } | ||
| 1957 | 1931 | ||
| 1958 | XPROCESS (process)->pid = -2; | 1932 | XPROCESS (process)->pid = -2; |
| 1959 | #ifdef HAVE_PTYS | ||
| 1960 | if (pty_flag) | ||
| 1961 | pset_tty_name (XPROCESS (process), build_string (pty_name)); | ||
| 1962 | else | ||
| 1963 | #endif | ||
| 1964 | pset_tty_name (XPROCESS (process), Qnil); | ||
| 1965 | } | 1933 | } |
| 1966 | 1934 | ||
| 1967 | 1935 | ||
| @@ -2589,7 +2557,7 @@ usage: (make-serial-process &rest ARGS) */) | |||
| 2589 | p->kill_without_query = 1; | 2557 | p->kill_without_query = 1; |
| 2590 | if (tem = Fplist_get (contact, QCstop), !NILP (tem)) | 2558 | if (tem = Fplist_get (contact, QCstop), !NILP (tem)) |
| 2591 | pset_command (p, Qt); | 2559 | pset_command (p, Qt); |
| 2592 | p->pty_flag = 0; | 2560 | eassert (! p->pty_flag); |
| 2593 | 2561 | ||
| 2594 | if (!EQ (p->command, Qt)) | 2562 | if (!EQ (p->command, Qt)) |
| 2595 | { | 2563 | { |
| @@ -3869,13 +3837,14 @@ deactivate_process (Lisp_Object proc) | |||
| 3869 | #endif | 3837 | #endif |
| 3870 | if (inchannel == max_process_desc) | 3838 | if (inchannel == max_process_desc) |
| 3871 | { | 3839 | { |
| 3872 | int i; | ||
| 3873 | /* We just closed the highest-numbered process input descriptor, | 3840 | /* We just closed the highest-numbered process input descriptor, |
| 3874 | so recompute the highest-numbered one now. */ | 3841 | so recompute the highest-numbered one now. */ |
| 3875 | max_process_desc = 0; | 3842 | int i = inchannel; |
| 3876 | for (i = 0; i < MAXDESC; i++) | 3843 | do |
| 3877 | if (!NILP (chan_process[i])) | 3844 | i--; |
| 3878 | max_process_desc = i; | 3845 | while (0 <= i && NILP (chan_process[i])); |
| 3846 | |||
| 3847 | max_process_desc = i; | ||
| 3879 | } | 3848 | } |
| 3880 | } | 3849 | } |
| 3881 | } | 3850 | } |
| @@ -4557,7 +4526,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, | |||
| 4557 | #endif | 4526 | #endif |
| 4558 | (max (max_process_desc, max_input_desc) + 1, | 4527 | (max (max_process_desc, max_input_desc) + 1, |
| 4559 | &Available, | 4528 | &Available, |
| 4560 | (check_write ? &Writeok : (SELECT_TYPE *)0), | 4529 | (check_write ? &Writeok : 0), |
| 4561 | NULL, &timeout, NULL); | 4530 | NULL, &timeout, NULL); |
| 4562 | 4531 | ||
| 4563 | #ifdef HAVE_GNUTLS | 4532 | #ifdef HAVE_GNUTLS |
| @@ -6801,16 +6770,9 @@ void | |||
| 6801 | delete_keyboard_wait_descriptor (int desc) | 6770 | delete_keyboard_wait_descriptor (int desc) |
| 6802 | { | 6771 | { |
| 6803 | #ifdef subprocesses | 6772 | #ifdef subprocesses |
| 6804 | int fd; | ||
| 6805 | int lim = max_input_desc; | ||
| 6806 | |||
| 6807 | FD_CLR (desc, &input_wait_mask); | 6773 | FD_CLR (desc, &input_wait_mask); |
| 6808 | FD_CLR (desc, &non_process_wait_mask); | 6774 | FD_CLR (desc, &non_process_wait_mask); |
| 6809 | 6775 | delete_input_desc (desc); | |
| 6810 | if (desc == max_input_desc) | ||
| 6811 | for (fd = 0; fd < lim; fd++) | ||
| 6812 | if (FD_ISSET (fd, &input_wait_mask) || FD_ISSET (fd, &write_mask)) | ||
| 6813 | max_input_desc = fd; | ||
| 6814 | #endif | 6776 | #endif |
| 6815 | } | 6777 | } |
| 6816 | 6778 | ||
| @@ -7075,7 +7037,7 @@ init_process_emacs (void) | |||
| 7075 | FD_ZERO (&non_keyboard_wait_mask); | 7037 | FD_ZERO (&non_keyboard_wait_mask); |
| 7076 | FD_ZERO (&non_process_wait_mask); | 7038 | FD_ZERO (&non_process_wait_mask); |
| 7077 | FD_ZERO (&write_mask); | 7039 | FD_ZERO (&write_mask); |
| 7078 | max_process_desc = 0; | 7040 | max_process_desc = max_input_desc = -1; |
| 7079 | memset (fd_callback_info, 0, sizeof (fd_callback_info)); | 7041 | memset (fd_callback_info, 0, sizeof (fd_callback_info)); |
| 7080 | 7042 | ||
| 7081 | #ifdef NON_BLOCKING_CONNECT | 7043 | #ifdef NON_BLOCKING_CONNECT |