From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755163AbcEDX1e (ORCPT ); Wed, 4 May 2016 19:27:34 -0400 Received: from relay5-d.mail.gandi.net ([217.70.183.197]:38283 "EHLO relay5-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753402AbcEDX1d (ORCPT ); Wed, 4 May 2016 19:27:33 -0400 X-Originating-IP: 109.190.213.243 Subject: Re: [BUG] drivers/tty: read() on a noncanonical blocking tty randomly fails when VMIN > received >= buf To: Peter Hurley References: <16504442-9e91-aaab-1f2b-9b4aa9c219f5@farjump.io> <572A80C0.4080704@hurleysoftware.com> Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org From: Julio Guerra Message-ID: <3319f492-9b1b-d006-e903-7de761a87a53@farjump.io> Date: Thu, 5 May 2016 01:27:28 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: <572A80C0.4080704@hurleysoftware.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >> When a tty (here a slave pty) is set in noncanonical input and blocking read modes, a read() randomly blocks when: >> "VMIN > kernel received >= user buffer size > 0". >> >> The standard says that read() should block until VMIN bytes are received [1][2]. Whether this is an implementation defined case not really specified by POSIX or not, it should not behave randomly (otherwise it really should be documented in termios manpage). > > This is not a bug. > > From the termios(3) man page: > > * MIN > 0; TIME == 0: read(2) blocks until the lesser of MIN bytes or the number of bytes requested are avail‐ > able, and returns the lesser of these two values. > This does not appear in my man... Anyway, how do you explain the random behavior then? -- Julio Guerra