public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Timo Sirainen <tss@iki.fi>
To: Ray Lee <ray-lk@madrabbit.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: SMP read() stopping at memory page boundaries
Date: Wed, 20 Jun 2007 19:57:02 +0300	[thread overview]
Message-ID: <1182358622.3768.98.camel@hurina> (raw)
In-Reply-To: <2c0942db0706200922i15ce44b0xceaed95d002dba33@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 781 bytes --]

On Wed, 2007-06-20 at 09:22 -0700, Ray Lee wrote:
> On 6/20/07, Timo Sirainen <tss@iki.fi> wrote:
> > On Wed, 2007-06-20 at 17:52 +0300, Timo Sirainen wrote:
> > > Sometimes read() returns only 4096 bytes. I'm locking the file, so I
> > > don't think this should ever happen, right?
> 
> man 2 read
> 
> read() is always allowed to return less than you asked for. You need
> to go back and ask for the rest. That's why people wrap read() and
> write() in loops, and use those wrapped versions instead.

I thought this wouldn't happen when reading from local filesystems.
Anyway, my real program was doing that, and it was still seeing partial
data. But looks like I can't reproduce it in my test program with two
pread()s, so I'll have to do some more debugging.


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2007-06-20 16:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-20 14:52 SMP read() stopping at memory page boundaries Timo Sirainen
2007-06-20 15:48 ` Timo Sirainen
2007-06-20 16:22   ` Ray Lee
2007-06-20 16:57     ` Timo Sirainen [this message]
2007-06-20 17:05       ` Alan Cox
2007-06-20 17:48         ` Timo Sirainen
2007-06-20 23:22           ` Jiri Kosina

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=1182358622.3768.98.camel@hurina \
    --to=tss@iki.fi \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ray-lk@madrabbit.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