comparison src/process.c @ 56583:64ae47cb68ff

(read_process_output): Use whole read buffer. Don't trigger adaptive read buffering on errors.
author Kim F. Storm <storm@cua.dk>
date Sun, 01 Aug 2004 23:10:06 +0000
parents 59a86f6ee1fb
children 62660593b0a2 09f3fd9f680d 0bdb5a16ae51
comparison
equal deleted inserted replaced
56582:591c2d29ca4b 56583:64ae47cb68ff
4193 #if 0 4193 #if 0
4194 /* On Mac OS X 10.0, the SELECT system call always says input is 4194 /* On Mac OS X 10.0, the SELECT system call always says input is
4195 present (for reading) at stdin, even when none is. This 4195 present (for reading) at stdin, even when none is. This
4196 causes the call to SELECT below to return 1 and 4196 causes the call to SELECT below to return 1 and
4197 status_notify not to be called. As a result output of 4197 status_notify not to be called. As a result output of
4198 subprocesses are incorrectly discarded. 4198 subprocesses are incorrectly discarded.
4199 */ 4199 */
4200 FD_CLR (0, &Atemp); 4200 FD_CLR (0, &Atemp);
4201 #endif 4201 #endif
4202 Ctemp = connect_wait_mask; 4202 Ctemp = connect_wait_mask;
4203 EMACS_SET_SECS_USECS (timeout, 0, 0); 4203 EMACS_SET_SECS_USECS (timeout, 0, 0);
4760 #ifdef DATAGRAM_SOCKETS 4760 #ifdef DATAGRAM_SOCKETS
4761 /* We have a working select, so proc_buffered_char is always -1. */ 4761 /* We have a working select, so proc_buffered_char is always -1. */
4762 if (DATAGRAM_CHAN_P (channel)) 4762 if (DATAGRAM_CHAN_P (channel))
4763 { 4763 {
4764 int len = datagram_address[channel].len; 4764 int len = datagram_address[channel].len;
4765 nbytes = recvfrom (channel, chars + carryover, readmax - carryover, 4765 nbytes = recvfrom (channel, chars + carryover, readmax,
4766 0, datagram_address[channel].sa, &len); 4766 0, datagram_address[channel].sa, &len);
4767 } 4767 }
4768 else 4768 else
4769 #endif 4769 #endif
4770 if (proc_buffered_char[channel] < 0) 4770 if (proc_buffered_char[channel] < 0)
4771 { 4771 {
4772 nbytes = emacs_read (channel, chars + carryover, readmax - carryover); 4772 nbytes = emacs_read (channel, chars + carryover, readmax);
4773 #ifdef ADAPTIVE_READ_BUFFERING 4773 #ifdef ADAPTIVE_READ_BUFFERING
4774 if (!NILP (p->adaptive_read_buffering)) 4774 if (nbytes > 0 && !NILP (p->adaptive_read_buffering))
4775 { 4775 {
4776 int delay = XINT (p->read_output_delay); 4776 int delay = XINT (p->read_output_delay);
4777 if (nbytes < 256) 4777 if (nbytes < 256)
4778 { 4778 {
4779 if (delay < READ_OUTPUT_DELAY_MAX_MAX) 4779 if (delay < READ_OUTPUT_DELAY_MAX_MAX)
4781 if (delay == 0) 4781 if (delay == 0)
4782 process_output_delay_count++; 4782 process_output_delay_count++;
4783 delay += READ_OUTPUT_DELAY_INCREMENT * 2; 4783 delay += READ_OUTPUT_DELAY_INCREMENT * 2;
4784 } 4784 }
4785 } 4785 }
4786 else if (delay > 0 && (nbytes == readmax - carryover)) 4786 else if (delay > 0 && (nbytes == readmax))
4787 { 4787 {
4788 delay -= READ_OUTPUT_DELAY_INCREMENT; 4788 delay -= READ_OUTPUT_DELAY_INCREMENT;
4789 if (delay == 0) 4789 if (delay == 0)
4790 process_output_delay_count--; 4790 process_output_delay_count--;
4791 } 4791 }
4800 } 4800 }
4801 else 4801 else
4802 { 4802 {
4803 chars[carryover] = proc_buffered_char[channel]; 4803 chars[carryover] = proc_buffered_char[channel];
4804 proc_buffered_char[channel] = -1; 4804 proc_buffered_char[channel] = -1;
4805 nbytes = emacs_read (channel, chars + carryover + 1, readmax - 1 - carryover); 4805 nbytes = emacs_read (channel, chars + carryover + 1, readmax - 1);
4806 if (nbytes < 0) 4806 if (nbytes < 0)
4807 nbytes = 1; 4807 nbytes = 1;
4808 else 4808 else
4809 nbytes = nbytes + 1; 4809 nbytes = nbytes + 1;
4810 } 4810 }