diff options
Diffstat (limited to 'src/process.c')
| -rw-r--r-- | src/process.c | 37 |
1 files changed, 13 insertions, 24 deletions
diff --git a/src/process.c b/src/process.c index 92bea0d3a27..307e82819d6 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -125,6 +125,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 125 | #include "xgselect.h" | 125 | #include "xgselect.h" |
| 126 | #endif | 126 | #endif |
| 127 | 127 | ||
| 128 | #ifdef WINDOWSNT | ||
| 129 | extern int sys_select (int, SELECT_TYPE *, SELECT_TYPE *, SELECT_TYPE *, | ||
| 130 | EMACS_TIME *, void *); | ||
| 131 | #endif | ||
| 132 | |||
| 128 | #ifndef WNOHANG | 133 | #ifndef WNOHANG |
| 129 | # undef waitpid | 134 | # undef waitpid |
| 130 | # define waitpid(pid, status, options) wait (status) | 135 | # define waitpid(pid, status, options) wait (status) |
| @@ -646,23 +651,6 @@ allocate_pty (void) | |||
| 646 | PTY_OPEN; | 651 | PTY_OPEN; |
| 647 | #else /* no PTY_OPEN */ | 652 | #else /* no PTY_OPEN */ |
| 648 | { | 653 | { |
| 649 | { /* Some systems name their pseudoterminals so that there are gaps in | ||
| 650 | the usual sequence - for example, on HP9000/S700 systems, there | ||
| 651 | are no pseudoterminals with names ending in 'f'. So we wait for | ||
| 652 | three failures in a row before deciding that we've reached the | ||
| 653 | end of the ptys. */ | ||
| 654 | int failed_count = 0; | ||
| 655 | struct stat stb; | ||
| 656 | |||
| 657 | if (stat (pty_name, &stb) < 0) | ||
| 658 | { | ||
| 659 | failed_count++; | ||
| 660 | if (failed_count >= 3) | ||
| 661 | return -1; | ||
| 662 | } | ||
| 663 | else | ||
| 664 | failed_count = 0; | ||
| 665 | } | ||
| 666 | # ifdef O_NONBLOCK | 654 | # ifdef O_NONBLOCK |
| 667 | fd = emacs_open (pty_name, O_RDWR | O_NONBLOCK, 0); | 655 | fd = emacs_open (pty_name, O_RDWR | O_NONBLOCK, 0); |
| 668 | # else | 656 | # else |
| @@ -4302,7 +4290,7 @@ wait_reading_process_output_1 (void) | |||
| 4302 | -1 meaning caller will actually read the input, so don't throw to | 4290 | -1 meaning caller will actually read the input, so don't throw to |
| 4303 | the quit handler, or | 4291 | the quit handler, or |
| 4304 | 4292 | ||
| 4305 | DO_DISPLAY != 0 means redisplay should be done to show subprocess | 4293 | DO_DISPLAY means redisplay should be done to show subprocess |
| 4306 | output that arrives. | 4294 | output that arrives. |
| 4307 | 4295 | ||
| 4308 | If WAIT_FOR_CELL is a cons cell, wait until its car is non-nil | 4296 | If WAIT_FOR_CELL is a cons cell, wait until its car is non-nil |
| @@ -4322,7 +4310,7 @@ wait_reading_process_output_1 (void) | |||
| 4322 | 4310 | ||
| 4323 | int | 4311 | int |
| 4324 | wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, | 4312 | wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, |
| 4325 | int do_display, | 4313 | bool do_display, |
| 4326 | Lisp_Object wait_for_cell, | 4314 | Lisp_Object wait_for_cell, |
| 4327 | struct Lisp_Process *wait_proc, int just_wait_proc) | 4315 | struct Lisp_Process *wait_proc, int just_wait_proc) |
| 4328 | { | 4316 | { |
| @@ -4419,7 +4407,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, | |||
| 4419 | 4407 | ||
| 4420 | do | 4408 | do |
| 4421 | { | 4409 | { |
| 4422 | int old_timers_run = timers_run; | 4410 | unsigned old_timers_run = timers_run; |
| 4423 | struct buffer *old_buffer = current_buffer; | 4411 | struct buffer *old_buffer = current_buffer; |
| 4424 | Lisp_Object old_window = selected_window; | 4412 | Lisp_Object old_window = selected_window; |
| 4425 | 4413 | ||
| @@ -4646,6 +4634,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, | |||
| 4646 | process_output_skip = 0; | 4634 | process_output_skip = 0; |
| 4647 | } | 4635 | } |
| 4648 | #endif | 4636 | #endif |
| 4637 | |||
| 4649 | #if defined (USE_GTK) || defined (HAVE_GCONF) || defined (HAVE_GSETTINGS) | 4638 | #if defined (USE_GTK) || defined (HAVE_GCONF) || defined (HAVE_GSETTINGS) |
| 4650 | nfds = xg_select | 4639 | nfds = xg_select |
| 4651 | #elif defined (HAVE_NS) | 4640 | #elif defined (HAVE_NS) |
| @@ -4752,7 +4741,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, | |||
| 4752 | 4741 | ||
| 4753 | if (read_kbd != 0) | 4742 | if (read_kbd != 0) |
| 4754 | { | 4743 | { |
| 4755 | int old_timers_run = timers_run; | 4744 | unsigned old_timers_run = timers_run; |
| 4756 | struct buffer *old_buffer = current_buffer; | 4745 | struct buffer *old_buffer = current_buffer; |
| 4757 | Lisp_Object old_window = selected_window; | 4746 | Lisp_Object old_window = selected_window; |
| 4758 | int leave = 0; | 4747 | int leave = 0; |
| @@ -6820,14 +6809,14 @@ extern int sys_select (int, SELECT_TYPE *, SELECT_TYPE *, SELECT_TYPE *, | |||
| 6820 | see full version for other parameters. We know that wait_proc will | 6809 | see full version for other parameters. We know that wait_proc will |
| 6821 | always be NULL, since `subprocesses' isn't defined. | 6810 | always be NULL, since `subprocesses' isn't defined. |
| 6822 | 6811 | ||
| 6823 | DO_DISPLAY != 0 means redisplay should be done to show subprocess | 6812 | DO_DISPLAY means redisplay should be done to show subprocess |
| 6824 | output that arrives. | 6813 | output that arrives. |
| 6825 | 6814 | ||
| 6826 | Return true if we received input from any process. */ | 6815 | Return true if we received input from any process. */ |
| 6827 | 6816 | ||
| 6828 | int | 6817 | int |
| 6829 | wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, | 6818 | wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, |
| 6830 | int do_display, | 6819 | bool do_display, |
| 6831 | Lisp_Object wait_for_cell, | 6820 | Lisp_Object wait_for_cell, |
| 6832 | struct Lisp_Process *wait_proc, int just_wait_proc) | 6821 | struct Lisp_Process *wait_proc, int just_wait_proc) |
| 6833 | { | 6822 | { |
| @@ -6903,7 +6892,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, | |||
| 6903 | 6892 | ||
| 6904 | do | 6893 | do |
| 6905 | { | 6894 | { |
| 6906 | int old_timers_run = timers_run; | 6895 | unsigned old_timers_run = timers_run; |
| 6907 | timer_delay = timer_check (); | 6896 | timer_delay = timer_check (); |
| 6908 | if (timers_run != old_timers_run && do_display) | 6897 | if (timers_run != old_timers_run && do_display) |
| 6909 | /* We must retry, since a timer may have requeued itself | 6898 | /* We must retry, since a timer may have requeued itself |