Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com To: cygwin AT cygwin DOT com From: Jason Curl Subject: Re: select() read() and write() on /dev/console Date: Mon, 22 Nov 2004 14:53:20 +0000 (UTC) Lines: 50 Message-ID: References: <20041119183842 DOT GB26102 AT trixie DOT casa DOT cgf DOT cx> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: usenet AT sea DOT gmane DOT org X-Gmane-NNTP-Posting-Host: main.gmane.org User-Agent: Loom/3.14 (http://gmane.org/) X-Loom-IP: 62.180.53.220 (Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0) X-IsSubscribed: yes Christopher Faylor cygwin.com> writes: > > On Fri, Nov 19, 2004 at 06:46:56PM +0100, Jason Curl wrote: > >My question, how do I go about investigating what the root cause is? Has > >anybody else seen similar issues and been able to work around it? I'm > >stuck and I've never seen the source code to cygwin before. > > If you suspect a problem with the cygwin DLL then you can build a > debugging version of the cygwin DLL and debug it using gdb. > > Most of the console handling is in fhandler_console.cc. The select > handling is in select.cc. Look for the string "console" there. > > Instructions for building the DLL are in the FAQ: > > http://cygwin.com/faq/faq_3.html#SEC101 > > Hello, In the function select.cc (v1.102.2.2): peek_console() there is a reference to the function fh->get_readahead_valid(). I don't see how 'fh' is assigned. What I've figured out so far is select_stuff::test_and_set builds up the linked list 'start.next'. fhandler_console::select_read initialises one of those entries in that linked list. But neither of these functions set s->fh to anything (so it defaults to NULL). Other two entries are writing to the console and reading from the serial port. btw, I don't know why is there in select_stuff::test_and_set the line if (s->window_handle || s->window_handle || s->window_handle) Then I look at fhandler.h and find get_readahead_valid() and from here I don't know what's going on. Could the comment at line 85 of fhandler.cc (inside fhandler_base::get_readahead) have anything to do with the problem I am having? So far I don't think so because the bit is being set by the return value of peek_console. It appears at least looking at the strace logs for the function peek_console() fh->get_readahead_valid() is returning 0. me->read_ready == 0 as expected also. The final result is that peek_console is returning a non-zero value. I'm going to start looking into the 'read' code now and see if I can figure out what the leadup to a value of -1 errno=11 could be. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/