linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Russell King <rmk@arm.linux.org.uk>
To: Robert White <rwhite@pobox.com>
Cc: Ed Vance <EdV@macrolink.com>, "'Theodore Tso'" <tytso@mit.edu>,
	linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org
Subject: Re: n_tty.c driver patch (semantic and performance correction) (a ll recent versions)
Date: Sun, 28 Jul 2002 00:11:35 +0100	[thread overview]
Message-ID: <20020728001135.G32766@flint.arm.linux.org.uk> (raw)
In-Reply-To: <200207271507.56873.rwhite@pobox.com>; from rwhite@pobox.com on Sat, Jul 27, 2002 at 03:07:56PM -0700

On Sat, Jul 27, 2002 at 03:07:56PM -0700, Robert White wrote:
> I agree that that is what that line of the text says, my position is that
> the entire statement was was written nieavely, and proveably so.

Ok, so lets go through your claims.

> Throughout the entire section the standard (not the linux manual page)
> discusses "satisfying a read" (singular).

The text refers you, via a hyperlink to the read() function.  Which is
singular, because the interface is singular.  I fail to see what point
you're making here.

> The text was written with an
> "everybody will know basically what I mean" aditude that leaves it flawed
> for strict interpretation.

This sentence does not allow any misinterpretation:

   A pending read shall not be satisfied until MIN bytes are received
   (that is, the pending read shall block until MIN bytes are received),
   or a signal is received.

You call a read() on a blocking file descriptor.  It blocks until MIN bytes
are received.  End of story.  If you have MIN set to 10, and you've called
read(,,1), the pending read is blocked, for 1 byte and "shall block until
MIN bytes are received".  Crystal clear.

> And the linux manual pages still show through
> enough to use as the bases of my argument.

Who cares about the Linux manual pages when discussing a standard?  The
manual pages discuss an implementation of a standard that may very well
be buggy.  They are not a standard unto themselves.

As Alan Cox just confirmed to me - "Read SuSv3 , nothing else matters".

> Pre-Summary: My entire position rests on what the original author meant by 
> "receive".  That is, is it "receive into the driver" or "receive into the 
> user context".  He proveably meant receive into the user context (e.g. the 
> read buffer).

I disagree.  Firstly, this standard isn't describing your user space
program.  It's describing the behaviour of the read() system call with
respect to blocking.  Secondly, the third sentence of this paragraph
gives some insight into the purpose of VMIN:

  A program that uses case B to read record-based terminal I/O may block
  indefinitely in the read operation.

but that's only insight, and you can't hang too much on that.

> The best example to use for the "sloppyness" of writing in the standard and 
> manual page is that technically, if it is "receive into the driver", if you 
> have both VMIN and VTIME set non-zero, VTIME will not start until "a 
> character is received" which, by strict intrepertation of "received (by the 
> driver)", discounts the presence of any characters in the buffer.  Restated, 
> if it is "receive into the driver" this read will wait for a new character 
> even if there are hundreds of characters already buffered.

The standard covers that case:

  If data is in the buffer at the time of the read(), the result shall be
  as if data has been received immediately after the read().

So pre-existing data in the driver waiting to be read is treated as if
it were received _after_ you called read().  Which is sensible.

> (CITATION: from the linux manual page: "When both are set, a read will wait 
> until at least one character has been received, and then return  as  soon  as 
> either  MIN  characters  have been received or time TIME has passed since the 
> last character was received.")

The Linux manual page is not a standard.  It is therefore meaningless to
this discussion.

> [rest cut]

-- 
Russell King (rmk@arm.linux.org.uk)                The developer of ARM Linux
             http://www.arm.linux.org.uk/personal/aboutme.html


  reply	other threads:[~2002-07-27 23:08 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-26 17:48 n_tty.c driver patch (semantic and performance correction) (a ll recent versions) Ed Vance
2002-06-26 20:42 ` Russell King
2002-06-27 16:37 ` Robert White
2002-07-26 14:17 ` Russell King
2002-07-27 22:07   ` Robert White
2002-07-27 23:11     ` Russell King [this message]
2002-07-27 23:21     ` Andries Brouwer
2002-07-28  2:34       ` Robert White
2002-07-28  3:01         ` Stevie O
2002-07-28 13:34         ` Andries Brouwer
2002-07-28 20:04         ` Alan Cox
2002-07-30  7:41           ` Robert White
2002-07-28  2:36       ` Robert White
  -- strict thread matches above, loose matches on Subject: below --
2002-07-31 16:58 Ed Vance
2002-07-30 17:07 Ed Vance
2002-07-29 21:46 Ed Vance
2002-07-30  7:50 ` Robert White
2002-06-28 18:12 Ed Vance
2002-06-17 17:27 Ed Vance
2002-06-18  2:00 ` Robert White
2002-06-18 13:05   ` Stuart MacDonald

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020728001135.G32766@flint.arm.linux.org.uk \
    --to=rmk@arm.linux.org.uk \
    --cc=EdV@macrolink.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=rwhite@pobox.com \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).