X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=TQA5H72HSW1juRcZ IRAYbSmiADPmXxIh+6Nt25lnpqWOWpLNHjGpl4pj+HIxbdhvNdO6mkxhoXzue8Jf 0cpnyhJ+d/kv0UQ7o/EZoqWhMUvGHkokrlCHBoXO8ELZFXR53+78tD+wQalzRTGm iVn5dZp4OXDIdzdo5XpJ6xCqdQg= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=rt9iV5HiYV908vpTOhvVIp ns08I=; b=f1+aTEI1krf35T16uUbAJ/49/3AXrQzB+UhoYh5BWb5XPRVzYZ3eXu FQ9h7qiKXB7/UJ9G/hg74ioPV11yCzspp3bCqNUpzvr0zvyoHHfZuICltvS/Z6SJ 3t3936L1UAujp0zfd1LATrhr6Ebw+RQwtlFk8PrzT7fQjbGEXF1f4= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: 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 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-0.5 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=truth, HContent-Transfer-Encoding:8bit X-HELO: mail-lj1-f171.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=bnrkjsG3ysGzJ9P9H/53uqAb7kRcvhiH7bmPDpKJj4k=; b=GXSw4LmIaIcuZ3aRboQfh55XPHEc0zp/X9EVEYVj3o6eH3VHEFfMXh917kX/DRxXcQ 3jCGk+5poOD4lgtnU9gLts7B+LyNJTuBErdUqJCPVn55yUYET6WQmoDqB99567dTafKf KzCNq5M6sAo+WCzSIpdq5CNUVDNgeApzNp6rl4cJLI2umuU3Y4QImMRFYSam6p0NU5S7 SilFJ94fJlcnBahtTq+rlsu1D4TwgFnH3ZWw4P6AEdnOiED++Q/4V9WMdEv2J6uU86Dh R32bKvp8pnnjKzpGFzLbpSWXp9UOOoKXbGxvcrh0ogctdHHz0fID3WQV29NdKd8S8XvV 4Mlw== Subject: Re: Incorrect behavior in TIOCINQ ioctl To: cygwin AT cygwin DOT com References: <20200228192330 DOT GN4045 AT calimero DOT vinschen DOT de> From: =?UTF-8?Q?=c3=85ke_Rehnman?= Message-ID: <09e4b16c-a4fb-4062-1d29-a92a916f186b@gmail.com> Date: Sat, 29 Feb 2020 11:37:25 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <20200228192330.GN4045@calimero.vinschen.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-IsSubscribed: yes 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 -- 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