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]

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


Hello,

I think I might have found a bug with the latest version of cygwin 
(downloaded one night ago 18Nov2004). I am writing a small terminal 
emulation software package to interface with an embedded device to perform 
logging.

I use the console (/dev/stdin, /dev/stdout) and a serial port (/dev/com1). 
The console is configured to be non-canonical so that I can determine 
immediately when the user has pressed a key. Signals are also disabled by 
the console. If it's useful, I can post the code here later.

So the problem is: I use select() to determine when I can write to the 
console, when to read from the console (for keypresses), when to write to 
the serial port and when to read from the serial port. Select() returns 
indicated that data is to read on /dev/stdin (which is correct, I indeed 
did press a key), but the read() function for this fails with -1 and 
errno=EWOULDBLOCK. If I enable the non-blocking behaviour of the console 
then the system really does block.

The problem only appears to occur when there is a reasonable rate of 
dataoutput to the console. I'm receiving data at 115kpbs from the serial 
port and dumping it to the console with a little more information (e.g. a 
timestamp for every line).

I've tested the software on Windows NT4 and Windows XP SP1 and they both 
exhibit the same behaviour, the faster computer not being so susceptible 
as the slower (Pentium IV 1.6GHz for the faster).

The same code compiles on Linux FC3 and it runs correctly.

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.

Thanks,
Jason


--
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]