From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 45041 invoked by alias); 29 Feb 2020 10:37:40 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 45034 invoked by uid 89); 29 Feb 2020 10:37:40 -0000 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 Received: from mail-lj1-f171.google.com (HELO mail-lj1-f171.google.com) (209.85.208.171) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 29 Feb 2020 10:37:38 +0000 Received: by mail-lj1-f171.google.com with SMTP id e3so6183584lja.10 for ; Sat, 29 Feb 2020 02:37:38 -0800 (PST) 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== Return-Path: Received: from [192.168.1.117] (tb213-185-244-58.cust.teknikbyran.com. [213.185.244.58]) by smtp.googlemail.com with ESMTPSA id e17sm7601506ljg.101.2020.02.29.02.37.34 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 29 Feb 2020 02:37:34 -0800 (PST) Subject: Re: Incorrect behavior in TIOCINQ ioctl To: cygwin@cygwin.com References: <20200228192330.GN4045@calimero.vinschen.de> From: =?UTF-8?Q?=c3=85ke_Rehnman?= Message-ID: <09e4b16c-a4fb-4062-1d29-a92a916f186b@gmail.com> Date: Sat, 29 Feb 2020 10:37:00 -0000 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 X-SW-Source: 2020-02/txt/msg00274.txt.bz2 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