aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Monnier2010-04-12 22:07:48 -0400
committerStefan Monnier2010-04-12 22:07:48 -0400
commit2b0a91e78f83fb446cc38efb99399e83ad2cded3 (patch)
tree7f387f7fe5cba2a8889e8a4de9ec22686ff29c22 /src
parent58b963f7f3d9d8e869408666608c05f3c69a5cb5 (diff)
downloademacs-2b0a91e78f83fb446cc38efb99399e83ad2cded3.tar.gz
emacs-2b0a91e78f83fb446cc38efb99399e83ad2cded3.zip
Try to solve the problem of spurious EOF chars in long lines of text
sent to interactive subprocesses. * sysdep.c (child_setup_tty): Do not enable ICANON any more. (system_process_attributes): Remove unused var `ttotal'. * process.c (send_process): Don't bother breaking long line with EOF chars when talking to ttys any more. (wait_reading_process_output): Output a warning when called in such a way that it could block without being interruptible.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog9
-rw-r--r--src/process.c37
-rw-r--r--src/sysdep.c17
3 files changed, 26 insertions, 37 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index ad88dc8311b..f9567b1308e 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,14 @@
12010-04-13 Stefan Monnier <monnier@iro.umontreal.ca> 12010-04-13 Stefan Monnier <monnier@iro.umontreal.ca>
2 2
3 Try to solve the problem of spurious EOF chars in long lines of text
4 sent to interactive subprocesses.
5 * sysdep.c (child_setup_tty): Do not enable ICANON any more.
6 (system_process_attributes): Remove unused var `ttotal'.
7 * process.c (send_process): Don't bother breaking long line with EOF
8 chars when talking to ttys any more.
9 (wait_reading_process_output): Output a warning when called in such
10 a way that it could block without being interruptible.
11
3 Try to detect file modification within the same second. 12 Try to detect file modification within the same second.
4 * buffer.h (struct buffer): New field modtime_size. 13 * buffer.h (struct buffer): New field modtime_size.
5 * buffer.c (reset_buffer): Initialize it. 14 * buffer.c (reset_buffer): Initialize it.
diff --git a/src/process.c b/src/process.c
index 34aa2c4fcff..7e8f4cc57bc 100644
--- a/src/process.c
+++ b/src/process.c
@@ -4643,6 +4643,10 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
4643 FD_ZERO (&Connecting); 4643 FD_ZERO (&Connecting);
4644#endif 4644#endif
4645 4645
4646 if (time_limit == 0 && wait_proc && !NILP (Vinhibit_quit)
4647 && !(CONSP (wait_proc->status) && EQ (XCAR (wait_proc->status), Qexit)))
4648 message ("Blocking call to accept-process-output with quit inhibited!!");
4649
4646 /* If wait_proc is a process to watch, set wait_channel accordingly. */ 4650 /* If wait_proc is a process to watch, set wait_channel accordingly. */
4647 if (wait_proc != NULL) 4651 if (wait_proc != NULL)
4648 wait_channel = wait_proc->infd; 4652 wait_channel = wait_proc->infd;
@@ -5768,34 +5772,6 @@ send_process (proc, buf, len, object)
5768 { 5772 {
5769 int this = len; 5773 int this = len;
5770 5774
5771 /* Decide how much data we can send in one batch.
5772 Long lines need to be split into multiple batches. */
5773 if (p->pty_flag)
5774 {
5775 /* Starting this at zero is always correct when not the first
5776 iteration because the previous iteration ended by sending C-d.
5777 It may not be correct for the first iteration
5778 if a partial line was sent in a separate send_process call.
5779 If that proves worth handling, we need to save linepos
5780 in the process object. */
5781 int linepos = 0;
5782 unsigned char *ptr = (unsigned char *) buf;
5783 unsigned char *end = (unsigned char *) buf + len;
5784
5785 /* Scan through this text for a line that is too long. */
5786 while (ptr != end && linepos < pty_max_bytes)
5787 {
5788 if (*ptr == '\n')
5789 linepos = 0;
5790 else
5791 linepos++;
5792 ptr++;
5793 }
5794 /* If we found one, break the line there
5795 and put in a C-d to force the buffer through. */
5796 this = ptr - buf;
5797 }
5798
5799 /* Send this batch, using one or more write calls. */ 5775 /* Send this batch, using one or more write calls. */
5800 while (this > 0) 5776 while (this > 0)
5801 { 5777 {
@@ -5899,11 +5875,6 @@ send_process (proc, buf, len, object)
5899 len -= rv; 5875 len -= rv;
5900 this -= rv; 5876 this -= rv;
5901 } 5877 }
5902
5903 /* If we sent just part of the string, put in an EOF (C-d)
5904 to force it through, before we send the rest. */
5905 if (len > 0)
5906 Fprocess_send_eof (proc);
5907 } 5878 }
5908 } 5879 }
5909 else 5880 else
diff --git a/src/sysdep.c b/src/sysdep.c
index 37e7dfbaf9c..506af23ef30 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -529,8 +529,6 @@ child_setup_tty (out)
529#endif 529#endif
530 s.main.c_oflag &= ~TAB3; /* Disable tab expansion */ 530 s.main.c_oflag &= ~TAB3; /* Disable tab expansion */
531 s.main.c_cflag = (s.main.c_cflag & ~CSIZE) | CS8; /* Don't strip 8th bit */ 531 s.main.c_cflag = (s.main.c_cflag & ~CSIZE) | CS8; /* Don't strip 8th bit */
532 s.main.c_lflag |= ICANON; /* Enable erase/kill and eof processing */
533 s.main.c_cc[VEOF] = 04; /* insure that EOF is Control-D */
534 s.main.c_cc[VERASE] = CDISABLE; /* disable erase processing */ 532 s.main.c_cc[VERASE] = CDISABLE; /* disable erase processing */
535 s.main.c_cc[VKILL] = CDISABLE; /* disable kill processing */ 533 s.main.c_cc[VKILL] = CDISABLE; /* disable kill processing */
536 534
@@ -560,7 +558,6 @@ child_setup_tty (out)
560 /* rms: Formerly it set s.main.c_cc[VINTR] to 0377 here 558 /* rms: Formerly it set s.main.c_cc[VINTR] to 0377 here
561 unconditionally. Then a SIGNALS_VIA_CHARACTERS conditional 559 unconditionally. Then a SIGNALS_VIA_CHARACTERS conditional
562 would force it to 0377. That looks like duplicated code. */ 560 would force it to 0377. That looks like duplicated code. */
563 s.main.c_cc[VEOL] = CDISABLE;
564 s.main.c_cflag = (s.main.c_cflag & ~CBAUD) | B9600; /* baud rate sanity */ 561 s.main.c_cflag = (s.main.c_cflag & ~CBAUD) | B9600; /* baud rate sanity */
565#endif /* AIX */ 562#endif /* AIX */
566 563
@@ -573,6 +570,18 @@ child_setup_tty (out)
573 s.main.sg_kill = 0377; 570 s.main.sg_kill = 0377;
574 s.lmode = LLITOUT | s.lmode; /* Don't strip 8th bit */ 571 s.lmode = LLITOUT | s.lmode; /* Don't strip 8th bit */
575 572
573 /* We used to enable ICANON (and set VEOF to 04), but this leads to
574 problems where process.c wants to send EOFs every once in a while
575 to force the output, which leads to weird effects when the
576 subprocess has disabled ICANON and ends up seeing those spurious
577 extra EOFs. So we don't send EOFs any more in
578 process.c:send_process, and instead we disable ICANON by default,
579 so if a subsprocess sets up ICANON, it's his problem (or the Elisp
580 package that talks to it) to deal with lines that are too long. */
581 s.main.c_lflag &= ~ICANON; /* Disable line editing and eof processing */
582 s.main.c_cc[VMIN] = 1;
583 s.main.c_cc[VTIME] = 0;
584
576#endif /* not HAVE_TERMIO */ 585#endif /* not HAVE_TERMIO */
577 586
578 EMACS_SET_TTY (out, &s, 0); 587 EMACS_SET_TTY (out, &s, 0);
@@ -3344,7 +3353,7 @@ system_process_attributes (Lisp_Object pid)
3344 unsigned long minflt, majflt, cminflt, cmajflt, vsize; 3353 unsigned long minflt, majflt, cminflt, cmajflt, vsize;
3345 time_t sec; 3354 time_t sec;
3346 unsigned usec; 3355 unsigned usec;
3347 EMACS_TIME tnow, tstart, tboot, telapsed,ttotal; 3356 EMACS_TIME tnow, tstart, tboot, telapsed;
3348 double pcpu, pmem; 3357 double pcpu, pmem;
3349 Lisp_Object attrs = Qnil; 3358 Lisp_Object attrs = Qnil;
3350 Lisp_Object cmd_str, decoded_cmd, tem; 3359 Lisp_Object cmd_str, decoded_cmd, tem;