Re: Support for the TIOCINQ ioctl

2010-08-31 Thread Brennan Peter Sellner

On Sat, 28 Aug 2010, Andy Koppe wrote:

On 27 August 2010 23:31, Brennan Peter Sellner wrote:

By any chance, has support for the TIOCINQ ioctl on file descriptors (used
to check how many bytes of data are in the input buffer) been added to
Cygwin?  It hadn't as of 2004:

 http://sourceware.org/ml/cygwin/2004-07/msg00910.html


It's still implemented only for serial devices.


As I suspected.  Thanks for the confirmation.


...but I haven't found any newer references to it.  I'm inferring that it's
not supported, as ioctl(fd, TIOCINQ, &available) (where fd is a valid file
descriptor, and available is a long) fails, with errno set to 'invalid
argument'.  I'm running Cygwin 1.7.6 on Vista.

I'm hoping I'm missing something...  Is there an alternative way to check
the number of bytes on an fd's input buffer in Cygwin?


What's your use case? And on what sort of fd?

select() of course can tell you whether there are any bytes available
to be read from an fd, and usually that's all one needs to know.


I'm porting a fair chunk of legacy code that spawns processes in the 
background, provides an emulated tty, and monitors the output, allowing 
remote clients to interact with the backgrounded processes as if they were 
running in a local terminal.


select can indeed do the trick: there were ioctl calls sprinkled liberally 
throughout the code, and I was attempting to avoid extensive refactoring. 
:-)  Now that I've refactored things properly using select, things are 
once again working smoothly.


Thanks again,

-Brennan

--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple

Support for the TIOCINQ ioctl

2010-08-27 Thread Brennan Peter Sellner
By any chance, has support for the TIOCINQ ioctl on file descriptors 
(used to check how many bytes of data are in the input buffer) been 
added to Cygwin?  It hadn't as of 2004:


  http://sourceware.org/ml/cygwin/2004-07/msg00910.html

...but I haven't found any newer references to it.  I'm inferring that 
it's not supported, as ioctl(fd, TIOCINQ, &available) (where fd is a valid 
file descriptor, and available is a long) fails, with errno set to 
'invalid argument'.  I'm running Cygwin 1.7.6 on Vista.


I'm hoping I'm missing something...  Is there an alternative way to check 
the number of bytes on an fd's input buffer in Cygwin?


Thanks,

-Brennan


--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple