X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2AED3395BC55 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1584460484; bh=bAa3pYXYTMgyxcvyPXuXfTpbCenz7xBIkcvI21eBCRs=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=gG2sS4P5sBdSXPxtFECFQpBsqRbgyGHQWqtRhw+GgsiRYt1eiRtp9P7EimqqeqROT fbbgsYxIDHdmTVorSI8v6I8/6bmyf3yfeUXdBQb70WTse59zRqUZ4OAxhzkVzYaAnX 6P+M/3hjSyb4ktEi6JCh4i/X0PoywWkWN+Hr8M2Q= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=X9tWcCfmSvgUVo9KnT3qFcLRZw/MEsrJXg1r5OA3owE=; b=sAr7N4I5vYFBQmm1BZfHVEhmSqgrbMvmEKWpfqlkqgzKuJ7ZujQe+8NIoeg/KNsqxw RVNEipo8OVRs+mqLqnGKIGxeYamwun5F8hWAczmZCwxIOR1pFoGke23a3hTmhLTHnF0i HcKvkEqedn4/bRXFWbl9mfxX7APVURK6UyvPsoZ2bVaVJ+1nZe8XTejSLbkg82TWEcyq 4fXHx0Cm0KiHYQJbHYRaHRfG7y+kiJnZmsBGvbkSbn/htJNIa/TO3trNsCWrVoOHDpCf +xBotBaYCiUags575Rv3RzR8Wxua/L2PpoHmujHA1gYJtELa9P70saEx5MFkTTSbkJG5 fhdg== X-Gm-Message-State: ANhLgQ0f0Z0PepIdUn3Cx6n5E8prMi/6xx/FpU0Kn9Qaib92TQbnwVIe jM1Hn7DklCIMaw1gdZvFYOebr5ie X-Google-Smtp-Source: ADFU+vsJMyfjI1Av3xMZLTLXC/6qMWbs6YbD56RvzDlNUNV6yXna2gkftZdc6JBRVn+HdWudkk64FA== X-Received: by 2002:a05:6512:3195:: with SMTP id i21mr5021lfe.186.1584460480204; Tue, 17 Mar 2020 08:54:40 -0700 (PDT) Subject: Re: Setting termios VMIN > 0 and VTIME > 0 on non blocking file To: cygwin AT cygwin DOT com References: <9e4c6428-59de-df07-9e33-44ba95d5497f AT gmail DOT com> <20200312114041 DOT GJ4042 AT calimero DOT vinschen DOT de> <365dd437-7553-eb4e-3253-aba3bab74895 AT gmail DOT com> <20200312144445 DOT GP4042 AT calimero DOT vinschen DOT de> <20200312150833 DOT GQ4042 AT calimero DOT vinschen DOT de> <9e56e005-660b-373e-d557-9c8bc97c45ba AT gmail DOT com> <20200313101247 DOT GD512788 AT calimero DOT vinschen DOT de> <2156fb6d-cba9-b70e-f8c0-7043ff52ffc3 AT gmail DOT com> <8e0973e2-9554-3e69-fa88-ed51fad5b191 AT gmail DOT com> <20200316093514 DOT GG512788 AT calimero DOT vinschen DOT de> <20200317121603 DOT GI512788 AT calimero DOT vinschen DOT de> Message-ID: Date: Tue, 17 Mar 2020 16:54:35 +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: <20200317121603.GI512788@calimero.vinschen.de> Content-Language: en-US X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: =?utf-8?q?=C3=85ke_Rehnman_via_Cygwin?= Reply-To: =?UTF-8?Q?=c3=85ke_Rehnman?= Content-Type: text/plain; charset="utf-8"; Format="flowed" Errors-To: cygwin-bounces AT cygwin DOT com Sender: "Cygwin" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 02HFt8Nq026064 On 2020-03-17 13:16, Corinna Vinschen wrote: > Hi Åke, > > On Mar 16 10:35, Corinna Vinschen wrote: >> On Mar 14 11:36, Åke Rehnman via Cygwin wrote: >>> On 2020-03-14 11:23, Åke Rehnman wrote: >>>>>> BTW there is a gremlin in the "else if (ev)" line.... >>>>> A gremlin?  Would you mind to explain?  Btw., if you find a bug >>>>> in the code, we do take patches :) https://cygwin.com/contrib.html >>>> If we have an error event in ev it will make a blocking read even if >>>> VTIME==0. >> Ah, yeah, I was aware of that, I just ignored it for now since I'm not >> sure what the best way to handle that is. >> >> Two options come to mind, either ignoring these errors entirely, or >> returning -1 with errno set to EIO, along the lines of the Linux test >> for tty_io_error() at the start of tty_read. >> >> However, I have a sinking feeling that the function needs a rewrite >> anyway. >> >> For instance, consider reading in blocking mode, which may result in >> running the for loop more than once. If the first loop successfully >> read 4 bytes, and the second loop runs into an error from >> ClearCommError, the function will return -1 with errno set, completely >> ignoring the fact that 4 bytes have been read already. >> >> It should return 4 in this case, and only the next run of >> fhandler_serial::raw_read *might* return -1. >> >> This code really shows its age... > I have revamped the fhandler_serial::raw_read function, but I need > somebody for testing. Any chance you volunteer for that job? > We may need a couple of days to iron out all problems, but I think > the code is more sound now than the original function. I even > added a couple of comments to the code (*gasp*) so there's stuff > to discuss and to see why I did it that way. > > For a quicker turn around we can also use Freenode IRC, see > https://cygwin.com/irc.html > > Interested? Sure, bring it on! /Ake -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple