Re: [PATCH] fhandler_tty deadlock patch + console + eof
Steve, On Wed, 23 Oct 2002, Steve O wrote: On Tue, Oct 22, 2002 at 02:06:17PM -0400, Igor Pechtchanski wrote: One more thing I noticed when using this patch is that pasting now seems really slow, as if it's sending one character at a time... Did you turn off the buffering somewhere by any chance? Not that I know of. In large pastes, say larger than 2k, the buffers fill up and the app stops being able to write the paste buffer in large chunks. This could contribute to a character-at-a-time feel. Yeah, that is probably it. The pastes that exhibit this behavior are the ones that used to freeze xterms, so the size is quite large. I just verified that small pastes are fine. While trying to reproduce this I noticed that pasting a selection with tab characters into bash causes delays due to bash trying to do command completion. Also note that bash bypasses termios processing and so a paste into bash will result in a series of 1 character writes to the pipe. The pipe seems to have a 4k buffer, but depending on the timing bash may get to read each character out individually. Nah, not in my case - I'm pasting into vi... But good to know about bash, thanks. Though, I could of broke something. If you want to persue this, you're welcome to send me a test case off-list, and I'll see if anything unusual is happening. I think the above quite adequately explained this. If you think it's potentially fixable, let me know if you still want a test case. And thanks again for the patch. Igor -- http://cs.nyu.edu/~pechtcha/ |\ _,,,---,,_[EMAIL PROTECTED] ZZZzz /,`.-'`'-. ;-;;,_[EMAIL PROTECTED] |,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski '---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow! Water molecules expand as they grow warmer (C) Popular Science, Oct'02, p.51
[PATCH] fhandler_tty deadlock patch + console + eof
Hi, I noticed that my last patch caused EOF to be ignored in non-console situations, like rxvt -e sh. I've attached an updated patch that should solve this. On Tue, Oct 22, 2002 at 02:06:17PM -0400, Igor Pechtchanski wrote: One more thing I noticed when using this patch is that pasting now seems really slow, as if it's sending one character at a time... Did you turn off the buffering somewhere by any chance? Not that I know of. In large pastes, say larger than 2k, the buffers fill up and the app stops being able to write the paste buffer in large chunks. This could contribute to a character-at-a-time feel. While trying to reproduce this I noticed that pasting a selection with tab characters into bash causes delays due to bash trying to do command completion. Also note that bash bypasses termios processing and so a paste into bash will result in a series of 1 character writes to the pipe. The pipe seems to have a 4k buffer, but depending on the timing bash may get to read each character out individually. Though, I could of broke something. If you want to persue this, you're welcome to send me a test case off-list, and I'll see if anything unusual is happening. Thanks, -steve 2002-10-22 Steve Osborn [EMAIL PROTECTED] * fhandler.cc (fhandler_base::put_readahead): Limited size of buffer to reduce amount of garbage from cat'ing a binary file. * fhandler.h (fhandler_termios::doecho): Returns int, added force. (fhandler_termios::accept_input): Changed sense of return. (fhandler_termios::line_edit_cnt): Added. (fhandler_console::doecho): Returns int, added force. (fhandler_pty_master::doecho): Returns int, added force. (fhandler_pty_master::get_echobuf_valid): Added. (fhandler_pty_master::get_echobuf_into_buffer): Added. (fhandler_pty_master::clear_echobuf): Added. (fhandler_pty_master::ebbuf): Added pointer to echobuf. (fhandler_pty_master::ebixget): Added echobuf get index. (fhandler_pty_master::ebixput): Added echobuf put index. (fhandler_pty_master::ebbuflen): Added echobuf length. (fhandler_pty_master::ebguard): Added handle for guard mutex. * fhandler_termios.cc (fhandler_termios::line_edit): Wraps line_edit_cnt to provide previous signature. (fhandler_termios::line_edit_cnt): Added line_edit function with the ability to report number of bytes written. Handles cases where the echo or readahead buffer is full. (fhandler_termios::line_edit_cnt): Returns true if the last character resulted in an input_done - necessary for console. (fhandler_termios::line_edit_cnt): Added accept_input in EOF case. * fhandler_tty.cc (fhandler_pty_master::get_echobuf_valid): Added. (fhandler_pty_master::doecho): Rewritten to return bytes written to echobuf. Added force option to expand the buffer as necessary. (fhandler_pty_master::get_echobuf_into_buffer): Added. (fhandler_pty_master::clear_echobuf): Added. (fhandler_pty_master::accept_input): Sense of return changed to number of bytes not written. Added support for partial write. (fhandler_pty_master::process_slave_output): Prime read with echobuf. (fhandler_pty_master::fhandler_pty_master): Initializers for echobuf. (fhandler_pty_master::open): Calls clear_echobuf. (fhandler_pty_master::close): Calls clear_echobuf. (fhandler_pty_master::write): Returns number of bytes written. * select.cc (peek_pipe): Check for echobuf valid. Index: cygwin/fhandler.cc === RCS file: /cvs/src/src/winsup/cygwin/fhandler.cc,v retrieving revision 1.138 diff -u -p -r1.138 fhandler.cc --- cygwin/fhandler.cc 23 Sep 2002 00:31:30 - 1.138 +++ cygwin/fhandler.cc 22 Oct 2002 06:15:46 - @@ -58,13 +58,15 @@ fhandler_base::puts_readahead (const cha return success; } +#define READAHEAD_BUFFER_MAXSIZE 4096 int fhandler_base::put_readahead (char value) { char *newrabuf; if (raixput rabuflen) /* Nothing to do */; - else if ((newrabuf = (char *) realloc (rabuf, rabuflen += 32))) + else if (rabuflen READAHEAD_BUFFER_MAXSIZE + (newrabuf = (char *) realloc (rabuf, rabuflen += 32))) rabuf = newrabuf; else return 0; Index: cygwin/fhandler.h === RCS file: /cvs/src/src/winsup/cygwin/fhandler.h,v retrieving revision 1.143 diff -u -p -r1.143 fhandler.h --- cygwin/fhandler.h 9 Oct 2002 05:55:40 - 1.143 +++ cygwin/fhandler.h 22 Oct 2002 06:15:49 - @@ -682,8 +682,8 @@ class fhandler_termios: public fhandler_ { protected: HANDLE output_handle; - virtual void doecho (const void *, DWORD) {}; - virtual int accept_input () {return 1;}; + virtual int doecho (const void *, DWORD, int force = 1)