public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Simon Kirby <sim@netnation.com>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: linux-kernel@vger.kernel.org
Subject: Re: read() details
Date: Thu, 26 Jul 2001 15:31:17 -0700	[thread overview]
Message-ID: <20010726153116.A11192@netnation.com> (raw)
In-Reply-To: <20010726144719.A2098@netnation.com> <E15PtYS-0004dn-00@the-village.bc.nu>
In-Reply-To: <E15PtYS-0004dn-00@the-village.bc.nu>; from alan@lxorguk.ukuu.org.uk on Thu, Jul 26, 2001 at 11:24:28PM +0100

On Thu, Jul 26, 2001 at 11:24:28PM +0100, Alan Cox wrote:

> > Is it safe to assume that when a single read() call of x bytes a file
> > (the file being locked against other processes appending to it) returns
> > less than x bytes, the next read() will always return 0?  If so, is it
> 
> No. Posix allows any read to be interrupted. Unix doesn't do this. Even so
> another writer in parallel on the same file will cause what you describe

Well, I was meaning to imply that reads which are interrupted would be
have to be manually restarted.  But yes, there is also no guarantee that
huge reads will not return the requested size, which in effect makes any
don't-read-again-just-to-get-an-EOF optimization more trouble than it
would be worth.

Simon-

[  Stormix Technologies Inc.  ][  NetNation Communications Inc. ]
[       sim@stormix.com       ][       sim@netnation.com        ]
[ Opinions expressed are not necessarily those of my employers. ]

      reply	other threads:[~2001-07-26 22:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-26 21:47 read() details Simon Kirby
2001-07-26 22:24 ` Alan Cox
2001-07-26 22:31   ` Simon Kirby [this message]

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=20010726153116.A11192@netnation.com \
    --to=sim@netnation.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    /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