From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by sourceware.org (Postfix) with ESMTPS id 412E13938804 for ; Thu, 12 Mar 2020 11:01:08 +0000 (GMT) Received: by mail-lf1-x135.google.com with SMTP id n20so1087857lfl.10 for ; Thu, 12 Mar 2020 04:01:08 -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:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=bH+AOompwHM0Lm65nxUrkJR3iRFKsclwlTddRJbEtVc=; b=naXcysSlDsKDVuYRHLrzloWIqkd5iQZs4W4RiRF01IoyWwysNuTQSepusSOoHTsQ4F CrDWTTNDMfN2BC73iZ1GRn3j3vtehb0aOife1hNW8HMSoNfktjakSPCrQjRTsH4wcdKQ NMuZ9C/c+OfyftVttEV1p7LjmtIIStl5LGuAnWYk32pxUd75K/oXPR68pOUc7AVctYFR T70FZpXMdPsoA4moYis2SrBRtwGY+4kinsAPf5P7JV9Tg1/QWOweIZDY0tqd0zwUmanJ LjZT7KKUD7mthuL+JrWHfFdyQz7sFQw8r+AqVSqDmUWOXHeOj9VDiSzrFdlGpHxTxOZq Y2fg== X-Gm-Message-State: ANhLgQ0HG9+FPJ7/ypyiXnJ3x0761ZgtDjagRql2EGTRN/ppduIqQMqA HiVjOy74GSowYfuY4kc8dPU8YsRV6P0= X-Google-Smtp-Source: ADFU+vuN/QdnbDYB1CR2nBaugAwGQhQdogEOqy250tvoVMBcFzI16/bme+4Ptsh+Ty7diEj9Ly5ToA== X-Received: by 2002:ac2:4316:: with SMTP id l22mr4985607lfh.150.1584010866366; Thu, 12 Mar 2020 04:01:06 -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 v10sm27816385lfb.61.2020.03.12.04.01.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 12 Mar 2020 04:01:05 -0700 (PDT) Subject: Re: Setting termios VMIN > 0 and VTIME > 0 on non blocking file To: Thomas Dickey Cc: cygwin References: <791909910.16332184.1584000356533.JavaMail.zimbra@his.com> From: =?UTF-8?Q?=c3=85ke_Rehnman?= Message-ID: Date: Thu, 12 Mar 2020 12:01:01 +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: <791909910.16332184.1584000356533.JavaMail.zimbra@his.com> Content-Language: en-US X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, HTML_MESSAGE, 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 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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: Thu, 12 Mar 2020 11:01:09 -0000 On 2020-03-12 09:05, Thomas Dickey wrote: > If not "correct", it's certainly inconsistent with all other systems. > I noticed it recently: > > https://invisible-island.net/ncurses/tack/CHANGES.html#t20200220 > > https://github.com/cygwinports/tack/issues/1 > > It's either recently-broken, or just coincidence :-) Beer fine for you Thomas for copying email-addresses in the reply :-) Looking at Linux tty line discipline reveals the VMIN and VTIME are ignored if O_NONBLOCK flag is set.         if (!input_available_p(tty, 0)) {             up_read(&tty->termios_rwsem);             tty_buffer_flush_work(tty->port);             down_read(&tty->termios_rwsem);             if (!input_available_p(tty, 0)) {                 if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) {                     retval = -EIO;                     break;                 }                 if (tty_hung_up_p(file))                     break;                 /*                  * Abort readers for ttys which never actually                  * get hung up.  See __tty_hangup().                  */                 if (test_bit(TTY_HUPPING, &tty->flags))                     break;                 if (!timeout)                     break; *<= EXIT HERE if VTIME == 0*                 if (file->f_flags & O_NONBLOCK) {                     retval = -EAGAIN; *<==== EXIT HERE*                     break;                 }                 if (signal_pending(current)) {                     retval = -ERESTARTSYS;                     break;                 }                 up_read(&tty->termios_rwsem);                 timeout = wait_woken(&wait, TASK_INTERRUPTIBLE, *<=== BLOCKING HERE!*                         timeout);                 down_read(&tty->termios_rwsem);                 continue;             }         }