X-Recipient: archive-cygwin AT delorie DOT com 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: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) Subject: Re: Setting termios VMIN > 0 and VTIME > 0 on non blocking file To: Thomas Dickey References: <791909910 DOT 16332184 DOT 1584000356533 DOT JavaMail DOT zimbra AT his DOT com> 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 X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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?= Cc: cygwin 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 02CB1YlJ007790 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;             }         } -- 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