From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x141.google.com (mail-lf1-x141.google.com [IPv6:2a00:1450:4864:20::141]) by sourceware.org (Postfix) with ESMTPS id B2FDF3877006 for ; Tue, 17 Mar 2020 15:54:41 +0000 (GMT) Received: by mail-lf1-x141.google.com with SMTP id j15so17667437lfk.6 for ; Tue, 17 Mar 2020 08:54:41 -0700 (PDT) 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) Received: from [192.168.1.117] (tb213-185-244-58.cust.teknikbyran.com. [213.185.244.58]) by smtp.googlemail.com with ESMTPSA id h6sm2630041lji.39.2020.03.17.08.54.38 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 17 Mar 2020 08:54:39 -0700 (PDT) Subject: Re: Setting termios VMIN > 0 and VTIME > 0 on non blocking file To: cygwin@cygwin.com References: <9e4c6428-59de-df07-9e33-44ba95d5497f@gmail.com> <20200312114041.GJ4042@calimero.vinschen.de> <365dd437-7553-eb4e-3253-aba3bab74895@gmail.com> <20200312144445.GP4042@calimero.vinschen.de> <20200312150833.GQ4042@calimero.vinschen.de> <9e56e005-660b-373e-d557-9c8bc97c45ba@gmail.com> <20200313101247.GD512788@calimero.vinschen.de> <2156fb6d-cba9-b70e-f8c0-7043ff52ffc3@gmail.com> <8e0973e2-9554-3e69-fa88-ed51fad5b191@gmail.com> <20200316093514.GG512788@calimero.vinschen.de> <20200317121603.GI512788@calimero.vinschen.de> From: =?UTF-8?Q?=c3=85ke_Rehnman?= 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-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit 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@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Mar 2020 15:54:42 -0000 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