This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: select() read() and write() on /dev/console


Christopher Faylor <cgf-no-personal-reply-please <at> 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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]