Incorrect behavior in TIOCINQ ioctl

Corinna Vinschen corinna-cygwin@cygwin.com
Mon Mar 2 16:07:00 GMT 2020


On Feb 29 11:37, Åke Rehnman wrote:
> 
> On 2020-02-28 20:23, Corinna Vinschen wrote:
> 
> > - Is it a safe bet that ClearCommError returns valid values in
> >    st.cbInQue even if one of the error conditions occur?  Maybe the
> >    right thing to do is to return 0 in certain error cases...?
> 
> The win32 api  documentation does not mention anything about not returning
> proper device status as long as the function succeeds...
> 
> Anyhow in my pursuit for the truth I whipped up a small test program and
> strace:d it (with some extra debug printout in fhandler_serial::ioctl)
> 
>  127 2403456 [main] python2.7 1662 fhandler_serial::ioctl: 0 = ioctl(541B,
> 0xFFFFBCB0) ev=C st.cbInQue=7
>   216 3406481 [main] python2.7 1662 fhandler_serial::ioctl: 0 = ioctl(541B,
> 0xFFFFBCB0) ev=C st.cbInQue=E
>    90 4409676 [main] python2.7 1662 fhandler_serial::ioctl: 0 = ioctl(541B,
> 0xFFFFBCB0) ev=C st.cbInQue=15
>   141 5413027 [main] python2.7 1662 fhandler_serial::ioctl: 0 = ioctl(541B,
> 0xFFFFBCB0) ev=C st.cbInQue=1C
>   129 6416204 [main] python2.7 1662 fhandler_serial::ioctl: 0 = ioctl(541B,
> 0xFFFFBCB0) ev=C st.cbInQue=23
>   121 7419254 [main] python2.7 1662 fhandler_serial::ioctl: 0 = ioctl(541B,
> 0xFFFFBCB0) ev=C st.cbInQue=2A
>   203 8423829 [main] python2.7 1662 fhandler_serial::ioctl: 0 = ioctl(541B,
> 0xFFFFBCB0) ev=C st.cbInQue=31
>    89 9427183 [main] python2.7 1662 fhandler_serial::ioctl: 0 = ioctl(541B,
> 0xFFFFBCB0) ev=C st.cbInQue=38
>   131 10431271 [main] python2.7 1662 fhandler_serial::ioctl: 0 = ioctl(541B,
> 0xFFFFBCB0) ev=C st.cbInQue=3F
>   118 11435254 [main] python2.7 1662 fhandler_serial::ioctl: 0 = ioctl(541B,
> 0xFFFFBCB0) ev=C st.cbInQue=46
> 
> > 
> > - Did you actually try if this fixes your problem?  It's pretty
> >    simple to build the Cygwin DLL
> >    https://cygwin.com/faq.html#faq.programming.building-cygwin
> 
> I patched it yesterday and it solved the problem...
> 
> /Ake

I pushed a patch.


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20200302/b72c0872/attachment.sig>


More information about the Cygwin mailing list